Please share the possible T code in MM of ERP to validate the data of MM bex Queries.

Dear All,
Please share the possible T code in MM of ERP  to validate data of MM  Standard bex Queries.
Thanks
Regards,
Sai
Basic Qs
Message was edited by: Pravender Kumar

Try something like this..
data : lv_flag .
LOOP AT GT_ZKPC2 INTO GS_ZKPC2.
ld_amount = ld_amount + GS_ZKPC2-SALK3
at end of prctr.
<b>lv_flag = 'X'.</b>
endat.
at end of prctr1.
<b>IF LV_FLAG = 'X'.</b>
ld_amount = ld_amount + GS_ZKPC2-SALK3.
move GS_ZKPC2-BUKRS_VF to GS_ZKPC3-BUKRS_VF.
move GS_ZKPC2-PSPNR to GS_ZKPC3-PSPNR.
move gs_zkpc2-konts to GS_ZKPC3-BUKRS_VF.
move GS_ZKPC2-ALOC_SAKHA to GS_ZKPC3-ALOC_SAKHA.
move gs_zkpc2-prctr to gs_zkpc3-prctr.
move GS_ZKPC2-SALK3 to GS_ZKPC3-SALK3.
move gs_zkpc2-prctr1 to gs_zkpc3-prctr1.
move ld_amount TO GS_ZKPC3-RAMOUNT.
APPEND GS_ZKPC3 TO GT_ZKPC3.
clear: gs_zkpc3,ld_amount.
<b>
CLEAR LV_FLAG.</b>
endat.
endloop.
Thanks
mahesh <b></b>

Similar Messages

  • XI mapping calls an RFC in ERP to validate the ASN against the PO: lookup

    Hi Guys,
    I need validate before sending into  delivery03 IDoc
    &#61656;     The XI mapping calls an RFC in ERP to validate the ASN against the PO
                    I can check through Look up.But need which RFC will check these .
    Regd's
    Raj

    I am not sure there is a standard RFC for that..
    otherwise u can create u r own RFC FM in R3 and can use in lookup UDF.
    Regds,
    Suresh

  • Hi, I keep getting the following error code : U43M1D207 when I try to install the latest updates.

    Hi, I keep getting the following error code : U43M1D207 when I try to install the latest updates. Im trying to load the RAW conveyors for the Nikon D810 but so far pretty well frustrated.
    Any help would be greatly received.......
    Regards
    Apple

    Can you please try the solution suggested at error code U43M1D207 ?
    Thanks
    Andaleeb

  • PDA: How does the VI in the "Calling External Code (Inline C Method)" example link to the called functions?

    The PDA module provides an example of calling external code via an inline C
    The inline source code from the example:
         OSVERSIONINFO info;
         info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
         Err = GetVersionEx(&info);
         MajorVersion = info.dwMajorversion;
         MinorVersion = info.dwMinorversion;
    The PDA build specification includes *no* additional source files of any kind.  The only source file in the build is the top-level VI.  Where are the definitions for the OSVERSIONINFO type, and the GetVersionEx function drawn from?
    The VI builds and runs fine on the PDA, but I don't understand how.

    Donovan B wrote:
    Hi Dan,
    It looks like there is an OSVERSIONINFO struct and GetVersionEx function available in the coredll.lib for the application to call on a PDA running Windows Mobile 5.0.  On both operating systems, it looks like the GetVersionEx function is defined in winbase.h, so I am not sure if there is some kind of linking between the two or if the header file is automatically included when building the executable or not.  Let me do some more research and I'll let you know.
    The information for the function on Windows Mobile can be found here.
    Message Edited by Donovan B on 12-19-2007 06:33 PM
    While the API functions are mostly the same for Windows Mobile and normal Windows the actual implementation and compilation is obviously not and there is no need for that. Windwos Mobile is typically (not sure if there are other versions at all) ARM based, while the desktop version is x86 based. A huge difference.
    And when LabVIEW creates a PDA executable it mostly creates a bunch of hidden C files, invokes the Visual C for Windows CE
    tool chain and lets it create the executable. The Visual C for Windows CE tool chain comes with its own import link libraries for accessing WinAPI functions and those import link libraries reference the functions in the DLLs as they are implemented for Windows Mobile (CE). There is no kernel32.dll in Windows Mobile and why should it? You can't move normal Windows code that would expect that DLL to Windows Mobile anyhow, since it has a completely different CPU and there is always a complete recompile with the Windows CE toolchain necessary anyhow.
    Rolf Kalbermatter   
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • I have followed the directions, but on both the mobile and desktop the 3 line code that it says to enter into the other device is already filled in and I can't enter either device's code on the other. How do I get around this?

    I can't get any further on either device than "Add a Device".
    The code in the 3 little windows is uneditable on on either device. Both the computer and the phone say "Then enter this code:" but neither one will let me enter anything.

    Sounds like it's hardware issue. The iPhone warranty is based in the original country of purchase. Since it was bought in Korea you will need to ship the phone to someone you know in Korea to be taken in and then they will have to ship it back to you. The cost of shipping will be at your expense.

  • Please let me about the SAP transaction code(s)

    Please let me about the SAP transaction code(s) from which I will get monthly data of the folowing:
    Material or product wise listing of raw materials used in WIP & converted to Finished goods remaining as closing stock

    Dear parameswar
    The simple work is go to MM60, give material type ROH (for raw material) and execute.  You will get list of all raw materials.  Make a note of it and now go to MB51, give those material codes and give movement type 261 for issue from stores and execute. You will get raw materialwise details of how much quantity has been issued to WIP.  The same exercise you have to do for FERT.
    thanks
    G. Lakshmipathi

  • To bring the Vendor name & Code in FBL3N Report

    Hi Friends,
    As we need to bring the Vendor name / Code in FBL3N report, we have given the settings in the SPRO ( SPRO>Financial Accounting>General Ledger Accounting>G/L Accounts->Line items>Line items Display-->Define special fields for finding and sorting data ) by putting of BSEG table and assigned the same with LIFNR field and transported the same to Development server for testing, but after transport, the above requirements are NOT coming while we run the FBL3N report,
    Please guide me to bring the same in FBL3N as it is important requirement for us.
    Thanks
    G. Jana

    Hi
    If you are on ECC 6.0 you can use report FAGLL03. However, if you need to get vendor name also, you need to do refer to link
    Re: adding a field to FBL3N
    Regards
    Sanil K Bhandari

  • I just need a little help to connect with eCommerce API. Could anyone please give a JAVA sample code

    Hi All,
    I am looking for a sample code to just to connect with Business Catalyst eCommerce API. My aim is to simply retirieve the list of the products and update them.
    It would be really helpful, if anyone please provide me a sample code in JAVA, just to connect with the API.
    Thanks
    Ani

    public static void main(String[] args) throws RemoteException, MalformedURLException {
                        String endpoint = "https://CC.sys.com/CatalystWebS1ervice/CatalystEcommerceWebservice.asmx?WSDL"; // endpoint url can be found under Site Settings -> API -> click on eCommerce and copy the URL on the browser here.
                        CatalystEcommerceWebserviceSoapProxy sq = new CatalystEcommerceWebserviceSoapProxy(endpoint);
                        Products[] prod = new Products[2];
                        prod = sq.product_ListRetrieve(Username , Password, SiteID, CatalogueID);
                        System.out.println(prod[1].getDescription());

  • Errors Pku2ulog failed to start 0xC--35, Negolog failed to start, IDListenLog failed to start, P2PLog failed to start and HomegroupLog failed to start, all with the same failure code 0xC-- 35.

    Hi There,
    I'm getting the errors below and but I have not got any BSOD.
    The errors I'm getting in eventviewer are Pku2ulog failed to start 0xC--35, Negolog failed to start, IDListenLog failed to start, P2PLog failed to start and HomegroupLog failed to start, all with the same failure code 0xC-- 35.
    This is what the logs files says about each error.
    Pku2ulog:
    Unknown( 10): GUID=c36a26fb-03a9-d591-3984-dc17e4a48527 (No Format Information found).
    p2plog:
    Unknown( 89): GUID=fc9d5ca5-e6c8-627c-be74-e6e0a98bbf57 (No Format Information found).
    negolog:
    Unknown( 37): GUID=2553184f-6f2a-3198-ddb7-93ab1ad2d125 (No Format Information found).
    idlistenlog:
    Unknown( 10): GUID=418a567f-b393-1423-26aa-123149ef8882 (No Format Information found).
    homegrouplog:
    Unknown( 12): GUID=96f7a94a-4343-6ede-ff2b-dd1dafeed500 (No Format Information found).
    However, the 'Unknown(xx)' number changes times to times.
    Could you help me please?
    Thank you very much for your attention.
    Best Regards.

    Hi,
    If you have Home group set up, please go to Control Panel – Network and Sharing Center. Choose homegroup and sharing options and click “Leave the homegroup”.
    Juke Chou
    TechNet Community Support

  • Improve the execution of code

    hi,
    i given my program. can any one tell me how to improve the execution speed of this program. it is working very slow in quality system.
    *& Report  ZQMRSMNMWIPRPT                                              *
    REPORT  zqmrsmnmwiprpt   LINE-SIZE 328.
    TABLES : mbew, mver, mseg, mara, mkpf, makt, zqmtsmnm,keko,ckis,marc.
    DATA: PLANT TYPE mard-werks.
    DATA : BEGIN OF it_mbew OCCURS 0,
             bwkey TYPE bwkey,
             bklas LIKE mbew-bklas,
             matnr LIKE mbew-matnr,
             salk3 LIKE mbew-salk3,
             lbkum TYPE p DECIMALS 2,
             stprs LIKE mbew-stprs,
             maktx LIKE makt-maktx,
             werks LIKE mver-werks,
             gjahr LIKE mver-gjahr,
             perkz LIKE mver-perkz,
             meins LIKE mara-meins,
             EKGRP LIKE MARC-EKGRP,
             LABST TYPE p DECIMALS 2,
             EINME LIKE MARD-EINME,
             LABST1 type p DECIMALS 2,
             EINME1 LIKE MARD-EINME,
             TOTUR type p DECIMALS 2,
             SALK1 LIKE MBEW-SALK3,
             SALK2 LIKE MBEW-SALK3,
             letztzug TYPE s032-letztzug,
             letztabg TYPE s032-letztabg,
             letztver TYPE s032-letztver,
             letztbew TYPE s032-letztbew,
             tot_1  TYPE p DECIMALS 2,
             tot_11  TYPE p DECIMALS 2,
             tot_12 TYPE p DECIMALS 2,
             menge LIKE mseg-menge,
             w_lbkum TYPE p DECIMALS 2,
             tot_2  TYPE p DECIMALS 2,
              tot_21  TYPE p DECIMALS 2,
             TOT_3  TYPE P DECIMALS 2,
              TOT_31  TYPE P DECIMALS 2,
            w_consm type p decimals 2,
             w_days  TYPE p,
             erfmg TYPE p DECIMALS 2,
             erfme LIKE mseg-erfme,
             cur_rate LIKE mbew-stprs,
             w_value TYPE i,
              w_value01 TYPE i,
             w_value1 TYPE i,
             w_value11 TYPE i,
    added by mohan on 20/08/2007
             w_value2 type i,
             w_value21 type i,
    --end of addition----
          END OF it_mbew.
    DATA: BEGIN OF it_mard OCCURS 0,
            matnr TYPE mard-matnr,
            werks TYPE mard-werks,
            labst TYPE p DECIMALS 2,
            einme TYPE mard-einme,
            labst1 TYPE p DECIMALS 2,
            einme1 TYPE mard-einme,
           END OF it_mard.
    DATA : BEGIN OF it_mver OCCURS 0,
             werks LIKE mver-werks,
             gjahr LIKE mver-gjahr,
             matnr LIKE mver-matnr,
             perkz LIKE mver-perkz,
             gsv01 LIKE mver-gsv01,
             gsv02 LIKE mver-gsv02,
             gsv03 LIKE mver-gsv03,
             gsv04 LIKE mver-gsv04,
             gsv05 LIKE mver-gsv05,
             gsv06 LIKE mver-gsv06,
             gsv07 LIKE mver-gsv07,
             gsv08 LIKE mver-gsv08,
             gsv09 LIKE mver-gsv09,
             gsv10 LIKE mver-gsv10,
             gsv11 LIKE mver-gsv11,
             gsv12 LIKE mver-gsv12,
             curr_dt(08) TYPE c,
             currdt(2) TYPE n,
             tot_1 LIKE mver-gsv01,
             tot_2 LIKE mver-gsv01,
           END OF it_mver.
    DATA: BEGIN OF it_s032 OCCURS 0,
            matnr TYPE s032-matnr,
            letztzug TYPE s032-letztzug,
            letztabg TYPE s032-letztabg,
            letztver TYPE s032-letztver,
            letztbew TYPE s032-letztbew,
            werks TYPE s032-werks,
          END OF it_s032.
    DATA: it_mbew1 LIKE it_mbew OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF dt OCCURS 0,
             currdt(2) TYPE n,
             curryr(4) TYPE N,
             curryr1(4) TYPE N,
           END OF dt.
    DATA : currdate LIKE sy-datum,
           newdate  LIKE sy-datum.
    DATA : tot_12 LIKE mver-gsv01,
           tot_1  LIKE mver-gsv01,
           tot_2  LIKE mver-gsv01,
         TOT_3  LIKE MVER-GSV01.
    DATA :    abc TYPE p,
    w_mjahr LIKE mseg-mjahr,
           w_bwart LIKE mseg-bwart.
    DATA : w_lbkum TYPE p,
               w_101menge  TYPE P DECIMALS 2,
              w_102menge TYPE P DECIMALS 2.
    DATA : BEGIN OF it_mkpf OCCURS 0,
             budat LIKE mkpf-budat,
             mblnr LIKE mkpf-mblnr,
             MJAHR like mkpf-MJAHR,
           END OF it_mkpf.
    DATA : BEGIN OF it_mseg OCCURS 0,
             bwart LIKE mseg-bwart,
             menge TYPE P DECIMALS 2,
             mjahr LIKE mseg-mjahr,
             mblnr LIKE mseg-mblnr,
             erfmg TYPE p DECIMALS 2,
             erfme LIKE mseg-erfme,
             werks LIKE mseg-werks,
             matnr LIKE mseg-matnr,
            END OF it_mseg.
    *data: it_mseg like table of mseg with header line.
    DATA : BEGIN OF it_mseg1 OCCURS 0,
             w_diffmenge TYPE P DECIMALS 2,
           END OF it_mseg1.
    DATA : w_srno TYPE i,                  " Serial number.
           w_pagectr TYPE i,               " Page counter.
           w_linectr TYPE i.               " Line counter
    DATA: w_pos LIKE ckis-wrtfw_pos,
          w_pfx LIKE ckis-wrtfw_pfx,
          w_pos1 LIKE ckis-wrtfw_pos,
          w_pfx1 LIKE ckis-wrtfw_pfx,
          w_cost LIKE ckis-wrtfw_pos.
    data : curryr2(4) type n,
    curryr3(4) type n.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : BWKEY1 FOR  PLANT .
    *NO DATABASE SELECTION.
    PARAMETERS : p_kadky LIKE keko-kadky OBLIGATORY.
    *----ADDED BY MOHAN ON 20/08/2007--
    SELECT-OPTIONS : BKLAS FOR MBEW-BKLAS.
    SELECT-OPTIONS : EKGRP FOR MARC-EKGRP.
    SELECT-OPTIONS : MATNR FOR MBEW-MATNR.
    --END OF MODIFICATION--
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-001.
    PARAMETERS: p_summ AS CHECKBOX.
    PARAMETERS : SUMMARY RADIOBUTTON GROUP G1,
                 DETAILS RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECT F~bwkey
           F~bklas
           F~matnr
           F~salk3
           F~lbkum
           F~STPRS
           E~EKGRP
           INTO CORRESPONDING FIELDS OF TABLE it_mbew
                  FROM mbew AS F INNER JOIN MARC AS E
                  ON FBWKEY = EWERKS AND FMATNR = EMATNR
                  WHERE F~BKLAS IN BKLAS AND
                        F~BWKEY in BWKEY1 AND
                        F~MATNR IN MATNR AND
                        E~EKGRP IN EKGRP .
    *REFRESH it_mbew.
    *IF it_mbew IS INITIAL.
    *FREE it_mbew.
    *ENDIF.
    SELECT matnr
           werks
           labst
           einme  INTO CORRESPONDING FIELDS OF TABLE IT_MARD
                   FROM MARD
                   FOR ALL ENTRIES IN IT_MBEW
                  WHERE WERKS IN BWKEY1 AND
                        MATNR IN MATNR.
                   WHERE WERKS = IT_MBEW-BWKEY AND
                         MATNR = IT_MBEW-MATNR .
    SELECT werks
           matnr
           letztzug
           letztabg
           letztver
           letztbew
           INTO CORRESPONDING FIELDS OF TABLE IT_S032
           FROM S032
           FOR ALL ENTRIES IN IT_MBEW
           WHERE MATNR = IT_MBEW-MATNR and
                 WERKS = IT_MBEW-BWKEY.
    LOOP AT it_mbew.
      IF it_mbew-lbkum = 0 .
        DELETE it_mbew INDEX sy-tabix.
      ELSE.
      ENDIF.
    ENDLOOP.
    loop at it_mard.
      move it_mard-labst to it_mard-labst1.
      move it_mard-einme to it_mard-einme1.
      collect it_mard.
    endloop.
    CLEAR IT_MARD.
    LOOP AT IT_MARD.
    DELETE ADJACENT DUPLICATES FROM IT_MARD.
    MODIFY IT_MARD.
    ENDLOOP.
    CLEAR IT_MARD.
    *------MODIFIED BY MOHAN ON 21/10/2007
    LOOP AT IT_MBEW.
    READ TABLE IT_MARD  WITH KEY MATNR = IT_MBEW-MATNR
                                 WERKS = IT_MBEW-BWKEY.
      IT_MBEW-LABST = IT_MARD-LABST.
      IT_MBEW-EINME = IT_MARD-EINME.
    MODIFY IT_MBEW.
    ENDLOOP.
    --added by mohan 29/10/2007--
    SORT IT_S032 BY MATNR letztzug descending.
    read table it_s032 index 1.
    LOOP AT IT_MBEW.
      READ TABLE IT_S032 WITH KEY MATNR = IT_MBEW-MATNR
                                 WERKS = IT_MBEW-BWKEY.
      IT_MBEW-LETZTZUG = IT_S032-LETZTZUG.
      MODIFY IT_MBEW.
      clear it_s032.
    ENDLOOP.
    SORT IT_S032 BY MATNR letztabg descending.
    read table it_s032 index 1.
    LOOP AT IT_MBEW.
      READ TABLE IT_S032 WITH KEY MATNR = IT_MBEW-MATNR
                                 WERKS = IT_MBEW-BWKEY.
      IT_MBEW-letztabg = IT_S032-letztabg.
      MODIFY IT_MBEW.
      clear it_s032.
    ENDLOOP.
    SORT IT_S032 BY matnr letztver descending.
    read table it_s032 index 1.
    LOOP AT IT_MBEW.
      READ TABLE IT_S032 WITH KEY MATNR = IT_MBEW-MATNR
                                  WERKS = IT_MBEW-BWKEY.
      IT_MBEW-letztver = IT_S032-letztver.
      MODIFY IT_MBEW.
      clear it_s032.
    ENDLOOP.
    SORT IT_S032 BY letztbew descending.
    read table it_s032 index 1.
    LOOP AT IT_MBEW.
      READ TABLE IT_S032 WITH KEY MATNR = IT_MBEW-MATNR
                                  WERKS = IT_MBEW-BWKEY.
      IT_MBEW-letztbew = IT_S032-letztbew.
      MODIFY IT_MBEW.
      clear it_s032.
    ENDLOOP.
    SORT it_mbew BY matnr.
    LOOP AT it_mbew.
      SELECT SINGLE werks gjahr perkz INTO (mver-werks, mver-gjahr,
                                            mver-perkz)
                                            FROM mver
                                            WHERE matnr = it_mbew-matnr AND
                                            werks IN bwkey1.
      SELECT SINGLE meins INTO mara-meins
                          FROM mara
                          WHERE matnr = it_mbew-matnr.
      SELECT SINGLE maktx INTO makt-maktx
                          FROM makt
                          WHERE matnr = it_mbew-matnr.
      it_mbew-werks = mver-werks.
      it_mbew-gjahr = mver-gjahr.
      it_mbew-perkz = mver-perkz.
      it_mbew-meins = mara-meins.
      it_mbew-maktx = makt-maktx.
      MODIFY it_mbew.
    ENDLOOP.
    **DATA INTO INTERNAL TABLE OF IT_MVER.
    **LOGIC FOR GETTING PREVIOUS 6 MONTHS DATA.
    *ADDED BY MOHAN ON 20/08/2007
    SORT it_mbew BY matnr werks gjahr.
    LOOP AT it_mbew.
      dt-curryr = p_kadky+0(4).
      APPEND dt.
      SELECT  * INTO  CORRESPONDING FIELDS OF TABLE it_mver FROM mver
                        WHERE matnr = it_mbew-matnr AND
                              werks = it_mbew-werks
                              AND
                              perkz = 'P'.
    **LOGIC FOR GETTING PREVIOUS 6 MONTHS DATA.
      LOOP AT it_mver.
        if p_kadky+4(2) = '01'.
          dt-currdt = '10'.
          APPEND dt.
        elseif p_kadky+4(2) = '02'.
          dt-currdt = '11'.
          APPEND dt.
        elseif p_kadky+4(2) = '03'.
          dt-currdt = 12.
          APPEND dt.
        elseif p_kadky+4(2) = '04'.
          dt-currdt = '01'.
          APPEND dt.
        elseif p_kadky+4(2) = '05'.
          dt-currdt = '02'.
          APPEND dt.
        elseif p_kadky+4(2) = '06'.
          dt-currdt = '03'.
          APPEND dt.
        elseif p_kadky+4(2) = '07'.
          dt-currdt = '04'.
          APPEND dt.
        elseif p_kadky+4(2) = '08'.
          dt-currdt = '05'.
          APPEND dt.
        elseif p_kadky+4(2) = '09'.
          dt-currdt = '06'.
          APPEND dt.
        elseif p_kadky+4(2) = '10'.
          dt-currdt = '07'.
          APPEND dt.
        elseif p_kadky+4(2) = '11'.
          dt-currdt = '08'.
          APPEND dt.
        elseif p_kadky+4(2) = '12'.
          dt-currdt = '09'.
          APPEND dt.
        endif.
        IF dt-currdt EQ '01'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_3 = it_mver-gsv10 + it_mver-gsv11 + it_mver-gsv12 +
    it_mver-gsv07  +  it_mver-gsv08  + it_mver-gsv09.
          endif.
        ELSEIF dt-currdt EQ '02'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_3 = it_mver-gsv10
                 +  it_mver-gsv11 + it_mver-gsv12 + it_mver-gsv08  +
               it_mver-gsv09 .
          endif.
           if it_mver-gjahr = dt-curryr .
            tot_3 =   tot_3 + it_mver-gsv01.
          endif.
        ELSEIF dt-currdt EQ '03'.
          dt-curryr1 = dt-curryr - 1.
                if it_mver-gjahr = dt-curryr1.
            tot_3 =  it_mver-gsv10 + it_mver-gsv11 +
    it_mver-gsv12 + it_mver-gsv09.
          endif.
          if it_mver-gjahr = dt-curryr .
            tot_3 = tot_3 + it_mver-gsv01 + it_mver-gsv02.
          endif.
        ELSEIF dt-currdt EQ '04'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_3 = it_mver-gsv10 + it_mver-gsv11 + it_mver-gsv12.
          endif.
          if it_mver-gjahr = dt-curryr .
            tot_3 =  tot_3 + it_mver-gsv01 + it_mver-gsv02 + it_mver-gsv03.
          endif.
        ELSEIF dt-currdt EQ '05'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_3 =  it_mver-gsv11 + it_mver-gsv12.
          endif.
          if it_mver-gjahr = dt-curryr .
            tot_3 =  tot_3 + it_mver-gsv01 +
                it_mver-gsv02 + it_mver-gsv03 + it_mver-gsv04.
          endif.
        ELSEIF dt-currdt EQ '06'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_3 = it_mver-gsv12 .
          endif.
           if it_mver-gjahr = dt-curryr .
            tot_3 = tot_3 +  it_mver-gsv01 + it_mver-gsv02
                    + it_mver-gsv03 + it_mver-gsv04 + it_mver-gsv05.
          endif.
        ELSEIF dt-currdt EQ '07'.
         if it_mver-gjahr = dt-curryr .
          tot_3 = it_mver-gsv01 + it_mver-gsv02 + it_mver-gsv03
                  + it_mver-gsv04 + it_mver-gsv05 + it_mver-gsv06.
            endif.
        ELSEIF dt-currdt EQ '08'.
         if it_mver-gjahr = dt-curryr .
          tot_3 = it_mver-gsv02 + it_mver-gsv03 + it_mver-gsv04
                  + it_mver-gsv05 + it_mver-gsv06 + it_mver-gsv07.
           endif.
        ELSEIF dt-currdt EQ '09'.
         if it_mver-gjahr = dt-curryr .
          tot_3 = it_mver-gsv03 + it_mver-gsv04 + it_mver-gsv05
                  + it_mver-gsv06 + it_mver-gsv07 + it_mver-gsv08.
                 endif.
        ELSEIF dt-currdt EQ '10'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1 .
            tot_3 = it_mver-gsv04 + it_mver-gsv05 + it_mver-gsv06
                    + it_mver-gsv07 + it_mver-gsv08 + it_mver-gsv09.
          endif.
        ELSEIF dt-currdt EQ '11'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1 .
            tot_3 = it_mver-gsv05 + it_mver-gsv06 + it_mver-gsv07
                    + it_mver-gsv08 + it_mver-gsv09 + + it_mver-gsv10.
          endif.
        ELSEIF dt-currdt EQ '12'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1 .
            tot_3 =   it_mver-gsv06 + it_mver-gsv07 + it_mver-gsv08
                      + it_mver-gsv09 + it_mver-gsv10 + it_mver-gsv11 .
          endif.
        ENDIF.
    **MODIFYING THE VARIABLE TOT_1.
        it_mbew-tot_3 = tot_3.
        MODIFY it_mbew TRANSPORTING tot_3.
         IF dt-currdt EQ '01'.
    dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_1 = it_mver-gsv10 + it_mver-gsv11 + it_mver-gsv12.
          endif.
        ELSEIF dt-currdt EQ '02'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_1 = it_mver-gsv11 + it_mver-gsv12 .
          endif.
           if it_mver-gjahr = dt-curryr .
            tot_1 = tot_1 + it_mver-gsv01.
          endif.
        ELSEIF dt-currdt EQ '03'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_1 =  it_mver-gsv12.
          endif.
           if it_mver-gjahr = dt-curryr .
            tot_1 = tot_1 + it_mver-gsv01 + it_mver-gsv02.
          endif.
        ELSEIF dt-currdt EQ '04'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_1 = it_mver-gsv01 + it_mver-gsv02 + it_mver-gsv03.
          endif.
        ELSEIF dt-currdt EQ '05'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_1 =  it_mver-gsv01 +
                it_mver-gsv02 + it_mver-gsv03 + it_mver-gsv04.
          endif.
        ELSEIF dt-currdt EQ '06'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_1 = it_mver-gsv03 + it_mver-gsv04 + it_mver-gsv05.
          endif.
        ELSEIF dt-currdt EQ '07'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1 .
            tot_1 =  it_mver-gsv04 + it_mver-gsv05 + it_mver-gsv06.
          endif.
        ELSEIF dt-currdt EQ '08'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_1 = it_mver-gsv05 + it_mver-gsv06 + it_mver-gsv07.
          endif.
        ELSEIF dt-currdt EQ '09'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_1 = it_mver-gsv06 + it_mver-gsv07 + it_mver-gsv08.
          endif.
        ELSEIF dt-currdt EQ '10'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_1 = it_mver-gsv07 + it_mver-gsv08 + it_mver-gsv09.
          endif.
        ELSEIF dt-currdt EQ '11'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
                    tot_1 = it_mver-gsv08 + it_mver-gsv09 +  it_mver-gsv10.
          endif.
        ELSEIF dt-currdt EQ '12'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_1 = it_mver-gsv09 + it_mver-gsv10 + it_mver-gsv11.
          endif.
        ENDIF.
        it_mbew-tot_1 = tot_1.
        MODIFY it_mbew TRANSPORTING tot_1.
         if p_kadky+4(2) = '01'.
          dt-currdt = '10'.
          APPEND dt.
        elseif p_kadky+4(2) = '02'.
          dt-currdt = '11'.
          APPEND dt.
        elseif p_kadky+4(2) = '03'.
          dt-currdt = 12.
          APPEND dt.
        elseif p_kadky+4(2) = '04'.
          dt-currdt = '01'.
          APPEND dt.
        elseif p_kadky+4(2) = '05'.
          dt-currdt = '02'.
          APPEND dt.
        elseif p_kadky+4(2) = '06'.
          dt-currdt = '03'.
          APPEND dt.
        elseif p_kadky+4(2) = '07'.
          dt-currdt = '04'.
          APPEND dt.
        elseif p_kadky+4(2) = '08'.
          dt-currdt = '05'.
          APPEND dt.
        elseif p_kadky+4(2) = '09'.
          dt-currdt = '06'.
          APPEND dt.
        elseif p_kadky+4(2) = '10'.
          dt-currdt = '07'.
          APPEND dt.
        elseif p_kadky+4(2) = '11'.
          dt-currdt = '08'.
          APPEND dt.
        elseif p_kadky+4(2) = '12'.
          dt-currdt = '09'.
          APPEND dt.
        endif.
        IF dt-currdt EQ '01'.
    dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_2 = it_mver-gsv12 .
          endif.
        ELSEIF dt-currdt EQ '02'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_2 = it_mver-gsv01.
          endif.
        ELSEIF dt-currdt EQ '03'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_2 =  it_mver-gsv02.
          endif.
        ELSEIF dt-currdt EQ '04'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_2 = it_mver-gsv03.
          endif.
        ELSEIF dt-currdt EQ '05'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_2 =  it_mver-gsv04.
          endif.
        ELSEIF dt-currdt EQ '06'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_2 = it_mver-gsv05.
          endif.
        ELSEIF dt-currdt EQ '07'.
          dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
            tot_2 =  it_mver-gsv06.
          endif.
        ELSEIF dt-currdt EQ '08'.
         dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr.
          tot_2 = it_mver-gsv07.
          endif.
        ELSEIF dt-currdt EQ '09'.
         dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr .
          tot_2 = it_mver-gsv08.
          endif.
        ELSEIF dt-currdt EQ '10'.
          if it_mver-gjahr = dt-curryr1.
            tot_2 = it_mver-gsv09.
          endif.
        ELSEIF dt-currdt EQ '11'.
          dt-curryr1 = dt-curryr - 1.
         if it_mver-gjahr = dt-curryr1.
            tot_2 = it_mver-gsv10.
          endif.
        ELSEIF dt-currdt EQ '12'.
              dt-curryr1 = dt-curryr - 1.
          if it_mver-gjahr = dt-curryr1.
            tot_2 = it_mver-gsv11.
          endif.
        ENDIF.
    *****MODIFYING THE VARIABLE TOT_2.
        it_mbew-tot_2 = tot_2.
        MODIFY it_mbew TRANSPORTING tot_2.
    ENDLOOP.
    SELECT SINGLE RATE FROM ZPPTMB5L INTO W_COST
      WHERE BWKEY = IT_MBEW-BWKEY AND
            MATNR = IT_MBEW-MATNR.
        it_mbew-cur_rate = w_cost.
        MODIFY it_mbew.
        CLEAR: w_cost,marc-losgr,w_pos1,w_pfx1.
    ENDIF.
    it_mbew-w_value = it_mbew-cur_rate * it_mbew-tot_1.
      MODIFY it_mbew .
      it_mbew-w_value1 = it_mbew-cur_rate * it_mbew-tot_2.
      MODIFY it_mbew .
    --added by mohan on 20/08/2007--
      it_mbew-w_value2 = it_mbew-cur_rate * it_mbew-tot_3.
      MODIFY it_mbew .
      IT_MBEW-SALK1  = IT_MBEW-LBKUM * IT_MBEW-cur_rate.
      IT_MBEW-TOTUR  = IT_MBEW-LABST + IT_MBEW-EINME.
      IT_MBEW-SALK2  = IT_MBEW-TOTUR * IT_MBEW-cur_rate.
      MODIFY IT_MBEW.
       currdate = sy-datum.
      CALL FUNCTION 'CCM_GO_BACK_MONTHS'
        EXPORTING
          currdate   = currdate
          backmonths = '3'
        IMPORTING
          newdate    = newdate.
    curryr2 = currdate+0(4).
    curryr3 = newdate+0(4).
      SELECT matnr menge mblnr mjahr bwart werks erfmg erfme
                   INTO  CORRESPONDING FIELDS OF table it_mseg FROM mseg
                                        WHERE
                                            matnr in matnr
                                             matnr = it_mbew-matnr
                                             AND
                                             mjahr le curryr2 and
                                             mjahr ge curryr3
                                              AND
                                            bwart IN ('101','102') and
                                           mblnr = it_mkpf-mblnr.
    *change by 5-10-2007
                                            werks = it_mbew-BWKEY.
        SELECT mblnr budat mjahr INTO CORRESPONDING FIELDS OF TABLE
                     it_mkpf FROM mkpf  WHERE budat GE newdate
                                 AND
                              budat LE currdate
                              AND
                                             mjahr le curryr2 and
                                             mjahr ge curryr3.
      loop at it_mseg.
      loop at it_mkpf.
      IF it_mseg-bwart = '101' and it_mseg-mblnr = it_mkpf-mblnr.
          w_101menge = w_101menge + it_mseg-menge.
        ELSEIF it_mseg-bwart = '102' and  it_mseg-mblnr = it_mkpf-mblnr.
          w_102menge = w_102menge + it_mseg-menge.
    endif.
          it_mseg1-w_diffmenge = w_101menge - w_102menge.
      ENDLOOP.
    endloop.
      clear : w_102menge,w_101menge.
      it_mbew-erfmg = it_mseg1-w_diffmenge.
      it_mbew-erfme = it_mseg-erfme.
      MODIFY it_mbew TRANSPORTING erfmg erfme.
      IF it_mbew-tot_1 = 0.
      ELSE.
        it_mbew-w_days = it_mbew-lbkum / ( it_mbew-tot_1 / 90 ).
      ENDIF.
    it_mbew-w_days = w_days.
      MODIFY it_mbew TRANSPORTING w_days.
    ENDLOOP.
    clear  IT_MARD[].
    clear  IT_S032[].
    clear  IT_S032[].
    clear it_mard[].
    clear: it_mver,it_mver[].
    CLEAR : it_mseg1[], it_mseg1.
    clear : it_mkpf[], it_mkpf.
    clear  IT_MARD[].
    clear  IT_S032[].
    clear  IT_S032[].
    clear it_mard.
    clear : it_mseg[],it_mseg, it_mkpf[], it_mkpf.
    free : it_mseg[],it_mseg, it_mkpf[], it_mkpf.
      SORT it_mbew BY bwkey.
      LOOP AT it_mbew.
      IF p_summ = 'X'.
        MOVE it_mbew-bwkey TO it_mbew1-bwkey.
        it_mbew1-tot_1 = it_mbew-tot_1.
        it_mbew1-tot_2 = it_mbew-tot_2.
        it_mbew1-tot_3 = it_mbew-tot_3.
        it_mbew1-w_value  = it_mbew-w_value.
        it_mbew1-w_value1 = it_mbew-w_value1.
        it_mbew1-w_value2 = it_MBEW-W_VALUE2.
        COLLECT it_mbew1.
    elseif summary = 'X'.
        AT FIRST.
          w_pagectr = 1.
          PERFORM header.
        ENDAT.
        FORMAT COLOR 2 ON INTENSIFIED.
        WRITE : /01 sy-vline,
                     02 it_mbew-bwkey,                      10 sy-vline,
                     11 it_mbew-bklas,                      20 sy-vline,
                     21 IT_MBEW-EKGRP,                      27 SY-VLINE,
                     28 it_mbew-matnr+11(7),                39 sy-vline,
                     40 it_mbew-maktx,                      80 sy-vline,
                     81 it_mbew-cur_rate  CENTERED,         91 sy-vline,
                     92(13) it_mbew-lbkum right-justified,  105 sy-vline,
                    106 it_mbew-meins,                     111 sy-vline,
                    112 IT_MBEW-SALK1 left-justified,      126 SY-VLINE,
                    127(13) IT_MBEW-TOTUR right-justified,  141 SY-VLINE,
                    142 IT_MBEW-SALK2 left-justified,      156 SY-VLINE,
                   157(10) IT_MBEW-TOT_3 right-justified,  170 SY-VLINE,
                    171 IT_MBEW-W_VALUE2 left-justified,   184 SY-VLINE,
                   185(10) it_mbew-tot_1 right-justified,   198 sy-vline,
                    199 it_mbew-w_value left-justified,    212 sy-vline,
                    213 it_mbew-w_days CENTERED,           223 sy-vline,
                   224(10) it_mbew-tot_2 right-justified,      237 sy-vline,
                   238 it_mbew-w_value1 left-justified,        251 sy-vline.
        FORMAT COLOR 2 OFF INTENSIFIED.
    ENDLOOP.
      ULINE (251).
    elseif details = 'X'.
    LOOP AT it_mbew.
        AT FIRST.
          w_pagectr = 1.
          PERFORM header1.
        ENDAT.
        FORMAT COLOR 2 ON INTENSIFIED.
        WRITE : /01 sy-vline,
                     02 it_mbew-bwkey,                        10 sy-vline,
                     11 it_mbew-bklas,                        20 sy-vline,
                     21 IT_MBEW-EKGRP,                        27 SY-VLINE,
                     28 it_mbew-matnr+11(7),                  39 sy-vline,
                     40 it_mbew-maktx,                        80 sy-vline,
                  81(10) it_mbew-erfmg   right-justified,   93 sy-vline
                  94(10) it_mbew-erfme  right-justified,    104 sy-vline,
                    105 it_mbew-letztzug,                     117 sy-vline,
                    118 it_mbew-letztabg ,                     129 sy-vline,
                    130 it_mbew-letztver,                     141 sy-vline,
                    142 it_mbew-letztbew,                     153 sy-vline.
        FORMAT COLOR 2 OFF INTENSIFIED.
      ULINE /(153).
    ENDIF.
      ENDLOOP.
    LOOP AT it_mbew1.
        AT FIRST.
          w_pagectr = 1.
          PERFORM summary.
        ENDAT.
    ************************by ganesh
        it_mbew1-tot_31 = it_mbew1-tot_31 + it_mbew1-tot_3.
        it_mbew1-tot_21 = it_mbew1-tot_21 + it_mbew1-tot_2.
        it_mbew1-tot_11 = it_mbew1-tot_11 + it_mbew1-tot_1.
        it_mbew1-w_value01 = it_mbew1-w_value01 + it_mbew1-w_value.
        it_mbew1-w_value11 = it_mbew1-w_value11 + it_mbew1-w_value1.
        it_mbew1-w_value21 = it_mbew1-w_value21 + it_mbew1-w_value2.
        WRITE: /01 sy-vline,
                10 sy-vline,
                26 sy-vline,
                44 sy-vline,
                63 sy-vline,
                82 sy-vline,
                101 sy-vline,
                119 sy-vline.
        WRITE: 02 it_mbew1-bwkey  COLOR 4    , 10 sy-vline.
        WRITE: 01 sy-vline,
              11   it_mbew-tot_3    centered  color 7, 26 sy-vline,
                11   it_mbew1-tot_31    centered  color 7, 26 sy-vline,
              27 it_mbew1-tot_1    CENTERED COLOR 7,  44 sy-vline,
                27   it_mbew1-tot_11    CENTERED COLOR 7,  44 sy-vline,
              45 it_mbew1-tot_2    CENTERED COLOR 7, 63 sy-vline,
                45   it_mbew1-tot_21      CENTERED COLOR 7, 63 sy-vline,
               64 it_mbew1-w_value21  centered color 7, 82 sy-vline,
               83 it_mbew1-w_value01  CENTERED COLOR 7, 101 sy-vline ,
              102 it_mbew1-w_value11 CENTERED COLOR 7, 119 sy-vline.
      ENDLOOP.
      CLEAR : it_mbew1[] , it_mbew1.
      free : it_mbew1[] , it_mbew1.
    ULINE /(119).
    clear : it_mseg[],it_mseg, it_mkpf[], it_mkpf, IT_MBEW, IT_MBEW[].
    free: it_mseg[],it_mseg, it_mkpf[], it_mkpf, IT_MBEW, IT_MBEW[].
    *&      Form  header
          text
    -->  p1        text
    <--  p2        text
    FORM header .
      WRITE :  AT 110 'Page : ', w_pagectr COLOR 7.
      WRITE : /50 ' KANSAI NEROLAC PAINTS LIMITED' COLOR 7.
      WRITE : /50 '----
      WRITE : /50 'INTERMEDIATE INVENTORY REPORT' COLOR 7. " ADDED BY
      WRITE : /2  'DATE', sy-datum COLOR 6 INVERSE ON.   "AMRITANSHU
      FORMAT COLOR 7.
      ULINE /(251).
      FORMAT COLOR 4  ON INTENSIFIED.
      WRITE : /01 sy-vline,
               02 'FACTORY',                   10 sy-vline,
               11 'VALUATION',                 20 sy-vline,
               21 'PURCH',                     27 SY-VLINE,
               28 'MATERIAL',                  39 sy-vline,
               40 'MATERIAL DESCRIPTION',      80 sy-vline,
               81 'RATE',                      91 sy-vline,
               92 'TOTAL STOCK',              105 sy-vline,
              106  'UOM' ,                    111 SY-VLINE,
              112 'TOTAL VALUE',              126 sy-vline,
              127 'TOT UNRES & RES',          141 SY-VLINE,
              142 'TOT UNRES & RES' ,         156 SY-VLINE,
              157 'QUANTITY',                 170 sy-vline,
              171 'VALUE CONSUMP',            184 sy-vline,
              185 'QUANTITY',                 198 sy-vline,
              199 'VALUE CONSUMP',            212 sy-vline,
              213 'NO.OF DAYS',               223 sy-vline,
              224 'QUANTITY',                 237 sy-vline,
              238 'VALUE CONSUMP',            251 sy-vline.
      FORMAT COLOR 4 OFF INTENSIFIED.
      WRITE:  /01 sy-vline,
              10 sy-vline ,
              11 'CLASS'       COLOR 4,
              20 sy-vline,
              21 'GROUP' COLOR 4,
              27 sy-vline,
              39 sy-vline,
              80 sy-vline,
              91 SY-VLINE,
              105 SY-VLINE,
              111 SY-VLINE,
              112 '(INR)' COLOR 4,
              126 SY-VLINE,
              127 '  STOCK  ' COLOR 4,
              141 SY-VLINE,
              142 '(INR)' COLOR 4,
              156 SY-VLINE,
              157 'IN 6 MNTHS' COLOR 4,
              170 SY-VLINE,
              171 'IN 6 MNTHS' COLOR 4,
              184 SY-VLINE,
              185 'IN 3 MNTHS' COLOR 4,
              198 SY-VLINE,
              199 'IN 3 MNTHS' COLOR 4,
              212 SY-VLINE,
              213 '(INVENTORY)' COLOR 4,
              223 sy-vline,
              224 'IN 1 MNTHS' COLOR 4,
              237 SY-VLINE,
              238 'IN 1 MNTHS' COLOR 4,
              251 SY-VLINE.
      ULINE (251).
    ENDFORM.                    " header
    *&      Form  summary
          text
    FORM summary.
      WRITE :  AT 110 'Page : ', w_pagectr COLOR 7.
      WRITE : /50 ' KANSAI NEROLAC PAINTS LIMITED' COLOR 7.
      WRITE : /50 '----
      WRITE : /50 'INTERMEDIATE INVENTORY SUM REPORT' COLOR 7. " ADDED BY
      WRITE : /2  'DATE' , sy-datum COLOR 6 INVERSE ON.    "AMRITANSHU
      FORMAT COLOR 7.
      ULINE /(119).
      FORMAT COLOR 4  ON INTENSIFIED.
      WRITE : /01 sy-vline,
               02 'FACTORY' ,                   10 sy-vline,
               11 '  QUANTITY',                 26 sy-vline,
               27 '   QUANTITY'    ,            44 sy-vline,
               45 '   QUANTITY   ' ,             63 SY-VLINE,
               64 '  Value CONSUMP',             82 sy-vline,
               83 '  Value CONSUMP' ,            101 sy-vline,
               102 '  Value CONSUMP ',           119 sy-vline.
      FORMAT COLOR 4 OFF INTENSIFIED.
      WRITE:  /01 sy-vline,
               10 sy-vline,
               11 ' IN 6 MNTHS    ' COLOR 4,
               26 sy-vline,
               27 ' IN 3 MNTHS    ' COLOR 4,
               44 sy-vline,
               45 '  IN 1 MNTHS   ' COLOR 4,
               63 sy-vline,
               64 '   IN 6 MNTHS  ' COLOR 4,
               82 sy-vline,
               83 '   IN 3 MNTHS  ' COLOR 4,
               101 sy-vline,
               102 '   IN 1 MNTHS ' COLOR 4,
               119 sy-vline.
      ULINE /(119).
    ENDFORM.                    "summary
    *&      Form  header1
          text
    -->  p1        text
    <--  p2        text
    form header1 .
      WRITE :  AT 110 'Page : ', w_pagectr COLOR 7.
      WRITE : /50 ' KANSAI NEROLAC PAINTS LIMITED' COLOR 7.
      WRITE : /50 '----
      WRITE : /50 'INTERMEDIATE INVENTORY REPORT' COLOR 7. " ADDED BY
      WRITE : /2  'DATE', sy-datum COLOR 6 INVERSE ON.   "AMRITANSHU
      FORMAT COLOR 7.
      ULINE /(153).
      FORMAT COLOR 4  ON INTENSIFIED.
      WRITE : /01 sy-vline,

    HI
    and see these points which are very usefull for improve performance of a program
    Ways of Performance Tuning
    1.     Selection Criteria
    2.     Select Statements
    •     Select Queries
    •     SQL Interface
    •     Aggregate Functions
    •     For all Entries
    Select Over more than one Internal table
    Selection Criteria
    1.     Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement. 
    2.     Select with selection list.
    Points # 1/2
    SELECT * FROM SBOOK INTO SBOOK_WA.
      CHECK: SBOOK_WA-CARRID = 'LH' AND
             SBOOK_WA-CONNID = '0400'.
    ENDSELECT.
    The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
    SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
      WHERE SBOOK_WA-CARRID = 'LH' AND
                  SBOOK_WA-CONNID = '0400'.
    Select Statements   Select Queries
    1.     Avoid nested selects
    2.     Select all the records in a single shot using into table clause of select statement rather than to use Append statements.
    3.     When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.
    4.     For testing existence , use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit. 
    5.     Use Select Single if all primary key fields are supplied in the Where condition .
    Point # 1
    SELECT * FROM EKKO INTO EKKO_WA.
      SELECT * FROM EKAN INTO EKAN_WA
          WHERE EBELN = EKKO_WA-EBELN.
      ENDSELECT.
    ENDSELECT.
    The above code can be much more optimized by the code written below.
    SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
        FROM EKKO AS P INNER JOIN EKAN AS F
          ON PEBELN = FEBELN.
    Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops  only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
    Point # 2
    SELECT * FROM SBOOK INTO SBOOK_WA.
      CHECK: SBOOK_WA-CARRID = 'LH' AND
             SBOOK_WA-CONNID = '0400'.
    ENDSELECT.
    The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
    SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
      WHERE SBOOK_WA-CARRID = 'LH' AND
                  SBOOK_WA-CONNID = '0400'.
    Point # 3
    To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
    Point # 4
    SELECT * FROM SBOOK INTO SBOOK_WA
      UP TO 1 ROWS
      WHERE CARRID = 'LH'.
    ENDSELECT.
    The above code is more optimized as compared to the code mentioned below for testing existence of a record.
    SELECT * FROM SBOOK INTO SBOOK_WA
        WHERE CARRID = 'LH'.
      EXIT.
    ENDSELECT.
    Point # 5
    If all primary key fields are supplied in the Where condition you can even use Select Single.
    Select Single requires one communication with the database system, whereas Select-Endselect needs two.
    Select Statements           contd..  SQL Interface
    1.     Use column updates instead of single-row updates
    to update your database tables.
    2.     For all frequently used Select statements, try to use an index.
    3.     Using buffered tables improves the performance considerably.
    Point # 1
    SELECT * FROM SFLIGHT INTO SFLIGHT_WA.
      SFLIGHT_WA-SEATSOCC =
        SFLIGHT_WA-SEATSOCC - 1.
      UPDATE SFLIGHT FROM SFLIGHT_WA.
    ENDSELECT.
    The above mentioned code can be more optimized by using the following code
    UPDATE SFLIGHT
           SET SEATSOCC = SEATSOCC - 1.
    Point # 2
    SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
      WHERE CARRID = 'LH'
        AND CONNID = '0400'.
    ENDSELECT.
    The above mentioned code can be more optimized by using the following code
    SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
      WHERE MANDT IN ( SELECT MANDT FROM T000 )
        AND CARRID = 'LH'
        AND CONNID = '0400'.
    ENDSELECT.
    Point # 3
    Bypassing the buffer increases the network considerably
    SELECT SINGLE * FROM T100 INTO T100_WA
      BYPASSING BUFFER
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    The above mentioned code can be more optimized by using the following code
    SELECT SINGLE * FROM T100  INTO T100_WA
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    Select Statements       contd…           Aggregate Functions
    •     If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates yourself.
    Some of the Aggregate functions allowed in SAP are  MAX, MIN, AVG, SUM, COUNT, COUNT( * )
    Consider the following extract.
                Maxno = 0.
                Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.
                 Check zflight-fligh > maxno.
                 Maxno = zflight-fligh.
                Endselect.
    The  above mentioned code can be much more optimized by using the following code.
    Select max( fligh ) from zflight into maxno where airln = ‘LF’ and cntry = ‘IN’.
    Select Statements    contd…For All Entries
    •     The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
         The plus
    •     Large amount of data
    •     Mixing processing and reading of data
    •     Fast internal reprocessing of data
    •     Fast
         The Minus
    •     Difficult to program/understand
    •     Memory could be critical (use FREE or PACKAGE size)
    Points to be must considered FOR ALL ENTRIES
    •     Check that data is present in the driver table
    •     Sorting the driver table
    •     Removing duplicates from the driver table
    Consider the following piece of extract
    Loop at int_cntry.
           Select single * from zfligh into int_fligh
    where cntry = int_cntry-cntry.
    Append int_fligh.
    Endloop.
    The above mentioned can be more optimized by using the following code.
    Sort int_cntry by cntry.
    Delete adjacent duplicates from int_cntry.
    If NOT int_cntry[] is INITIAL.
                Select * from zfligh appending table int_fligh
                For all entries in int_cntry
                Where cntry = int_cntry-cntry.
    Endif.
    Select Statements    contd…  Select Over more than one Internal table
    1.     Its better to use a views instead of nested Select statements.
    2.     To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.
    3.     Instead of using nested Select loops it is often better to use subqueries.
    Point # 1
    SELECT * FROM DD01L INTO DD01L_WA
      WHERE DOMNAME LIKE 'CHAR%'
            AND AS4LOCAL = 'A'.
      SELECT SINGLE * FROM DD01T INTO DD01T_WA
        WHERE   DOMNAME    = DD01L_WA-DOMNAME
            AND AS4LOCAL   = 'A'
            AND AS4VERS    = DD01L_WA-AS4VERS
            AND DDLANGUAGE = SY-LANGU.
    ENDSELECT.
    The above code can be more optimized by extracting all the data from view DD01V_WA
    SELECT * FROM DD01V INTO  DD01V_WA
      WHERE DOMNAME LIKE 'CHAR%'
            AND DDLANGUAGE = SY-LANGU.
    ENDSELECT
    Point # 2
    SELECT * FROM EKKO INTO EKKO_WA.
      SELECT * FROM EKAN INTO EKAN_WA
          WHERE EBELN = EKKO_WA-EBELN.
      ENDSELECT.
    ENDSELECT.
    The above code can be much more optimized by the code written below.
    SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
        FROM EKKO AS P INNER JOIN EKAN AS F
          ON PEBELN = FEBELN.
    Point # 3
    SELECT * FROM SPFLI
      INTO TABLE T_SPFLI
      WHERE CITYFROM = 'FRANKFURT'
        AND CITYTO = 'NEW YORK'.
    SELECT * FROM SFLIGHT AS F
        INTO SFLIGHT_WA
        FOR ALL ENTRIES IN T_SPFLI
        WHERE SEATSOCC < F~SEATSMAX
          AND CARRID = T_SPFLI-CARRID
          AND CONNID = T_SPFLI-CONNID
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    The above mentioned code can be even more optimized by using subqueries instead of for all entries.
    SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
        WHERE SEATSOCC < F~SEATSMAX
          AND EXISTS ( SELECT * FROM SPFLI
                         WHERE CARRID = F~CARRID
                           AND CONNID = F~CONNID
                           AND CITYFROM = 'FRANKFURT'
                           AND CITYTO = 'NEW YORK' )
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    1.     Table operations should be done using explicit work areas rather than via header lines.
    2.     Always try to use binary search instead of linear search. But don’t forget to sort your internal table before that.
    3.     A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
    4.     A binary search using secondary index takes considerably less time.
    5.     LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
    6.     Modifying selected components using “ MODIFY itab …TRANSPORTING f1 f2.. “ accelerates the task of updating  a line of an internal table.
    Point # 2
    READ TABLE ITAB INTO WA WITH KEY K = 'X‘ BINARY SEARCH.
    IS MUCH FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY K = 'X'.
    If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
    Point # 3
    READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
    Point # 5
    LOOP AT ITAB INTO WA WHERE K = 'X'.
    ENDLOOP.
    The above code is much faster than using
    LOOP AT ITAB INTO WA.
      CHECK WA-K = 'X'.
    ENDLOOP.
    Point # 6
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
    The above code is more optimized as compared to
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1.
    7.     Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
    8.    If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
    9.    "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to “ LOOP-APPEND-ENDLOOP.”
    10.   “DELETE ADJACENT DUPLICATES“ accelerates the task of deleting duplicate entries considerably as compared to “ READ-LOOP-DELETE-ENDLOOP”.
    11.   "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to “  DO -DELETE-ENDDO”.
    Point # 7
    Modifying selected components only makes the program faster as compared to Modifying all lines completely.
    e.g,
    LOOP AT ITAB ASSIGNING <WA>.
      I = SY-TABIX MOD 2.
      IF I = 0.
        <WA>-FLAG = 'X'.
      ENDIF.
    ENDLOOP.
    The above code works faster as compared to
    LOOP AT ITAB INTO WA.
      I = SY-TABIX MOD 2.
      IF I = 0.
        WA-FLAG = 'X'.
        MODIFY ITAB FROM WA.
      ENDIF.
    ENDLOOP.
    Point # 8
    LOOP AT ITAB1 INTO WA1.
      READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
      IF SY-SUBRC = 0.
        ADD: WA1-VAL1 TO WA2-VAL1,
             WA1-VAL2 TO WA2-VAL2.
        MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
      ELSE.
        INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
      ENDIF.
    ENDLOOP.
    The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
    LOOP AT ITAB1 INTO WA.
      COLLECT WA INTO ITAB2.
    ENDLOOP.
    SORT ITAB2 BY K.
    COLLECT, however, uses a hash algorithm and is therefore independent
    of the number of entries (i.e. O(1)) .
    Point # 9
    APPEND LINES OF ITAB1 TO ITAB2.
    This is more optimized as compared to
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    Point # 10
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
    This is much more optimized as compared to
    READ TABLE ITAB INDEX 1 INTO PREV_LINE.
    LOOP AT ITAB FROM 2 INTO WA.
      IF WA = PREV_LINE.
        DELETE ITAB.
      ELSE.
        PREV_LINE = WA.
      ENDIF.
    ENDLOOP.
    Point # 11
    DELETE ITAB FROM 450 TO 550.
    This is much more optimized as compared to
    DO 101 TIMES.
      DELETE ITAB INDEX 450.
    ENDDO.
    12.   Copying internal tables by using “ITAB2[ ] = ITAB1[ ]” as compared to “LOOP-APPEND-ENDLOOP”.
    13.   Specify the sort key as restrictively as possible to run the program faster.
    Point # 12
    ITAB2[] = ITAB1[].
    This is much more optimized as compared to
    REFRESH ITAB2.
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    Point # 13
    “SORT ITAB BY K.” makes the program runs faster as compared to “SORT ITAB.”
    Internal Tables         contd…
    Hashed and Sorted tables
    1.     For single read access hashed tables are more optimized as compared to sorted tables.
    2.      For partial sequential access sorted tables are more optimized as compared to hashed tables
    Hashed And Sorted Tables
    Point # 1
    Consider the following example where HTAB is a hashed table and STAB is a sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    This runs faster for single read access as compared to the following same code for sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE STAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    Point # 2
    Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
    LOOP AT STAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.
    This runs faster as compared to
    LOOP AT HTAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.
    <b>Reward if usefull</b>

  • What are the possible LdapException.ErrorCode values when using System.DirectoryServices.Protocols?

    When making Ldap calls using the System.DirectoryServices.Protocols Namespace classes and a request generates an LdapException the ErrorCode property contains a numeric value describing the error. However, I cannot find any documentation describing what
    the possible error codes are and what they mean. Is this documented somewhere?
    Thank you.
    -Dave Herrmann

    That should be the error code returned by the ldap_* native functions:
    https://msdn.microsoft.com/en-us/library/aa367014(v=vs.85).aspx

  • Functional module for determining the sales tax code

    Dear all,
    Kindly help me is there any Functional module to determine the sales tax code?
    My Requirement is Based on the Country, Sales Org and Tax code Pricing should pick up automatically.
    I tried adding the same fields in the table and inserted in the access sequence and created the condition record for the same.
    Created the order but system is not able to get  the Tax code while determining the price?
    Please help ...
    Regards,
    SK

    My Requirement is Based on the Country, Sales Org and
         Tax code Pricing should pick up automatically
    but system is not able to get the Tax code while determining the price?
    Your both the above comments are contradict to each other. In the first statement, you say pricing should pick up automatically whereas, in the next statement, you say tax code is not determining.   Please indicate the requirement clearly.
    thanks
    G. Lakshmipathi

  • I lock my mac with find my iphone feature! now i forgot the 4 digits code

    hi
    I lock my mac with find my iphone feature! now i forgot the 4 digits code and i can't access to the computer.
    the fact is that someone stole my Mac about 1 and a half years ago! so the day after i realise my mac wasn't in the my house i immediately blocked by find my iphone with the hope to find but i didn't get nothing, then after 1 year i received a message telling my that my Mac was successfully blocked and my mac used to call "Kevin Gr. MacBook air" and the message i got from apple said that "Dou MacBook air" was successfully blocked. that time i realised who was the one who stole my Mac a "friend" :/ he was the only one that i know that uses that nickname for everything! well i didn't did much because i wasn't that sure that he stole it! but one day in a party in his house well not a party but all friends hanging out, they decided to go to the disco so i said that i was very tired and i managed to stay at his home, so when they left the house i decided to search for my thing, and after 30 min of searching i finally found all the things they stole :/ and my mac was there!   so I immediately took all my thing and left the house! i called him telling him that i found all my things and ill took them home! he was stunned for a moment and then he said sorry for everything, but all that things he was going to buy! but he knew it was our stolen stuffs and blah blah blah
    well now i wanted to open my computer and its locked with the 4 digits code that i put a year ago and i don't remember, there is a way to unlock it? or i just need to reinstall the OS!
    thank you and sorry for my english.

    You are not inputting the correct password. Please visit
    support.apple.com/kb/PH11117
    and learn how to reset your password. If you still cannot get in it's time to take it into your local Apple Store or AASP.

  • Error: Select a Location for the chosen compnay code

    Hello Guru's,
    We have an issue . Shopping caart at the time of approval (Business approval) we get the error message :" Select a Location for the chosen company code".
    We checked in PPOMA_BBP  for the approver (in extended attributes the relevant plant was not assigned. Hence had assigned the plant to the user attributes. But unable to approve. Still get the same error message.
    Also had checked the attributes of all the approvers of the shopping cart . They all are assigned to the relevant plant.
    Below are the questions i have :
    1) Is it possible to debug the shoipping cart which is in awaiting approval status.
    2) We checekd in SE91for the error message  and found the message but not able to see where it is used and no additional details.
    IS there any way to check this error andd fix
    Best Regards,
    Shree

    Hi Shree,
    Does this happen to all the locations?
    Have you ensured that the Plant chosen in the shopping cart belongs to the Company Code in the Shopping cart and that the Company Code is assigned to the user and the approver in PPOSA_BBP?
    Regards,
    Yateesh

  • How can I get the XSLT source code?

    How can I get the XSLT source code?

    Actually, I want to parse customer reviews for academic purpose.
    I'm trying to follow the links in the customer reviews zone.
    For example:
    In the following page
    http://www.amazon.com/gp/product/customer-reviews/B000LU8A7E/sr=1-1/qid=1180473311/ref=cm_cr_dp_all_helpful/102-2890495-8864146?ie=UTF8&n=1065836&qid=1180473311&sr=1-1#customerReviews
    in the "customer reviews" section, there is a link "next" that gets the next 10 reviews.
    The thing is that I don't know how to imitate its action using java and actually, I'm not sure if it is possible to do that using software.
    I tried to look at the source code that I got using the previous java code I posted and I see that the next link always has the following href attributes "http://www.amazon.com/gp/product/customer-reviews/B000LU8A7E"
    I tried to see if there is any javascript that tells the page which 10 reviews to get but with no success.
    So if anyone knows how to imitate the next link action using software that will sure help me a lot.
    Thanks in advance

Maybe you are looking for

  • ADS render error

    Hi, Our BC group reviewed every note on SDN regarding  ads rendering problems. I am trying to create an offline PDF form (ready for input - optional), but we are still not able to find a proper solution. ADS service trace (not whole... it is rather l

  • How to create a archive database?

    Emails which are older than 1yr should be archived into a separate database from the mail email database. Its a Exchange 2010 version. Please help me know the proceedure. Thank you

  • Can I split a cell in Numbers in Ipad?

    Can I split a cell in Numbers in Ipad?

  • Error Sun Java Aplication Server "SunAppServer8''

    Hello, I have a problem with the process server in the works SunAppServer8 and this being used as libraries, lib/ext/ msbase.jar mssqlserver.jar msutil.jar lib/ driveradapter.jar But when executed and the server " SunAppServer9 " accuses the followin

  • Didn't move apps at install - now they don't work

    On installation I chose not to move the applications. Couldn't then open them - InDesign is missing Cmaps/system fonts and others need serial numbers (can't find). Tried a re-install to choose the option of moving the apps but I didn't get given the