Please tell me anything wrong in this query please help me follwing query

SELECT o100161.ORG_STRUCTURE_VERSION_ID as E100351,AVG(o100163.PLANNED) as E100360_AVG,AVG(o100163.ACTUAL) as E100180_AVG,( SUM(fx102) )-( SUM(fx103) ) as C_1,( SUM(fx105) )-( SUM(fx106) ) as C_2,( SUM(fx108) )-( SUM(fx109) ) as C_3
FROM ( SELECT o100165.SEGMENT1 AS fx100, SUM(o100165.ACR) AS fx102, SUM(o100165.ADR) AS fx103, SUM(o100165.BDR) AS fx105, SUM(o100165.BCR) AS fx106, SUM(o100165.ECR) AS fx108, SUM(o100165.EDR) AS fx109 FROM ( SELECT
nvl(src.user_je_source_name, '**************') SOURCE,
nvl(cat.user_je_category_name, '**************') CATEGORY,
jeh.name NAME,
jel.code_combination_id CCID,
jeh.DEFAULT_EFFECTIVE_DATE,
jel.period_name PERIOD_NAME,
jel.effective_date EFFECTIVE_DATE,
jel.description DESCRIPTION,
seq.name SEQUENCE_NAME,
jeh.doc_sequence_value DOCUMENT_NUMBER,
jel.accounted_dr,
jel.accounted_cr,
decode(jeh.actual_flag,'B',jel.accounted_dr,'E',0,'A',0)bdr,
decode(jeh.actual_flag,'B',jel.accounted_Cr,'E',0,'A',0)bcr,
decode(jeh.actual_flag,'B',0,'E',jel.accounted_Dr,'A',0)EDr,
decode(jeh.actual_flag,'B',0,'E',jel.accounted_Cr,'A',0)ECr,
decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Dr)ADr,
decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Cr)ACr,
jel.JE_LINE_NUM,
cc.segment7 Project_COA_No,
cc.description Segment_description,
pa.segment1,
jeh.actual_flag,
PA.NAME PROJECT_NAME,
cc.segment1||'.'||cc.segment2||'.'||cc.segment3||'.'||cc.segment4||'.'||cc.segment5 seg_desc
FROM gl_je_lines jel,
gl_code_combinations cc,
gl_je_headers jeh,
-- gl_je_batches jeb,
gl_je_categories cat,
gl_je_sources src,
fnd_document_sequences seq,
pa_projects_all pa,
XXEPM_FINANCE_INTEGRATION XX
WHERE
((nvl(accounted_dr,0) != 0 OR nvl(accounted_cr,0) != 0) OR
(nvl(accounted_dr,0) = 0 AND nvl(accounted_cr,0) = 0 AND
stat_amount is not NULL))
AND jeh.je_header_id = jel.je_header_id
AND src.je_source_name = jeh.je_source
AND cat.je_category_name = jeh.je_category
AND seq.doc_sequence_id(+) = jeh.doc_sequence_id
AND jel.code_combination_id = cc.code_combination_id
AND XX.EPM_PA_NO=PA.SEGMENT1
AND XX.FINANCE_PA_COA_SEG=CC.SEGMENT7
ORDER BY jeh.name, jel.je_line_num
) o100165 GROUP BY o100165.SEGMENT1) ,
( select * from PER_ORG_STRUCTURE_ELEMENTS_V
) o100161,
( SELECT PPA.CARRYING_OUT_ORGANIZATION_ID Organization, PPA.PROJECT_ID as "Project ID",ppa.segment1 as "Project No" ,PPA.NAME as "Project Name",
nvl(trunc(((sysdate - PPA.SCHEDULED_START_DATE)/( PPA.scheduled_finish_date - PPA.SCHEDULED_START_DATE) *100 )),0) Planned,
nvl(TRUNC(AVG(PPC.COMPLETED_PERCENTAGE)),0) Actual
FROM PA_PROJECTS_ALL PPA , PA_PERCENT_COMPLETES PPC
WHERE PPA.CARRYING_OUT_ORGANIZATION_ID IN (SELECT A.ORGANIZATION_ID_CHILD
FROM PER_ORG_STRUCTURE_ELEMENTS_V A, PA_IMPLEMENTATIONS_ALL B
WHERE A.ORG_STRUCTURE_VERSION_ID= B.ORG_STRUCTURE_VERSION_ID)
AND PPA.TEMPLATE_FLAG='N'
AND PPC.PROJECT_ID(+) = PPA.PROJECT_ID
GROUP BY PPA.CARRYING_OUT_ORGANIZATION_ID,PPA.PROJECT_ID,ppa.segment1, PPA.NAME ,PPA.SCHEDULED_START_DATE,PPA.scheduled_finish_date
) o100163
WHERE ( (o100163."Project No" = fx100)
and (o100161.ORGANIZATION_ID_CHILD = o100163.ORGANIZATION))
GROUP BY o100161.ORG_STRUCTURE_VERSION_ID;
the second query is as follows
SELECT o100163."Project Name" as E100386,( SUM(o100165.ACR) )-( SUM(o100165.ADR) ) as C_1,( SUM(o100165.BDR) )-( SUM(o100165.BCR) ) as C_2,( SUM(o100165.ECR) )-( SUM(o100165.EDR) ) as C_3
FROM ( SELECT PPA.CARRYING_OUT_ORGANIZATION_ID Organization, PPA.PROJECT_ID as "Project ID",ppa.segment1 as "Project No" ,PPA.NAME as "Project Name",
nvl(trunc(((sysdate - PPA.SCHEDULED_START_DATE)/( PPA.scheduled_finish_date - PPA.SCHEDULED_START_DATE) *100 )),0) Planned,
nvl(TRUNC(AVG(PPC.COMPLETED_PERCENTAGE)),0) Actual
FROM PA_PROJECTS_ALL PPA , PA_PERCENT_COMPLETES PPC
WHERE PPA.CARRYING_OUT_ORGANIZATION_ID IN (SELECT A.ORGANIZATION_ID_CHILD
FROM PER_ORG_STRUCTURE_ELEMENTS_V A, PA_IMPLEMENTATIONS_ALL B
WHERE A.ORG_STRUCTURE_VERSION_ID= B.ORG_STRUCTURE_VERSION_ID)
AND PPA.TEMPLATE_FLAG='N'
AND PPC.PROJECT_ID(+) = PPA.PROJECT_ID
GROUP BY PPA.CARRYING_OUT_ORGANIZATION_ID,PPA.PROJECT_ID,ppa.segment1, PPA.NAME ,PPA.SCHEDULED_START_DATE,PPA.scheduled_finish_date
) o100163,
( SELECT
nvl(src.user_je_source_name, '**************') SOURCE,
nvl(cat.user_je_category_name, '**************') CATEGORY,
jeh.name NAME,
jel.code_combination_id CCID,
jeh.DEFAULT_EFFECTIVE_DATE,
jel.period_name PERIOD_NAME,
jel.effective_date EFFECTIVE_DATE,
jel.description DESCRIPTION,
seq.name SEQUENCE_NAME,
jeh.doc_sequence_value DOCUMENT_NUMBER,
jel.accounted_dr,
jel.accounted_cr,
decode(jeh.actual_flag,'B',jel.accounted_dr,'E',0,'A',0)bdr,
decode(jeh.actual_flag,'B',jel.accounted_Cr,'E',0,'A',0)bcr,
decode(jeh.actual_flag,'B',0,'E',jel.accounted_Dr,'A',0)EDr,
decode(jeh.actual_flag,'B',0,'E',jel.accounted_Cr,'A',0)ECr,
decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Dr)ADr,
decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Cr)ACr,
jel.JE_LINE_NUM,
cc.segment7 Project_COA_No,
cc.description Segment_description,
pa.segment1,
jeh.actual_flag,
PA.NAME PROJECT_NAME,
cc.segment1||'.'||cc.segment2||'.'||cc.segment3||'.'||cc.segment4||'.'||cc.segment5 seg_desc
FROM gl_je_lines jel,
gl_code_combinations cc,
gl_je_headers jeh,
-- gl_je_batches jeb,
gl_je_categories cat,
gl_je_sources src,
fnd_document_sequences seq,
pa_projects_all pa,
XXEPM_FINANCE_INTEGRATION XX
WHERE
((nvl(accounted_dr,0) != 0 OR nvl(accounted_cr,0) != 0) OR
(nvl(accounted_dr,0) = 0 AND nvl(accounted_cr,0) = 0 AND
stat_amount is not NULL))
AND jeh.je_header_id = jel.je_header_id
AND src.je_source_name = jeh.je_source
AND cat.je_category_name = jeh.je_category
AND seq.doc_sequence_id(+) = jeh.doc_sequence_id
AND jel.code_combination_id = cc.code_combination_id
AND XX.EPM_PA_NO=PA.SEGMENT1
AND XX.FINANCE_PA_COA_SEG=CC.SEGMENT7
ORDER BY jeh.name, jel.je_line_num
) o100165
WHERE ( (o100163."Project No" = o100165.SEGMENT1))
GROUP BY o100163."Project Name";

> please tell me anything wrong in this query
Umm, it's completely unreadable?
Even formatted (with a little help from the wangz.net online SQL formatter, though it needed some manual editing) it's pretty hard to see what it's meant to be doing, due to all the nesting and cryptic naming. This is just the first one:
SELECT o100161.org_structure_version_id AS e100351
     , AVG(o100163.planned) AS e100360_avg
     , AVG(o100163.actual) AS e100180_avg
     , SUM(fx102) - SUM(fx103) AS c_1
     , SUM(fx105) - SUM(fx106) AS c_2
     , SUM(fx108) - SUM(fx109) AS c_3
FROM   ( SELECT o100165.segment1 AS fx100
              , SUM(o100165.acr) AS fx102
              , SUM(o100165.adr) AS fx103
              , SUM(o100165.bdr) AS fx105
              , SUM(o100165.bcr) AS fx106
              , SUM(o100165.ecr) AS fx108
              , SUM(o100165.edr) AS fx109
         FROM   GG( SELECT NVL(src.user_je_source_name,'**************') source
                       , NVL(cat.user_je_category_name,'**************') category
                       , jeh.NAME NAME
                       , jel.code_combination_id ccid
                       , jeh.default_effective_date
                       , jel.period_name period_name
                       , jel.effective_date effective_date
                       , jel.description description
                       , seq.NAME sequence_name
                       , jeh.doc_sequence_value document_number
                       , jel.accounted_dr
                       , jel.accounted_cr
                       , DECODE(jeh.actual_flag, 'B',jel.accounted_dr, 'E',0, 'A',0) bdr
                       , DECODE(jeh.actual_flag, 'B',jel.accounted_cr, 'E',0, 'A',0) bcr
                       , DECODE(jeh.actual_flag, 'B',0, 'E',jel.accounted_dr, 'A',0) edr
                       , DECODE(jeh.actual_flag, 'B',0, 'E',jel.accounted_cr, 'A',0) ecr
                       , DECODE(jeh.actual_flag, 'B',0, 'E',0, 'A',jel.accounted_dr) adr
                       , DECODE(jeh.actual_flag, 'B',0, 'E',0, 'A',jel.accounted_cr) acr
                       , jel.je_line_num
                       , cc.segment7 project_coa_no
                       , cc.description segment_description
                       , pa.segment1
                       , jeh.actual_flag
                       , pa.NAME project_name
                       , cc.segment1 ||'.' ||cc.segment2 ||'.' ||cc.segment3 ||'.'
                       ||cc.segment4 ||'.' ||cc.segment5 seg_desc
                  FROM   gl_je_lines jel
                       , gl_code_combinations cc
                       , gl_je_headers jeh
                       , gl_je_categories cat
                       , gl_je_sources src
                       , fnd_document_sequences seq
                       , pa_projects_all pa
                       , xxepm_finance_integration xx
                  WHERE  (    ( NVL(accounted_dr,0) != 0 OR NVL(accounted_cr,0) != 0 )
                          OR  (    NVL(accounted_dr,0) = 0
                               AND NVL(accounted_cr,0) = 0
                               AND stat_amount IS NOT NULL ) )
                  AND    jeh.je_header_id = jel.je_header_id
                  AND    src.je_source_name = jeh.je_source
                  AND    cat.je_category_name = jeh.je_category
                  AND    seq.doc_sequence_id (+)  = jeh.doc_sequence_id
                  AND    jel.code_combination_id = cc.code_combination_id
                  AND    xx.epm_pa_no = pa.segment1
                  AND    xx.finance_pa_coa_seg = cc.segment7
                  ORDER BY jeh.NAME, jel.je_line_num) o100165
          GROUP BY o100165.segment1)
     , ( SELECT *
         FROM   per_org_structure_elements_v) o100161
     , ( SELECT ppa.carrying_out_organization_id organization
              , ppa.project_id AS "Project ID"
              , ppa.segment1 AS "Project No"
              , ppa.NAME AS "Project Name"
              , NVL
                ( TRUNC
                  ( ( (SYSDATE - ppa.scheduled_start_date) /
                      (ppa.scheduled_finish_date - ppa.scheduled_start_date) * 100)
                , 0) planned
              , NVL(TRUNC(AVG(ppc.completed_percentage)),0) actual
         FROM   pa_projects_all ppa
              , pa_percent_completes ppc
         WHERE  ppa.carrying_out_organization_id IN
                ( SELECT a.organization_id_child
                  FROM   per_org_structure_elements_v a
                       , pa_implementations_all b
                  WHERE  a.org_structure_version_id = b.org_structure_version_id )
         AND    ppa.template_flag = 'N'
         AND ppc.project_id (+)  = ppa.project_id
         GROUP BY
                ppa.carrying_out_organization_id
              , ppa.project_id
              , ppa.segment1
              , ppa.NAME
              , ppa.scheduled_start_date
              , ppa.scheduled_finish_date ) o100163
WHERE  o100163."Project No" = fx100
AND    o100161.organization_id_child = o100163.organization
GROUP BY o100161.org_structure_version_id;

Similar Messages

  • Please tell me whats wrong with this code for sendRedirect

    /**AckController.java**/
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import java.sql.*;
    import java.util.*;
    * @version      1.0
    * @author
    public class AckController extends HttpServlet {
         * @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              System.out.println("in AckController.doGet():action: "+req.getParameter("action"));
              String viewName = "";
              viewName = "/TransportersLogin/jsp/dealerAck/DealerAddAck.jsp";
              req.setAttribute("temp","temp");
              System.out.println("1..in AckController.doGet():viewName: "+viewName);     
              resp.sendRedirect(viewName);
         * @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              doGet(req,resp);
    /*********end of servlet**********/
    /****DealerAddAck.jsp****/
    <%@ page session="true" language="java" %>
    <%@ page import="javax.servlet.*,javax.servlet.http.*,java.net.*"%>
    <%
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    <link rel="stylesheet" href="/TransportersLogin/theme/stylesecure.css">
    <%
         out.println("in jsp");
         out.println("in jsp: temp value: "+(String)request.getAttribute("temp"));
    %>
    <script>
    function consolidate()
         alert("wait");
         //document.forms[0].action = "DealerConfirmAck.html";
         //document.forms[0].submit();
    </script>
    </head>
    <body>
    <form name="frmaddclaim">
      <table border="0" cellpadding="3" cellspacing="1" width="100%">
      </table>
      <table width="100%" border="0" cellspacing="1" cellpadding="3">
        <tr>
          <td class="TDHeader" height="18" colspan="2">Add Acknowledgement Receipt</td>
        </tr>
        <tr>
          <td class="TDcolorgreybold" height="18" align="left">
               Available Invoices
          </td>
        </tr>
      </table>
      <table width="100%" border="0" height="26" cellpadding="3" cellspacing="0">
        <tr>
          <td class="tdheader" colspan="2" height="22" align="right">
          <input type="button" value="Add Receipt" name="B3" onClick="javascript:consolidate();"></td>
        </tr>
      </table>
      <table width="100%" border="0" height="26" cellpadding="3" cellspacing="0" align="left">
        <tr>
          <td class="labeltextRed" height="18" align="left">Select an Invoice from the
          list and click "Add Receipt". </td>
        </tr>
      </table>
    </form>
    </body>
    </html>I am trying to set an attribute in the request object (attribute name is temp). But in the jsp it is not getting the value of the attribute. The request is not getting transferred. Please let me know what correction is needed.
    I have used RequestDispatcher as well but in that case the control doesnt go the jsp when i used sendRedirect the control goes only if there isnt any request.getattribute in the JSP page.
    Thanks
    Nikesh

    You can;t transfer the request object using response.sendRedirect;
    Use RequestDispatcher to transfer the request object into another page.
    For Example:
    RequestDispatcher dispatcher  = getServletContext().getRequestDispatcher(viewName);
                dispatcher.include(req, resp);

  • Don't even know how to describe this... Please tell me whats wrong!

    Yesterday, my Macbook shut off because of no power. I turned it back on about 20 mins later and my clock was wrong. I opened it and had to manually change the time from Dec 31, 2000 7 pm to current date and time. Next I noticed that Safari and FireFox were acting me for verification all the time on webpages. The biggest problem is that my Coursesmart app showed that one of my books was expired on 7-17-11, which isn't here yet. I tried to go to the website through the app and it said the certificate was not valid and that the website i was trying to go to might be fake. I talked to coursesmart up to the top techs, did some things with the computer like uninstall, update, keys,. they couldn't figure it out. I figured out that all of my certificates for anything are gone. I went through the key and found the area that says what my certificates are. Its like my computer has gone back and lost all of its information. Some websites are not working, passwords are not working, and its lagging sometimes. I can't timewarp my computer because it was never turned on. Please tell me whats wrong!

    The abnormal shutdown most likely resulted in corrupted files. Start with this:
    Repair the Hard Drive and Permissions
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list. In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer. Now restart normally.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    If this doesn't work (probably won't) then backup your files and reinstall OS X. The SL installer will not erase the drive but will install a new copy of OS X then transfer all your files and applications into the new system.

  • Can someone please tell me how to fix this?

    Something is wrong with my internet like everything is white and is in columns
    http://i1015.photobucket.com/albums/af272/FlipGlaze/sadf.jpg
    Can someone please tell me how to fix this?
    This is happening with almost everywebsite I didnt do anything to settings and it just appeared.

    Your phone is not charging you. I think you may want to go and change your password on your apple id as it might be comprimised. Also talk to apple about any erronious charges.

  • Do you see anything wrong with this GL mapping in a cube?

    hi,
    Can you verify if something is wring with this mapping:
    In model 1:
    0fi_gl_4 --> 0figl_O02 --> 0figl_C02
    the standard cube shows the following key figures and I mapped them to the following fields from the datasource:
    DMSOL(in datasource) to 0Debit_LC (in DSO) to 0Debit (in cube)
    DMHAB(in datasource) to 0Credit_LC (in DSO) to 0Credit (in cube)
    In model 2:
    0fi_gl_6 --> 0figl_C01
    the standard cube shows the following key figures and I mapped them to the following fields from the datasource:
    UMSOL(in datasource) to 0Debit (in cube)
    UMHAB(in datasource) to 0Credit (in cube)
    1. Do you see anything wrong with this mapping? And what is the solution?
    2. What is the problem with the mapping if both cubes sit under the same multiprovider, since 0debit and 0credit are from differnt souce fields?
    thnx

    Hi,
    Thanks for the explanation.
    on #1,
    if my goal is to provide a sort of trial balance, credits and debits as two columns, will it be ok to assume that it should be Local Currency or could it be Document Currency, Local Currency 2 or Local Currency 3? If the latter, then how do I decide?
    on #2,
    i. why will there be difficulty creating a union between the two?
    ii. will there also be an inconsistency if I created 2 separate multiproviders for each model, and create a jump query from the 0fi gl_6 model to 0fi gl_c4 model. If not, why not in this case?
    iii. So, is there any advantage in placing a multiprovider on each of these models separately? i.e. instead of directly reporting off the cubes separately?
    3. I am wondering why in the case of gl_6 (the totals) help.sap recomended to go directly from the datasource to the cube i.e. without DSO in between.
    If without the DSO step is an advantage, what are the advantages?
    And why then do we use DSOs in most model instead? I will appreciate any reasons you may think of..
    Thnx.
    Edited by: AmandaBaah on Jul 28, 2009 11:07 AM
    Edited by: AmandaBaah on Jul 29, 2009 2:25 AM

  • Please tell me the functionality of this piece of code

    vl_faedn = sy-datum - 15.
    All amount fields are 0.00 initially.
    Please tell me the functionality of this code.What is the purpose of each query?
    YD = Commission Advance
    AB = Automatic Clearing Doc
    Y4 = Commission Invoice
    X4 = Commission Credit Memo
    K1 = Commission Adj. Invoice
    K2 = Commission Adj.Credit Memo
      Retrieve the YD document type total for a Customer
              SELECT WRBTR SHKZG
                 INTO (VL_WRBTR, VL_SHKZG)
                 FROM BSID
                 WHERE BUKRS = VL_BUKRS AND
                       KUNNR = VL_KUNNR AND
                       UMSKS = 'C' AND
                       UMSKZ = 'C' AND
                       BLART = 'YD' AND
                       ZFBDT <= VL_FAEDN.
                IF VL_SHKZG = 'H'.
                  VL_WRBTR = VL_WRBTR * -1.
                ENDIF.
                VL_YD_AMNT = VL_YD_AMNT + VL_WRBTR.
              ENDSELECT.
      Retrieve the AB document type total for a Customer
              SELECT WRBTR SHKZG
                 INTO (VL_WRBTR, VL_SHKZG)
                 FROM BSID
                 WHERE BUKRS = VL_BUKRS AND
                       KUNNR = VL_KUNNR AND
                       UMSKS = 'G' AND
                       UMSKZ = 'G' AND
                       BLART = 'AB' AND
                       ZFBDT <= VL_FAEDN.
                IF VL_SHKZG = 'H'.
                  VL_WRBTR = VL_WRBTR * -1.
                ENDIF.
                VL_AB_AMNT = VL_AB_AMNT + VL_WRBTR.
              ENDSELECT.
      Retrieve the Y4 document type total for a Vendor
              SELECT WRBTR SHKZG
                INTO (VL_WRBTR, VL_SHKZG)
                FROM BSIK
                WHERE BUKRS = VL_BUKRS AND
                      LIFNR = VL_LIFNR AND
                    ( blart = 'Y4' OR blart = 'X4' OR blart = 'K1'                OR                 blart = 'K2' ). 
                IF VL_SHKZG = 'H'.
                  VL_WRBTR = VL_WRBTR * -1.
                ENDIF.
                VL_Y4_AMNT = VL_Y4_AMNT + VL_WRBTR .
              ENDSELECT.
              VL_Y4_AMNT = -1 * VL_Y4_AMNT.
      Retrieve the YD document type total for a Vendor
              SELECT WRBTR SHKZG
                INTO (VL_WRBTR, VL_SHKZG)
                FROM BSIK
                WHERE BUKRS = VL_BUKRS AND
                      LIFNR = VL_LIFNR AND
                     blart = 'YD'.
                ( BLART = 'YD' OR  BLART = 'K1' OR
                        BLART = 'K2' ).  " Insert
                IF VL_SHKZG = 'H'.
                  VL_WRBTR = VL_WRBTR * -1.
                ENDIF.
                VL_YD_AMNT1 = VL_YD_AMNT1 + VL_WRBTR.
              ENDSELECT.
              VL_YD_AMNT1 = -1 * VL_YD_AMNT1 .
              IF VL_Y4_AMNT = 0.
                VL_TOT_AMOUNT = VL_YD_AMNT1 - VL_AB_AMNT.
              ELSE.
                VL_TOT_AMOUNT = VL_Y4_AMNT - ( VL_YD_AMNT + VL_AB_AMNT ).
              ENDIF.

    Hi
    I dont know what functionality you are asking, Still I try to answer some things, If it's not forgive
    vl_faedn = sy-datum - 15.
    All amount fields are 0.00 initially.
    Please tell me the functionality of this code.What is the purpose of each query?
    YD = Commission Advance
    AB = Automatic Clearing Doc
    Y4 = Commission Invoice
    X4 = Commission Credit Memo
    K1 = Commission Adj. Invoice
    K2 = Commission Adj.Credit Memo
    Retrieve the YD document type total for a Customer
    SELECT WRBTR SHKZG
    INTO (VL_WRBTR, VL_SHKZG)
    FROM BSID
    WHERE BUKRS = VL_BUKRS AND
    KUNNR = VL_KUNNR AND
    UMSKS = 'C' AND
    UMSKZ = 'C' AND
    BLART = 'YD' AND
    ZFBDT <= VL_FAEDN.
    The Above query retrieves field values WRBTR SHKZG from BSID table to the Local Variable VL_WRBTR & VL_SHKZG , if it satisfies the WHERE condition mentioned for the YD docu type for the Customer
    What I suggests , the IF operation should be outside the SELECT-ENDSELECT. May be you have a requirement, I dont know
    Atleast You have to perform SUBRC check.. Before the IF operation. for the VL_SHKZG = 'H'.
    IF VL_SHKZG = 'H'.
    VL_WRBTR = VL_WRBTR * -1.
    ENDIF.
    VL_YD_AMNT = VL_YD_AMNT + VL_WRBTR.
    ENDSELECT.
    i.e., What , Here every SELECT query is performing for some document type for customer and vendor with some variable arithmetic operations .
    Retrieve the AB document type total for a Customer
    SELECT WRBTR SHKZG
    INTO (VL_WRBTR, VL_SHKZG)
    FROM BSID
    WHERE BUKRS = VL_BUKRS AND
    KUNNR = VL_KUNNR AND
    UMSKS = 'G' AND
    UMSKZ = 'G' AND
    BLART = 'AB' AND
    ZFBDT <= VL_FAEDN.
    IF VL_SHKZG = 'H'.
    VL_WRBTR = VL_WRBTR * -1.
    ENDIF.
    VL_AB_AMNT = VL_AB_AMNT + VL_WRBTR.
    ENDSELECT.
    Retrieve the Y4 document type total for a Vendor
    SELECT WRBTR SHKZG
    INTO (VL_WRBTR, VL_SHKZG)
    FROM BSIK
    WHERE BUKRS = VL_BUKRS AND
    LIFNR = VL_LIFNR AND
    ( blart = 'Y4' OR blart = 'X4' OR blart = 'K1' OR blart = 'K2' ).
    IF VL_SHKZG = 'H'.
    VL_WRBTR = VL_WRBTR * -1.
    ENDIF.
    VL_Y4_AMNT = VL_Y4_AMNT + VL_WRBTR .
    ENDSELECT.
    VL_Y4_AMNT = -1 * VL_Y4_AMNT.
    Retrieve the YD document type total for a Vendor
    SELECT WRBTR SHKZG
    INTO (VL_WRBTR, VL_SHKZG)
    FROM BSIK
    WHERE BUKRS = VL_BUKRS AND
    LIFNR = VL_LIFNR AND
    blart = 'YD'.
    ( BLART = 'YD' OR BLART = 'K1' OR
    BLART = 'K2' ). " Insert
    IF VL_SHKZG = 'H'.
    VL_WRBTR = VL_WRBTR * -1.
    ENDIF.
    VL_YD_AMNT1 = VL_YD_AMNT1 + VL_WRBTR.
    ENDSELECT.
    VL_YD_AMNT1 = -1 * VL_YD_AMNT1 .
    IF VL_Y4_AMNT = 0.
    VL_TOT_AMOUNT = VL_YD_AMNT1 - VL_AB_AMNT.
    ELSE.
    VL_TOT_AMOUNT = VL_Y4_AMNT - ( VL_YD_AMNT + VL_AB_AMNT ).
    ENDIF.
    Reward points  if useful
    Edited by: GP on May 10, 2008 9:02 PM

  • I have installed mountain lion on my macbook pro ,but it made my mac very slow. Would someone please tell me how  to uninstall this one and reinstall snow leopard?

    Hello,
    I have installed mountain lion on my macbook pro ,but it made my mac very slow. Would someone please tell me how  to uninstall this one and reinstall snow leopard? I tried to do it by my original CDs but macbook  pro didn't let me to do it.
    Thanks

    It would be easier to just fix whatever is making your machine slow.
    I wrote a little diagnostic program to help show what might be causing these problems. Download EtreCheck from http://www.etresoft.com/download/EtreCheck.zip, run it, and paste the results here.
    Disclaimer: Although EtreCheck is free, there are other links on my site that could give me some form of compensation, financial or otherwise.

  • Can somebody please tell me how to fix this. when i try to install appleworks this pops up  so please help me i need to get this on my mac

    can somebody please tell me how to fix this. when i try to install appleworks this pops up
    so please help me i need to get this on my mac

    AppleWorks is a very old application and requires Rosetta to run under recent systems.
    Lion does not include Rosetta.
    If you browse this forum you will find many posts on this issue.

  • While trying to save a word document (Microsoft Office 2011 for Mac) in PDF, there is a section of the header or footer which is always missing!! Could anyone please tell me hot to fix this problem!!??? It works perfectly fine on my friends Mac!!

    While trying to save a word document (Microsoft Office 2011 for Mac) in PDF, there is a section of the header or footer which is always missing!! Could anyone please tell me hot to fix this problem!!??? It works perfectly fine on my friends Mac!!

    Easiest way with Acrobat pro, is save the Word document, then convert the document to PDF with Acrobat, rather than doing a "save as" in Word itself to PDF.
    Do you have Acrobat full version or Pro?

  • I have an iphone 4 and cannot get my mute off when I am using Facetime. I can hear them, but they can't hear me. When I touch the mute button, nothing happens. Can someone please tell me how to fix this?

    I have an iphone 4 and cannot get my mute off when I am using Facetime. I can hear them, but they can't hear me. When I touch the mute button, nothing happens. Can someone please tell me how to fix this?

    the mute button is a switch you need to flip, not touch. if you look at it and see color, its on.

  • I already have a new book that is ready to publish as an iBook. In addition I also have an app prepared for this book. Please tell me how to upload this book (title is: "How To Cope...with life") and the app for it into your iBook Authors app so I can hav

    I already have a new book that is ready to publish as an iBook. In addition I also have an app prepared for this book.
    Please tell me how to upload this book (title is: "How To Cope...with life") and the app for it into your iBook Authors app so I can have it offered for sale @$0.99, in your app store?
    FROM: Terry Weber, Email: [email protected]

    https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wa/bookSignup

  • Since installing the newest version of Firefox 4.0, I am unable to access my work e-mail which uses Lotus Domino Web Access. Can anyone please tell me how to correct this problem?

    Since installing the newest version of Firefox 4.0, I am unable to access my work e-mail which uses Lotus Domino Web Access. Can anyone please tell me how to correct this problem?

    Sheesh. That looks hard. I think it will fall over at this point:
    "Connect to my Exchange mailbox using HTTP" 'cos Thunderbird uses only the regular email protocols: POP, IMAP and SMTP.
    Here (at work) we have in the past have had IMAP and SMTP enabled on our Exchange server so Thunderbird could then connect just like to any other regular internet-based service.
    With the change here to outlook365/outlook 2010 I've had to switch to using DavMail which lets Thunderbird talk to the mail server using OWA.
    I haven't (seriously) tried Exquilla. Whilst I have great respect for its author and some of his other add-ons, I saw no reason to use an add-on that required payment when DavMail works for free.

  • Why does Adobe Flash crash all the time? It is reallyt annoying and I'm considering using another browser. Please tell me how to fix this.

    Why does Adobe Flash crash all the time? It is really annoying and I'm considering using another browser.
    Please tell me how to fix this.

    Try to uninstall your current Flash version and update Flash to the latest version.
    Troubleshoot Flash Player installation for Windows:
    * http://kb2.adobe.com/cps/191/tn_19166.html#main_Uninstall_the_older_Flash_Player_version
    *http://www.adobe.com/software/flash/about/
    *https://support.mozilla.com/kb/Managing+the+Flash+plugin
    *http://kb.mozillazine.org/Flash

  • Am having trouble recieving daily emails from som legitimate sources. please tell me how to fix this

    I subscribe to emails from The Kim Komando Show and a few othe legitimate sources. Lately, I havent been recieving their emails. I emailed AOL, and all of my sources about this. Please tell me how to fix this. Thanks

    If you log into your email account at your providers web mail page are the emails in your Inbox there? Thunderbird downloads messages that are in your Inbox. If the messages are not there it cannot download them.
    Check the spam folder at your providers site. They might be there.

  • I charged my iPod4th gen then my usb adaptor sparks and my room smells like rubber... is there anything wrong? this happened twice.. the the usb adaptor is no longer functioning.. :) pls help!!!

    I charged my iPod4th gen then my usb adaptor sparks and my room smells like rubber... is there anything wrong? this happened twice.. the the usb adaptor is no longer functioning.. pls help!!!

    - Does the USB port work for other devices?
    - I do not know what you meanby USB adopter
    - Make an appointment at the Genius Bar of an Apple store. Bring the "USB adopter" too.
      Apple Retail Store - Genius Bar                 

Maybe you are looking for

  • Updating to panther from 9.2 on iMac G3?

    I have all the Mac OS X Panther CD's, and I can select them as the startup disk from the control panel, but when I reboot and it tries to boot from the disk but it shows the folder with the question mark in it. Are there any settings I need to disabl

  • Manufacturer Part Number in BAPI_PO_CREATE1

    Dear all, can anybody please tell me where to find the Manufacturer Part Number im BAPI_PO_CREATE1 (SAP ERP 6.04). In BAPI_PO_CREATE I can find the field, in BAPI_PO_CREATE1 it looks like it is not there but I have to use it. Thanks for any help. Bes

  • IIS Failed Request Tracing for one specific URI only

    Hey everyone, I tried setting up IIS Failed Request Tracing for one and only one specific URI to debug a problem that persists with this URI. The problem about filtering it is that it's a HTTP 200 response that contains an error message from a 3rd pa

  • Where can I Find More SlideShow Themes?

    I have been searching the store and Google looking for more Aperture slideshow themes, can anyone point me in a direction where I can find more?

  • Survey URL Missing MIG

    Dear Experts, We have a mail form with Survey URL, we tested it via TEST SEND functionality. However when we send the mail form in french we get MIG generated in the mail, but when we select dutch language while TEST SEND , there is no MIG and hence