IDOC_INPUT_ORDRSP LOEKZ = 'L'

Hi all,
anybody know how can I delete a PO item using function IDOC_INPUT_ORDRSP (idoc type ORDERS05).
I set E1EDP01-ACTION = '003' AND E1EDP20-ACTION = '003',
I have implemented note no 66192 and 890812.
The result is that in the PO item confirmation when I set action = '003' I see that LABNR (Order Acknowledgement) i see the string "reject". But no LOEKZ  status and MRP changes.
Please help.
Marianna
PS: SAP _APPL 500

Check a couple of things. This error is an SQL error related to very complex select statements. But your dump says that is happened when tyring to LOAD. So there is something corrupted.
Go to SE38, enter the program name SAPLEINM and generate. Did you recently upgrade? Did you write any user exits in there?
I didn't find any notes with this error.

Similar Messages

  • Difference between EKKO-LOEKZ & EKPO-LOEKZ

    Dear Friends,
    May i know the use of following tables & fields
    EKKO-LOEKZ & EKPO-LOEKZ
    I have create a PO with 3 line item..
    And deleted one line item & passed the PO in EKPO table i m able to find deletion indicator(LOEKZ) for that line item...
    Then I have dleted all 3 line Items in that PO...then checked in EKPO-LOEKZ filed able find deletion indicator for those line items..
    But i am not finding any changes in EKKO-LOEKZ filed(header Level)..
    may i knw wat is the reason for that?How i can acheive that?
    Regds,
    Sankar D

    Sankar Dharmaraj wrote:
    Dear Friends,
    > May i know the use of following tables & fields
    > EKKO-LOEKZ & EKPO-LOEKZ
    >
    > I have create a PO with 3 line item..
    > And deleted one line item & passed the PO in EKPO table i m able to find deletion indicator(LOEKZ) for that line item...
    >
    > Then I have dleted all 3 line Items in that PO...then checked in EKPO-LOEKZ filed able find deletion indicator for those line items..
    > But i am not finding any changes in EKKO-LOEKZ filed(header Level)..
    > may i knw wat is the reason for that?How i can acheive that?
    >
    > Regds,
    > Sankar D
    Hi Sankar,
    EKKO has header data and since you have not marked PO as Archived the same is not updated. Where as EKPO has item data hence when you delete an Item the same gets updated in EKPO-LOEKZ field.
    Hope this helps!
    Reetesh

  • Problem with field LOEKZ

    Hi all,
    I have a select statements:
    SELECT SINGLE * FROM mapl WHERE matnr EQ marc-matnr AND
                                                loekz NE 'X' and
                                                werks EQ marc-werks AND
                                                plnty EQ 'N'.
                SELECT SINGLE * FROM plko WHERE plnty EQ mapl-plnty AND
                                                plnnr EQ mapl-plnnr AND
                                                loekz NE 'X' and
                                                plnal EQ mapl-plnal AND
                                                zaehl EQ mapl-zaehl.
    and ehen i run with debugger the field LOEKZ ne 'X' in where condition is disappearing.
    and that loekz is a nonkeyfield and remaining are key fields.
    Could you please help me regarding this issue
    regards
    Chandu

    Hi Sai,
       What Exactly do you mean by disappearing?
    Are you getting sy-subrc = 0(Success) or not?
    Can you be a bit more clear?
    Regards,
    Ravi

  • In user exit i wants to change EKPO-LOEKZ field

    Dear All,
    I want change the ekkpo-LOEKZ field at the time of saving.
    I'm using EXIT_SAPMM06E_012 Exit to do the changes but it s not geting update.
    Can any one Help me on this issues?.
    Thanks in Advance.
    Regards,

    Thanks for your quick reply Ravi.
    My requirement is I want block the line item(s) based on some conditions.
    Its possible to block the line item(s) at the time of saving
    Regards,

  • Enhancement for inbound idoc posting(idoc_input_ordrsp)

    hi,
    please find solution for the below.
    business senario: when the vendor send purchase order confirmation through idoc a automated acknowledgement has to be send.
    technical: when vendor send idoc (orders05) it updates with FM (idoc_input_ordrsp) our system.
    but in the idoc a segment E1EDP19 will have the field IDNLF which has to be filled to send a  acknowledgement .
    in my case:
    the user  some times will fill the segment so to get automated acknowledgement we have to write an enhacement to populate the segment in inbound  FM.
    i have written code in EXIT_SAPLEINM_007. and populated the data in internal table. but the changed data in internal table  is not reflecting in processed idoc(in we02 direction 2).

    idoc_data is the intenal table which hold all the segment data in run time.
    now i fetched matnr from ekpo table populated E1EDP19
    and modified the internal table by adding idoc_data-sdata when idoc_data-segnam is E1EDP19 .
    ultimately the sdata is reflecting in the idoc_data-sdata for the segment.
    but when we check in  we02  for the processed idoc the changes are reflecting.
    give me a solution for the data to reflect in processed idoc.

  • BAPI to update EKPO-LOEKZ

    Hello All,
    Is there a BAPI to update ekpo-loekz field.
    Thanks
    Aravind

    Hi Arvind
    Currenty you are passing only one line in the FM not internal table for the poitmes...
    Main thing is you have to pass internal table for line items inf BAPI BAPI_PO_CHANGE instead of work area or single line
    ** Fill purchase order from ekko
        l_purchaseorder = wa_ekko-ebeln. " Try to use EKKO-EBELN and change the logic accordingly..
    LOOP AT it_ekpo INTO wa_ekpo where ebeln = wa_ekko-ebeln. " B4 this write FOR ALL ENTRIES logic to fill EKPO
        CLEAR: l_purchaseorder,
               l_r_poheader,
               l_r_poheaderx.
        l_poitem-po_item = wa_ekpo-ebelp.
        l_poitem-delete_ind = C_X.
        APPEND l_poitem.
        l_poitemx-po_item = wa_ekpo-ebelp.
        l_poitemx-PO_ITEMX = C_X.
        l_poitemx-delete_ind = C_X.
        APPEND l_poitemx.
    ENDLOOP.
    CALL FUNCTION 'BAPI_PO_CHANGE'
             EXPORTING
                  purchaseorder = l_purchaseorder
             TABLES
                  return        = l_t_return
                  poitem        = l_poitem[] " Pass Internal Table instead of one row
                  poitemx       = l_poitemx[] . " Pass Internal Table instead of one row
        IF sy-subrc = 0.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                    wait = C_X
       ENDIF.
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • IDOC FM IDOC_INPUT_ORDRSP

    Hi,
    I'm creating idocs through FM IDOC_INPUT_ORDRSP.
    For some reason the FM is dumping. I'm on SAP 4.7. If I run the FM normally also it is dumping the same way. Could anyone tell me the reason, if they have encountered the same thing.
    The dump screen says
    SQL error 1105 occurred when accessing program "SAPLEINM " part "LOAD".
    Trigger Location of Runtime Error
        Program                                 SAPLEINM
        Include                                 ????????????????????????????????????????
    Is there any note to be installed to avoid this problem?
    Message was edited by: vijay srikanth

    Check a couple of things. This error is an SQL error related to very complex select statements. But your dump says that is happened when tyring to LOAD. So there is something corrupted.
    Go to SE38, enter the program name SAPLEINM and generate. Did you recently upgrade? Did you write any user exits in there?
    I didn't find any notes with this error.

  • Allow dialogue processing for IDOC_INPUT_ORDRSP

    We want to allow dialogue processing for the IDOC_INPUT_ORDRSP FM.  When an idoc is recieved and has errors we want to be able to process it using the dialogue screens to correct errors.  We do this now with IDOC_INPUT_ORDERS.  We have changed the entry in TBD51 that is supposed to denote dialogue processing.  It still does not allow the dialogue screens to come up when we process the idoc for the ORDRSP.  Does anyone know if there is another place we have to make a setting change to allow this or is there a problem with allowing dialogue processing for certain FMs?

    After looking into this further I have found that the TBD51 table should not have been changed.  There is actually no way using the standard inbound FM to allow dialogue processing for this particular one.  The logic does not exist in the program.  We are going to look into workflow to see if there are some business objects that will allow us to perform what we need to do.

  • Table EKKO-LOEKZ Delete Indicator can't be changed once set

    Hi Gurus:
    We ran Archive Object MM_EKKO Preprocessing Program RM06EV70.  This set the deletion indicator EKKO-LOEKZ to an 'L' on 2008 Purchase Orders.  It was discovered that around 100 really can't be archived.   On this Forum we were told that SAP Tcode MEMASSPO can change LOEKZ back to blank.  Our SCM Team tried that but we get  error messages that the PO can't be changed and  that Purchasing document 6200000617 already archived.  
    Does anyone know what we are doing wrong or another way to set LOEKZ back to blank?
    Thank you
    Dennis

    Hi Jurgen:
    I use Tcode MEMASSPO.
    I select fields on Purchase Order Header.  I select the deletion indicator MASSEKKO-LOEKZ on the list.
    I enter a PO Number with an 'L' in the LOEKZ field from the preprocessor.
    I change the new value field to  blank on the PO Header.  I hit the mass change button.   The 'L' is changed to a  blank. 
    I hit the save icon.   I get all of the following errors.
    6200000617 : Instance 6200000617 of object type PurchaseOrder could not be changed
    6200000617 : Instance 6200000617 of object type PurchaseOrder could not be changed
    6200000617 : Purchasing document 6200000617 already archived.
    If we do this for a PO that was not set to a 'L' by the preproessor program.  We can change it to using MEMASSPO to 'L' (SAP Changes it to 'C' and we can blank it out again. 
    I don't think there is anyway to get MEMASSPO to change the PO.  Any ideas?

  • 2LIS_02_ITM, LOEKZ AND ROCANCEL

    Hi SDN,
    We have some Purchase Orders for which LOEKZ = 'L' but they still exist in BI DSO because ROCANCEL with 'R' have not come in yet.
    Are ROCANCEL and LOEKZ linked in a way that 'L' in LOEKZ translates to 'R" in ROCANCEL or SAP considers other things before marking 'ROCANCEL' = 'R' for reversal?
    Should we assume that whenever EKPO-LOEKZ = 'L', the record in the DSO should be dropped after the next load? And if not, what is the relationship and what can we expect?
    We have mapped ROCANCEL to both RECORDMODE as well as STOR_NO.
    Please advise.
    Thanks.
    SM.

    Hi
    There as 2 possibilities
    1.
    PO item is deleted and there is no statistical relevance ( i.e. no GR / IR created against that po item), in that case LIS logic is intelligent enough and simply sets recormode = D and that po item gets deleted from BW. in that case loekz is extracted as blank . you can check in rsa3
    2. po item is deleted but it still has statistical relevance aginst it. then LIS logic does not delete such items from bw and sends loekz ='L' in extraction. however if you still want that such PO items shud be deleted from BW,, then you can write routine to below effect 
    loop at datapack
    if datapak-loekz = 'L'
    datapak- recordmodel = 'D'
    modify datapak
    endif
    endloop
    i dont remember sap note.. i will post later once can find it
    regards
    sanjyot

  • ROCANCEL field in R3 extraction program can't catch the LOEKZ (deletion ind

    Why the ROCANCEL field in R3 extraction program can't catch the LOEKZ (deletion indicator) value in EKPO for some item (not all item) deletions in a purchasing doc?
    We deleted some purchasing document items on R3, e.g.,
    doc 1
    item 1 deleted
    item 2
    item 3
    item 4 deleted
    item 5
    doc 2
    item 1 deleted
    item 2 deleted
    Run RSA3 on the datasource 2LIS_02_ITM, find the extraction program field ROCANCEL(Indicator: Cancel Data Record) for doc1 are all null for each doc1 item that this field ROCANCEL fails to catch EKPO deletion indicator field LOEKZ value for these two deleted item 1 and item 4 showed in table EKPO with value of 'L' for item 1 and item 4. 
    However this extraction program field ROCANCEL does catches the correct values for doc2 though. Sounds like if all the doc items get deleted then ROCANCEL shows correct value 'R', if only deleting some items of a doc, then ROCANCEL doesn't indicate the deletion!
    Any idea? We have searched OSS Notes, but find something which are only for BW other than for R3. The problem starts at R3 extraction program!
    Thanks
    Message was edited by: Kevin Smith

    hi AHP,
    There is sth wrong with the website that I can't see the Reply button next to your post.
    I check the System Status on our R3, it lists quite a few below:
    Software Comp. Release     Level
    SAP_BASIS      620         0051
    SAP_ABA        620         0051
    SAP_APPL       470         0024
    SAP_HR         470         0046
    EA-IPPE        110         0019
    PI             2003_1_470  0009
    PI_BASIS       2003_1_620  0007
    EA-APPL        110         0020
    BTW, I checked the OSS Note 886716, find the 4th tab called "Correction Instructions" contains the following lines below. Which line should we use in our system?
    Correction Instruction Valid from Valid to Installation Soft. Component ID
    Ref. Correction Modification Status Last Changed on    
    0000419802 600 600 0120031469 SAP_APPL 1
    P7DK006929   Released 07.10.2005   07:43:39     
    0000420067 500 500 0120031469 SAP_APPL 1
    P6DK060509   Released 09.10.2005   22:50:11     
    0000420068 470 470 0120031469 SAP_APPL 1
    P6BK206659   Released 09.10.2005   23:02:38     
    0000420253 46C 46C 0120031469 SAP_APPL 1
    P9CK458509   Released 10.10.2005   00:33:01     
    Download 
    Thanks
    Message was edited by: Kevin Smith
    hi AHP,
    I run se38 to check the form XMCEKPO_ERGAENZEN_LIS_NEW, but find it doesn't exist at all in our R3 system!
    Thanks

  • Using EKES-LOEKZ field to mean supplier acknowledgement status pending

    Hi colleagues:
    The Vendor confirmation deletion indicator (EKES-LOEKZ) field is supposed to contain "X" to indicate such confirmation has been deleted, otherwise it contains null (Blank).
    However, I need to fill in this field "S" or "B" character to represent such Confirmation is dependent upon Supplier or Buyer action.
    I need very much to figure out if such usage will affect any functionality into SAP R/3 system.
    As I am in a hurry to solve that, it would be wonderful if someone could help me as soon as possible.
    Thanks
    Waldemar Gonsales

    Thanks very much Mr Jurgen:
    So, I have decided to append a one char Z field to the EKES table, specifically to hold the Confirmation dependent action, then the  "S" or "B".
    Could you please consider also this possibility ?
    Thanks very much so far.
    Walgemar Gonsales

  • Qualifiers for IDOC_INPUT_ORDRSP

    Hi,
    where will we  see all values of qualifier for IDOC_INPUT_ORDRSP

    Hi,
    Look at this link:
    http://www.erpgenie.com/faq/edi_purchasing.htm
    Pl reward points.
    Regards,
    Ameet

  • Idoc_input_ordrsp help

    I have run into a scenario where the quantity in the IDOC is less than the quantity on the PO.  The IDOC fails becuase there is a quantity variance.  Does anyone know if I can get the IDOC to process so the confirmatins tab of the PO has the value that is on the IDOC?

    Check a couple of things. This error is an SQL error related to very complex select statements. But your dump says that is happened when tyring to LOAD. So there is something corrupted.
    Go to SE38, enter the program name SAPLEINM and generate. Did you recently upgrade? Did you write any user exits in there?
    I didn't find any notes with this error.

  • Custom purchase requsitionto vendor open and cleared payment report

    dear all i develop report but i cant ableto show in that open amount and cleared amount of vender in that report so please see this report and feedback me for logic to show open and clear amount of vendor purchase orderwise or vendorwise
    report zpo_purchase_history no standard page heading message-id 00.
    TABLES : bsik, bsak, lfa1, lfb1, skb1, t001, bapifvdexp_vzzbepp.
    type-pools:slis,ICON.
    types :begin of ty_po,
            banfn type eban-banfn,
            "Purchase Requisition Number
            bnfpo type eban-bnfpo,
            "Item Number of Purchase Requisition
            ekgrp type eban-ekgrp,                 "Purchasing Group
            badat type eban-badat,
            "Requisition (Request) Date
            menge type eban-menge,
            KNTTP TYPE EBAN-KNTTP,
             PSTYP type eban-PSTYP,
            "Purchase Requisition Quantity
            meins type eban-meins,
            "Purchase Requisition Unit of Measure
            lifnr type ekko-lifnr,                 "Vendor Account Number
            bedat type ekko-bedat,                 "Purchasing Document Date
            ebeln type ekpo-ebeln,
            "Purchasing Document Number
            ebelp type ekpo-ebelp,
            "Item Number of Purchasing Document
            matkl type ekpo-matkl,                 "Material Group
            mtart type ekpo-mtart,                 "Material Type
            matnr type ekpo-matnr,                 "Material Number
            txz01 type ekpo-txz01,                 "Short Text
            menge1 type ekpo-menge,                "Purchase Order Quantity
            meins1 type ekpo-meins,
            "Purchase Order Unit of Measure
            balqty type ekpo-menge,                "Balance Quantity
            netpr type ekpo-netpr,
            "Net Price in Purchasing Document
            peinh type ekpo-peinh,                 "Price Unit
            mblnr type mseg-mblnr,
            "Number of Material Document
            zeile type mseg-zeile,                 "Item in Material Document
            menge2 type mseg-menge,                "GR Quantity
            meins2 type mseg-meins,                "GR Unit of Measure
            werks type mseg-werks,                 "Plant
            charg type mseg-charg,                 "Batch
            belnr type rbkp-belnr,
            "Document Number of an Invoice Document
            bldat type ekbe-bldat,                 "Document Date in Document
            belnr_b type rbkp-belnr,
            SHKZG type ekbe-SHKZG ,                "Debit/Credit Indicator
            DMBTR type   bsik-dmbtr,                "Amount in Local Currency
            DMBTR_C type   bsAk-dmbtr,                "Amount in Local Currency
            thick(10) type c,                      "Thickness
            width(10) type c,                      "Width
            length(10) type c,                     "Length
            grade(10) type c,                        "Grade
            BELNR_d type bseg-belnr,
            xblnr type bkpf-xblnr,
            awkey  type bkpf-awkey,
            RMWWR type rbkp-RMWWR,
            WMWST1 type rbkp-WMWST1,
            end of ty_po.
    types :begin of ty_ekko,
            ebeln type ekko-ebeln,
            lifnr type ekko-lifnr,
            bedat type ekko-bedat,
            end of ty_ekko.
    types:begin of ty_ekpo,
            ebeln type ekpo-ebeln,
            ebelp type ekpo-ebelp,
            matnr type ekpo-matnr,
            txz01 type ekpo-txz01,
            menge type ekpo-menge,
            meins type ekpo-meins,
            netpr type ekpo-netpr,
            peinh type ekpo-peinh,
            banfn type ekpo-banfn,
            bnfpo type ekpo-bnfpo,
            mtart type ekpo-mtart,
            end of ty_ekpo.
    types :begin of ty_eban,
            banfn type eban-banfn,
            bnfpo type eban-bnfpo,
            matnr type eban-matnr,
            menge type eban-menge,
            meins type eban-meins,
            end of ty_eban.
    types : begin of ty_ekbe,
             ebeln type ekbe-ebeln,
             ebelp type ekbe-ebelp,
             belnr type ekbe-belnr,
             bldat type ekbe-bldat,
             gjahr type ekbe-gjahr,
             buzei type ekbe-buzei,
             matnr type ekbe-matnr,
             DMBTR type ekbe-dmbtr,
             shkzg type ekbe-shkzg,
             end of ty_ekbe.
    types : begin of ty_mseg,
             mblnr type mseg-mblnr,
             mjahr type mseg-mjahr,
             zeile type mseg-zeile,
             menge type mseg-menge,
             meins type mseg-meins,
             ebeln type mseg-ebeln,
             ebelp type mseg-ebelp,
             matnr type mseg-matnr,
             werks type mseg-werks,
             charg type mseg-charg,
             end of ty_mseg.
    types : begin of ty_rbkp,
             belnr type rbkp-belnr,
             gjahr type rbkp-gjahr,
             bldat type rbkp-bldat,
             lifnr type rbkp-lifnr,
             ZUONR type rbkp-ZUONR,
             RMWWR type rbkp-RMWWR,
             WMWST1 type rbkp-WMWST1,
             end of ty_rbkp.
    types : begin of ty_bseg,
             bukrs type bseg-bukrs,
             belnr type bseg-belnr,
             gjahr type bseg-gjahr,
             buzei type bseg-buzei,
             valut type bseg-valut,
             wrbtr type bseg-wrbtr ,
             augbl type bseg-augbl,
             matnr type bseg-matnr,
             lifnr type bseg-lifnr,
             ebeln type bseg-ebeln,
             end of ty_bseg.
    types : begin of ty_rseg,
             belnr type rseg-belnr,
             gjahr type rseg-gjahr,
             ebeln type rseg-ebeln,
             ebelp type rseg-ebelp,
             matnr type rseg-matnr,
             bukrs type rseg-bukrs,
             end of ty_rseg.
    types : begin of ty_bsik,
             belnr type bsik-belnr,
              buzei type bsik-buzei,
             DMBTR type bsik-DMBTR,
             budat type bsik-budat,
             shkzg type bsik-shkzg,
             ebeln type bsik-ebeln,
             lifnr type bsik-lifnr,
             end of ty_bsik.
    types : begin of ty_bsak,
             belnr type bsak-belnr,
       lifnr type bsak-lifnr,
        ebeln type bsak-ebeln,
             DMBTR_C type bsak-DMBTR,
    ZUONR type bsak-ZUONR,
             end of ty_bsak.
    types: begin of ty_bkpf,
             BELNR type bkpf-belnr,
             xblnr type bkpf-xblnr,
             awkey  type bkpf-awkey,
           end of ty_bkpf.
    data: it_po type standard table of ty_po,
           it_ekko type standard table of ty_ekko,
           it_ekpo type standard table of ty_ekpo,
           it_eban type standard table of ty_eban,
           it_ekbe type standard table of ty_ekbe,
           it_mseg type standard table of ty_mseg,
           it_rbkp type standard table of ty_rbkp,
           it_rseg type standard table of ty_rseg,
           it_bseg type standard table of ty_bseg,
           it_bsik type STANDARD TABLE OF ty_bsik with header line,
           it_bsak type STANDARD TABLE OF ty_bsak,
           it_bkpf type standard table of ty_bkpf,
           wa_po type ty_po,
           wa_ekko type ty_ekko,
           wa_ekpo type ty_ekpo,
           wa_eban type ty_eban,
           wa_mseg type ty_mseg,
           wa_rbkp type ty_rbkp,
           wa_rseg type ty_rseg,
           wa_bseg type ty_bseg,
           wa_ekbe type ty_ekbe,
           wa_bsik type ty_bsik,
           wa_bsak type ty_bsak,
           wa_bkpf type ty_bkpf.
    data: it_fcat type slis_t_fieldcat_alv,
           it_lshead type slis_t_listheader,
           it_sort type slis_t_sortinfo_alv,
           wa_fcat type slis_fieldcat_alv,
           wa_lshead type slis_listheader,
           wa_layout type slis_layout_alv,
           wa_sort type slis_sortinfo_alv.
    data :it_cl_data like table of clobjdat,
           wa_cl_data like clobjdat.
    data: values(10) type n.
    data: value1(4) type N.
    data: c_matkl type ekpo-matkl,
           c_matnr type ekpo-matnr,
           c_ekgrp type eban-ekgrp,
           c_badat type eban-badat,
           c_index type sy-tabix,
           c_grmenge type mseg-erfmg,
           c_low(10) type c,
           c_high(10) type c,
           c_date type string,
           c_bukrs type ekko-bukrs,
           c_WERKS type eban-WERKS.
    data: gd_date(10).
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
           WA_EVENT TYPE SLIS_ALV_EVENT.
    *********Selection screen variables*********
    selection-screen:begin of block b1 with frame title text-001.
    select-options: s_bukrs for c_bukrs DEFAULT  'bmp1',
                     s_WERKS for c_WERKS,
                     s_matnr for c_matnr DEFAULT 'rm-01',
                     s_matkl for c_matkl ,
                     s_badat for c_badat ,"obligatory,
                     s_ekgrp for c_ekgrp.
    parameters: ch_bal as checkbox.
    selection-screen:end of block b1.
    *initialization.
    * PERFORM EVENT_CALL.
    *  PERFORM POPULATE_EVENT.
    start-of-selection.
         PERFORM EVENT_CALL.
       PERFORM POPULATE_EVENT.
       perform getdata.
       perform setdata.
       perform fieldcat.
       perform display.
    *&      Form  GETDATA
    form getdata .
       select a~BANFN
              a~bnfpo
              a~ekgrp
              a~badat
              a~KNTTP
              a~PSTYP
              b~ebeln
              b~ebelp
              b~matkl
              b~matnr
              b~bukrs
              into corresponding fields of table it_po
              from eban as a inner join ekpo as b
              on a~banfn = b~banfn and
                 a~bnfpo = b~bnfpo AND
                 A~KNTTP = B~KNTTP and
                 a~PSTYP = b~PSTYP
              where  a~badat in s_badat and
                     a~ekgrp in s_ekgrp and
                     a~WERKS in s_WERKS and
                     b~matnr in s_matnr and
                     b~matkl in s_matkl and
                     b~bukrs in s_bukrs and
                     b~loekz <> 'L' and
                     a~loekz <> 'X'.
       if it_po[] is not initial.
         select ebeln
                ebelp
                matnr
                txz01
                menge
                meins
                netpr
                peinh
                banfn
                bnfpo
                mtart
                from ekpo into table it_ekpo
                for all entries in it_po
                where ebeln = it_po-ebeln and
                      ebelp = it_po-ebelp and
                      loekz <> 'L'.
         select banfn
                bnfpo
                matnr
                menge
                meins
                from eban into table it_eban
                for all entries in it_po
                where banfn = it_po-banfn and
                      bnfpo = it_po-bnfpo and
                      loekz <> 'X'.
         if it_ekpo[] is not initial.
           select ebeln
                  lifnr
                  bedat
                  from ekko into table it_ekko
                  for all entries in it_ekpo
                  where ebeln = it_ekpo-ebeln.
           select ebeln
                  ebelp
                  belnr
                  bldat
                  gjahr
                  buzei
                  matnr
                  DMBTR
                  shkzg
                  from ekbe into table it_ekbe
                  for all entries in it_ekpo
                  where ebeln = it_ekpo-ebeln and
                        ebelp = it_ekpo-ebelp .
    *if it_ekbe-shkzg = 'H'.
    **ekbe-dmbtr = ekbe-dmbtr * -1.
    **ekbe-menge = ekbe-menge * -1.
    *endif.
    * select belnr
    *             gjahr
    *             ebeln
    *             ebelp
    *     from bseg into table it_bseg
    *             for all entries in it_ekpo
    *             where ebeln = it_ekpo-ebeln and
    *                   ebelp = it_ekpo-ebelp.
           select belnr
                  gjahr
                  ebeln
                  ebelp
                  matnr
                  bukrs
                  from rseg into table it_rseg
                  for all entries in it_ekpo
                  where ebeln = it_ekpo-ebeln and
                        ebelp = it_ekpo-ebelp.
         endif.
         if it_ekbe[] is not initial.
           select mblnr
                  mjahr
                  zeile
                  menge
                  meins
                  ebeln
                  ebelp
                  matnr
                  werks
                  charg
                  from mseg into table it_mseg
                  for all entries in it_ekbe
                  where mblnr = it_ekbe-belnr and
                        mjahr = it_ekbe-gjahr and
                        zeile = it_ekbe-buzei and
                        bwart = '101'.
         endif.
         if it_rseg[] is not initial.
           select belnr
                  gjahr
                  bldat
                  lifnr
                  ZUONR
                  RMWWR
                  WMWST1
                  from rbkp into table it_rbkp
                  for all entries in it_rseg
                  where belnr = it_rseg-belnr.
         endif.
    *if it_rseg[] is not initial.
    *      SELECT bukrs
    *              belnr
    *              gjahr
    *              buzei
    *              valut
    *              wrbtr
    *              augbl
    *              matnr
    *              lifnr
    *              ebeln
    *        INTO TABLE it_bseg
    *          FROM bseg
    *          FOR ALL ENTRIES IN it_rseg
    *          WHERE bukrs = it_rseg-bukrs and ebeln = it_rseg-ebeln and mwskz = ''.
    *endif.
    *loop at it_BKPF into wa_BKPF.
    *  values = wa_rbkp-belnr.
    *  value1 = wa_rbkp-gjahr.
       data: aekey_1 type string .
    *CONCATENATE values value1 into aekey_1.
    *  if it_BSEG[] is not initial.
    *MESSAGE aekey_1 type 'I'.
           SELECT single belnr xblnr awkey into wa_bkpf
             from bkpf
             where awkey = aekey_1.
    SELECT SINGLe belnr
    buzei
    dmbtr
    budat
       shkzg
       ebeln
       lifnr
       FROM bsik
    INTO CORRESPONDING FIELDS OF  wa_bsik
    *FOR ALL ENTRIES IN it_bseg
    WHERE
        bukrs in s_bukrs and
        lifnr = wa_rbkp-lifnr
    and
    *AND gjahr = it_bseg-gjahr
    * AND
        belnr = wa_bkpf-belnr.
    insert wa_bsik into table it_bsik.
    CLEAR wa_bsik.
    CLEAR it_bsik.
    *endloop.
    * and ebeln = it_bseg-ebeln .
    *    select BELNR
    **           SHKZG
    **           DMBTR
    *           from bkpf into table it_bkpf
    *            for ALL ENTRIES IN it_rbkp
    *            where belnr = it_rbkp-belnr.
    *        ENDif.
    IF IT_bseg[] IS NOT INITIAL.
           select belnr
             LIFNR
             ebeln
                  DMBTR
              ZUONR
                  from bsik into table it_bsik
                  for all entries in it_bseg
                  where belnr = it_bseg-belnr.
           select belnr
             LIFNR
             ebeln
                  DMBTR
              ZUONR
                  from bsak into table it_bsak
                  for all entries in it_bseg
                  where belnr = it_bseg-belnr.
    ENDIF.
       else.
         message s002.
         leave list-processing.
       endif.
    endform.                    " GETDATA
    *&      Form  SETDATA
    form setdata .
       clear wa_po.
       loop at it_po into wa_po.
         c_index = sy-tabix.
    ********Calculate PR Quantity**********
         clear wa_eban.
         read table it_eban into wa_eban
                    with key banfn = wa_po-banfn
                             bnfpo = wa_po-bnfpo.
         if sy-subrc eq 0.
           move:wa_eban-menge to wa_po-menge,
                wa_eban-meins to wa_po-meins.
         endif.
    ********Calculate PO Quantity**********
         clear wa_ekpo.
         read table it_ekpo into wa_ekpo
                    with key banfn = wa_po-banfn
                             bnfpo = wa_po-bnfpo .
         if sy-subrc eq 0.
           move:wa_ekpo-txz01 to wa_po-txz01,
                wa_ekpo-netpr to wa_po-netpr,
                wa_ekpo-peinh to wa_po-peinh,
                wa_ekpo-mtart to wa_po-mtart,
                wa_ekpo-menge to wa_po-menge1,
                wa_ekpo-meins to wa_po-meins1.
         endif.
    ********Calculate Balance Quantity******
         clear wa_mseg.
         loop at it_mseg into wa_mseg
                where ebeln = wa_po-ebeln and
                      ebelp = wa_po-ebelp.
           c_grmenge = c_grmenge + wa_mseg-menge.
         endloop.
         move:wa_mseg-mblnr to wa_po-mblnr,
              c_grmenge to wa_po-menge2,
              wa_mseg-meins to wa_po-meins2,
              wa_mseg-werks to wa_po-werks,
              wa_mseg-charg to wa_po-charg.
         wa_po-balqty = wa_eban-menge - c_grmenge.
         clear : wa_rseg,wa_rbkp.
         read table it_rseg into wa_rseg with key
                        ebeln = wa_mseg-ebeln
                        ebelp = wa_mseg-ebelp.
         read table it_rbkp into wa_rbkp
                    with key belnr = wa_rseg-belnr
                             gjahr = wa_rseg-gjahr.
         if sy-subrc eq 0.
           move : wa_rbkp-belnr to wa_po-belnr,
                  wa_rbkp-bldat to wa_po-bldat,
                  wa_rbkp-RMWWR to wa_po-RMWWR,
                  WA_RBKP-WMWST1 TO WA_PO-WMWST1.
         endif.
           read table it_bseg into wa_bseg with key
                         ebeln = wa_rseg-ebeln
                         bukrs = wa_rseg-bukrs.
           if sy-subrc eq 0.
             move wa_bseg-belnr to wa_po-belnr_d.
           endif.
    *    read table it_bkpf into wa_bkpf
    *    with key belnr = wa_ekbe-belnr.
    *    read table it_bseg into wa_bseg
    *    with key belnr = wa_bkpf-belnr.
    CLEAR wa_bsik.
    clear it_bsik.
         read table it_bsik into wa_bsik
         with key belnr = wa_bkpf-belnr.
    *    if wa_bsik-shkzg = 'H'.
    *     wa_bsik-DMBTR = wa_bsik-DMBTR * 1.
    *     endif.
           if sy-subrc eq 0.
             move : wa_bsik-belnr to wa_po-belnr,
                     wa_bsik-DMBTR to wa_po-DMBTR.
            endif.
    *    clear wa_bsik.
    *    read table it_bsik into wa_bsik
    *               with key  belnr = wa_bseg-belnr.
    *    if sy-subrc eq 0.
    *        move : wa_bsik-DMBTR to wa_po-DMBTR.
    *    endif.
    *clear wa_bsak.
    *    read table it_bsak into wa_bsak
    *               with key  belnr = wa_bseg-belnr.
    *    if sy-subrc eq 0.
    *        move : wa_bsak-DMBTR_C to wa_po-DMBTR_C.
    *    endif.
    *clear : wa_rbkp.
    *loop at it_bsik into wa_bsik.
    *read table it_bsik into wa_bsik with key belnr = wa_rbkp-belnr.
    *if sy-subrc eq 0.
    *  move : wa_bsik-DMBTR to wa_po-DMBTR.
    *    endif.
    *endloop.
    *********Assign Vendor,PO Date*********
         clear wa_ekko.
         read table it_ekko into wa_ekko
                    with key ebeln = wa_po-ebeln.
         if sy-subrc eq 0.
           move:wa_ekko-lifnr to wa_po-lifnr,
                wa_ekko-bedat to wa_po-bedat.
         endif.
    *clear wa_ekko.
    *read table it_ekko into wa_ekko
    *with key lifnr = wa_po-lifnr.
    *if sy-subrc eq 0.
    *  move: wa_bsik-DMBTR to wa_po-DMBTR.
    *  endif.
    *    call function 'ZSD_BATCH_CLASSIFICATION_DATA'
    *      exporting
    **        ch_charg                   = wa_po-charg
    *        ch_matnr                   = wa_po-matnr
    *        ch_werks                   = wa_po-werks
    *      tables
    *        cl_data                    = it_cl_data
    **       I_SEL_CHARACTERISTIC       =
         loop at it_cl_data into wa_cl_data.
           if wa_cl_data-ausp1 ne '?'.
             if wa_cl_data-atnam eq 'THICKNESS'.
               move wa_cl_data-ausp1 to wa_po-thick.
             elseif wa_cl_data-atnam eq 'LENGTH'.
               move wa_cl_data-ausp1 to wa_po-length.
             elseif wa_cl_data-atnam eq 'WIDTH'.
               move wa_cl_data-ausp1 to wa_po-width.
             elseif wa_cl_data-atnam eq 'GRADE'.
               move wa_cl_data-ausp1 to wa_po-grade.
             endif.
           endif.
         endloop.
         modify it_po from wa_po index c_index.
         clear :c_grmenge,wa_po,wa_ekpo,wa_mseg,c_index.
       endloop.
    endform.                    " SETDATA
    *&      Form  FIELDCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form fieldcat .
       perform buildfields using '1' 'BANFN'  'IT_PO' 'PR Number' '' ''.
    *  perform buildfields using '2' 'BNFPO'  'IT_PO' 'PR Item Number' '' ''.
       perform  buildfields using '2' 'KNTTP' 'IT_PO' 'A/c Assignment Cat' '' ''.
       perform  buildfields using '2' 'PSTYP' 'IT_PO' 'Item Cat' '' ''.
       perform buildfields using '3' 'EKGRP'  'IT_PO' 'Purchase Group' '' ''.
       perform buildfields using '4' 'BADAT'  'IT_PO' 'Request Date' '' ''.
       perform buildfields using '5' 'MENGE'  'IT_PO' 'PR Quantity'  'X' ''.
       perform buildfields using '6' 'MEINS'  'IT_PO' 'PR Unit' '' ''.
       perform buildfields using '7' 'LIFNR'  'IT_PO' 'Vendor Number' '' ''.
       perform buildfields using '8' 'EBELN'  'IT_PO' 'Purchasing Doc No' '' ''  .
       perform buildfields using '9' 'BEDAT'  'IT_PO' 'PO Date' '' ''.
       perform buildfields using '10' 'MTART' 'IT_PO' 'Material Type' '' ''.
       perform buildfields using '11' 'MATKL' 'IT_PO' 'Material Group' '' ''.
       perform buildfields using '12' 'MATNR' 'IT_PO' 'Material Number' '' ''.
       perform buildfields using '13' 'TXZ01' 'IT_PO' 'Material Desc' '' ''.
       perform buildfields using '18' 'MENGE1' 'IT_PO' 'PO Quantity' 'X' ''.
       perform buildfields using '19' 'MEINS' 'IT_PO' 'PO Unit' '' ''.
       perform buildfields using '20' 'NETPR' 'IT_PO' 'Net Price' '' ''.
       perform buildfields using '21' 'PEINH' 'IT_PO' 'Price Unit' '' ''.
       perform buildfields using '22' 'MBLNR' 'IT_PO' 'GR Number' '' ''.
       perform buildfields using '23' 'MENGE2' 'IT_PO' 'GR Quantity' 'X' ''.
       perform buildfields using '24' 'MEINS2' 'IT_PO' 'GR Unit' '' ''.
       perform buildfields using '25' 'BELNR' 'IT_PO' 'Invoice doc. number' '' ''.
       perform buildfields using '26' 'BLDAT' 'IT_PO' 'Invoice Date' '' ''.
    *  perform buildfields using '26' 'BELNR_D' 'IT_POP' 'A/C Doc. No.' '' ''.
    *  perform buildfields using '26' 'AUGBL' 'IT_PO' 'Clearing Doc No.' '' ''.
       perform buildfields using '26' 'DMBTR' 'IT_PO' 'OPEN AMOUNT' '' ''.
      perform buildfields using '26' 'DMBTR' 'IT_PO' 'clear AMOUNT' '' ''.
    *  perform buildfields using '26' 'DMBTR_C' 'IT_PO' 'Clear balance' '' ''.
       if ch_bal = 'X'.
         perform buildfields using '27' 'BALQTY' 'IT_PO' 'Balance Quantity'
         'X' ''.
       endif.
       perform buildfields using '26' 'WMWST1' 'IT_PO' 'TOTAL TAX ADDED' 'X' ''.
       perform buildfields using '26' 'RMWWR' 'IT_PO' 'TOTAL AMOUNT IN INVOICE' 'X' ''.
    endform.                    " FIELDCAT
    *&      Form  BUILDFIELDS
    *       text
    *      -->P_0449   text
    *      -->P_0450   text
    *      -->P_0451   text
    *      -->P_0452   text
    form buildfields  using    value(p_col_pos) like sy-cucol
                                value(p_fldname) type slis_fieldname
                                value(p_tabname) type slis_tabname
                                value(p_reptext) like dd03p-reptext
                                value(p_do_sum) type char1
                                value(hotspot) type char1.
       wa_fcat-col_pos = p_col_pos.
       wa_fcat-fieldname = p_fldname.
       wa_fcat-tabname = p_tabname.
       wa_fcat-reptext_ddic = p_reptext.
       wa_fcat-do_sum = p_do_sum.
       wa_fcat-hotspot = hotspot.
       append wa_fcat to it_fcat.
       clear wa_fcat.
    endform.                    " BUILDFIELDS
    *&      Form  DISPLAY
    form display .
       clear wa_layout.
       wa_layout-zebra = 'X'.
       wa_layout-colwidth_optimize = 'X'.
    * wa_layout-box_fieldname     = 'SEL'.
    * wa_layout-edit = 'X'.
       perform build_sort using 'BANFN' '1' 'X'.
       call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          i_callback_program               = sy-cprog
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND '
          i_callback_top_of_page           = 'TOP_OF_PAGE'
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
        i_background_id                   = 'ALV_BACKGROUND'
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
          is_layout                        = wa_layout
          it_fieldcat                      = it_fcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
         it_sort                           = it_sort
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
        I_SAVE                            = 'A'
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
         tables
           t_outtab                          = it_po[]
      exceptions
        program_error                     = 1
        others                            = 2
       if sy-subrc <> 0.
         message id sy-msgid type sy-msgty number sy-msgno
                 with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       endif.
    endform.                    " DISPLAY
    *&      Form  top_of_page
    *       text
    form top_of_page.                                           "#EC *
    **********Create report header*********
       refresh it_lshead.
       clear wa_lshead.
    **********To display date in header*********
    *  write: s_badat-low to c_low dd/mm/yyyy,s_badat-high to c_high
    *  dd/mm/yyyy.
    *  if s_badat-high is initial.
    *    concatenate 'Dated on' c_low into c_date separated by space.
    *  else.
    *    concatenate 'Dated between' c_low 'and' c_high into c_date separated
    *    by space.
    *  endif.
       wa_lshead-typ = 'H'.
       wa_lshead-info = 'PR To Payment History'.
    *  'Pending Indents History -

    We had a requirement to retrieve "aging of receiveables" by customer. Basically, it goes thru each record and depending on the due date places the amounts in the following buckets (example). 0-30 day Overdue, 31-60 days Overdue, 61-90 days overdue, 30+ days overdue, 60+ days overdue) etc all the way to 6+ years overdue.
    There are also cooresponding buckets for coming due analysis. For example, what is: 0-30 days coming due, 31-60 days coming due, 30+ days coming due, etc...
    To do this, first I needed to be able be able to produce an open items statement at any given time in the past. Now, this seems impossible because of how the items go from open to cleared all the time. And an item that was open one month ago, may not be open anymore.
    What I did was first remove any selections on item status. Then compare the posting date with teh key date in the past, if the posting date is less than or equal to the key date, keep the record.
    Then compare the clearing date with the key date. First, keep all that are #. (This keeps all records still open from that posting date/key date)
    Then, add another check for all items that were cleared after the key date (GT Key Date). This gives you the open items on that date.
    Hope that makes sense. Let me know if you want clarification.
    /smw

Maybe you are looking for

  • Can't update iLife in the App Store

    I have purchased a MBA 13.3 inch with Lion. iLife was preinstalled, but not with the latest version, so I went the to the App Store. There I logged in with my Apple ID which is configured for iTunes / App Store and which I used to purchase my MBA. Th

  • Combining files into PDF

    I am trying to combine word and excel files into a pdf document but I keep on getting file errors and it wont produce a pdf, the software is acrobat xi pro

  • Bookmark Section - Can it be controlled Conditionally?

    When sectioning fields, occasionaly we have some fields that are blank.   This affects the bookmark section property and the navigation map. For example If we have 6 cost centres (6 field columns) and section each of them, not all are required to hav

  • Where are the

    Hi, In FCP X10.09 I could get into the project folder and found there het back-up and shared folder. And within the shared folder I found the .mov I had uploaded to Vimeo or Youtube. I was easy to put the .mov-file omn a USB-stick or something. You a

  • Error invoking ioracle in ins_rdbms.mk - help please

    I'm installing 9.2 Enterprise on a Gentoo Linux system (dual Pentium 2). At "Linking Oracle 9i Database 9.2.0.1.0" (82%, drat!), I get this error: Error in invoking target ioracle of makefile /opt/oracle/OraHome1/rdbms/lib/ins_rdbms.mk The last thing