Archived Invoices and outstanding checks

Hi experts:
We have starte archiving invoices (FI_DOCUMNT) on SAP.   We have discovered a few outstanding checks that are over 2 years old that belong to the archived invoices.  Does anyone know of a customization that would automatically prevent invoices with outstanding checks from being archived?
Thanks
Dennis

Hi Dennis
To archive invoices FI_DOCUMNT, you should also run MM_REBEL, financial accounting documents are created when billing documents are cleared, the residence times of life of document is necessary  in these objects
In the link you can find more information
http://help.sap.com/saphelp_470/helpdata/es/8d/3e517d462a11d189000000e8323d3a/frameset.htm
Regards.
Santiago

Similar Messages

  • A/R balance and outstanding checks per customer

    Hi Experts,
    Is there a way to query to get the information as to the A/R balance and the Outstanding checks of a customer? Columns would be document number, document date, Customer Name, A/R balance, Outstanding checks and Total. Parameters will be date start/end, Customer code from/end.
    Many thanks!
    Don

    Dear Mr Elicor,
    I am working on the query. At the best of my knowleadge the tables involved are the OINV, OCHH and ORCT.
    There are other tables that can be involved (e.g. RCT1), but I think that with the 3 tables above we can get all the data.
    select t0.docnum, t0.docdate, t0.cardcode, t0.doctotal, t1.checksum, t2.deposited, t2.checknum
    from oinv t0 inner join orct t1 on t0.docnum = t1.docnum
    join ochh t2 on t1.docentry = t2.rcptnum
    where t1.checksum <> 0 and t2.deposited <> 'c'
    The t2.deposited tells us if the check has been paied, so there is no open payment for it.
    Please, let me know if this query helps you.
    Regards,
    Marcella Rivi
    SAP Business One Forums Team

  • Rebate agreements: Turnover for archived invoices cannot be displayed

    We have implemented a check routine in archiving which prevents rebate relevant invoices from being archived before the rebate agreement is settled.
    As soon as the rebate agreement is settled invoices may be archived. That means that the turnover display (verfication level ,All documents') of a settled rebate agreement does not necessarily show all invoices (if some of them are already archived).
    As a possible solution for that problem an enhancement can be implemented (as fas as i have investigated the coding) where you can read additional data from archived invoices and add them to to the verification list.
    Does anyone has had experience with that problem respectively implemented a solution for that ?
    Thanks a lot for your help,
    Michael

    Hello Michael
    We faced a lot of issue with rebates because of the archiving frequency of invoices.If you check the verifiction level
    it should still diplay the invoices.
    Why do they want to view the sales volume for the settled rebate agreement?
    After exploring all the alternatives we decided to reduce the validity periods within the archiving period of invoices (for example
    we had 3 years validity period whereas the archiving program archives invoices past 2 years).This resolved
    a lot of issues for us especially the entries in VBOX were reduced which had sometimes resulted in tbale overflows.
    I do not know if this will solve your problem but any how wanted to share our experience.
    Thanks
    Vikas

  • How to take  printout  of archived invoices

    Hi GURUS,
    How to take the printout of the Archived invoices
    Regards

    Hello,
    Please check the following extract from Note 440033
    ad 2. Due to the design of Transaction VF07, certain information cannot
    be displayed:
    - Document flow
    - Outputs
    - Texts
    - Partner detail
    - Payment card data
    Possible workaround (for the future): use of optical archive.
    Documentation in R/3 Library under the path:
    Basis Components -> Basis Services / Communication Interfaces BC-SRV)
      -> SAP ArchiveLink (BC-SRV-ARL) -> SAP ArchiveLink - Scenarios in
    Applications (BC-SRV-ARL) -> SAP ArchiveLink - Archiving Scenarios (SD)
    When the documents (created by SMARTFORM or SAPSCRIPT) are printed to
    the printer you can also choose to create a copy to be sent to an
    archive content system ie optical jukebox via the Archivelink interface.
    This copy will be a PDF document identical to the printed version  which
    can be displayed later and printed if you like. To set this up you just
    need to define this in the message type for the output  (tx NACE) used
    in the application when printing invoice. You then need an Archivelink
    certified optical archive system and the associated configuration.
    Regards,
    Raghavendra

  • Accounts Reveivable-Applying Credit Memo to and Outstanding invoice

    I have a remote client that can't apply a credit memo to an outstanding invoice in AR. They are on 12.1.3. This seems simple enough. Am I missing something.
    Thanks
    Rob

    Hi Rob,
    can you check with your client ...
    1) Whether this is happening for this particular customer or for every other customer ..
    2) Whether this is happening for this particular Invoice and credit memo combination or for all invoice and credit memo combinations ....
    3) Has it been working fine previously, is this the first time they are encountering this issue ...?
    4) Also did they receive any error message, whenn trying to apply credit memo to the Invoice ....
    5) How was the credit memo created in the Receivables module, was it interfaced from any third party source ..?
    The above would help us narrow down to the cause of the issue .....
    References:
    Transaction Workbench Error: Credit Memos cannot be Applied to Invoices Having Customer Names Exceeding 50 Characters [ID 1374662.1]
    Regards,
    Ivruksha

  • Dunning phases and blockades not visible for archived invoices in FPL9

    Hi experts,
    I am not able to see the dunning phases and blockades for archived invoices when i am opening FPL9 with archive.
    My requirement is that it should be visible and donot so any error message.
    Can you please provide me with the solution ?
    Thanks and Regards.
    Ajit Krishna

    Hi
    When you Full reverse an Inv, it will not show in ES32 but can see ERDK table with original and reverse inv doc numbers. The new invoice will be genreated based on the restored Billing order for the same period.
    FPL9 -show current valid posted amount as due amount & posting reversed inv amount will be shown as _ve.
    Message was edited by: G Reddy

  • Invoice and Invoice amount in FI/CO When enter check number

    Hi  All,
       I have a requirement like this. We have custom t-code ZF04 ( FAST CASH ) to post payments to customer accounts. In this t-code, we have one field for Check#.  When they enter Check# number and click on 'SEARCH' icon i need to display list of invoices and amounts with in a check.
    I have no idea about tables,. Where to look? What tables do i need to look when enter check number, which returns invoice details.
    Please let me know ASAP....
    I appreciate your help!
    Thanks,
    Suneetha

    Hi,
    One question - Are you getting customer payment trrough <b>LOCKBOX</b>? If yes, then following are the tables
    Check tables <b>FEBKO</b> and <b>FEBEP.</b> The field is <b>FEBEP-CHECT</b> for check number. For this check number take <b>FEBEP-KUKEY</b>. With this KUKEY read table FEBRE. <b>FEBRE-VWEZW is the invoice number</b>.
    So, sequence is
    1. Put Check# --> FEBEP-CHECT  and get FEBEP-KUKEY
    2. Put FEBEP-KUKEY into --> FEBRE-KUKEY
    3. FEBRE-VWEZW is invoice no.
    If you are not using LOCKBOX, How are you getting customer payment? Let me know so i can give you exact answer.
    Regards,
    RS

  • Need to enter invoice and payment in the system after a manual check issued

    Client Need to enter invoice and payment in the system after a manual check is issued for some urgent transactions.
    Please suggest few ways to do this .

    Hi,
    If client can maintain a separate check book sequence for manual issue, we can configure a separate payment document with the same sequence and later record the invoice and generate payment ....
    Regards,
    Ivruksha

  • Check duplicate invoice and amount

    Hi All,
    Can anyone help me with this issue.
    In T.code FB60 (invoice input field), I want the system to check the duplicate invoice and amount (If invoice number and amount are same) and it should not allow the user to proceed further.
    Please help..
    Regards,
    Vinay

    Thank you...
    But this is not an automatic posting.  Using FB60 manual posting.  Also in the vendor master if we check the double invoice field it will give a warning and proceed further and allows user to post entries.
    But my concern is "If the amount and invoice number matches the system shouldn't allow user to proceed further"  hope i am clear now.....
    Regards,
    Vinay

  • Initial Bank Reconciliation Implementation - Outstanding checks

    During the very first bank reconciliation the begining balance that the system enters as the beginning balance is $0. But of course in reality we have checks that have been written, but the suppliers have not cashed them prior to "go live" (so the AP Invoices are closed in the legacy system and so there is not an invoice in SAP B1).
    How should these outstanding checks be entered / accounted for so that when the first bank reconciation is completed and the checks clear so that the balance will reconcile to the bank statement?
    SAP Business One 2007 A 8.00.230

    If you put your cheque number in the journal entry as Reference 1 it will appear in your bank reconciliation, this can be done at line or at header level, depending on how many cheques you post in each journal.
    It is usual practice when setting up a new system to create journal entries when setting up the opening balances - stock, debtors & creditors will all offset into an "Opening Balances" suspense account. When you post an entry to create the opening balance sheet, this account should become 0, as the balance sheet will always balance. These open items from your bank reconciliation are simply part of the opening balances.

  • Archiving invoice using smartform

    Hi All
    I am trying to archive invoices using smartform.
    In the program I am directly calling the smartform by passing the archiving parameters to the function module of smartform which is determined using CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'.
    I am passing the parameter to the  archive_index and  archive_parameters in CALL FUNCTION lf_fm_name.
    If from the same program I am calling driver program of sap script then the document is getting archived.
    Is there any problem with archiving using smartform.
    Please guide.

    Hello,
    Check this link
    http://sap.ittoolbox.com/groups/technical-functional/sap-abap/archiving-smartforms-in-sap-2653513

  • Issues while archiving Invoice documents

    Hi all,
    While archiving Invoice documents using MM_REBEL(using company code only), it was found that the write job is picking up certain open Invoices also. ie the subsequent Accounting document was not cleared/archived.
    My understanding was the system will check for retention periods and whether the subsequent documents are archived or not.
    I just wanted to know if there are any extra checks , which it looks for , as the criterion for archiveablility.
    Please let me know if anyone knows about this or if any of you have faced similar issues .
    Regards,
    Shail.

    hi,
    Dependencies
    The status of the document determines whether it can be archived:
    ·        Documents with the status Closed or Deleted can be archived.
    ·        Documents with the status Unchecked, Checked and Errors Found, or Checked and No Errors Found cannot be archived.
    Financial accounting documents generated when invoice documents are posted are not archived with the object MM_REBEL. They are archived in Financial Accounting.
    Residence Time/Retention Period of Data in the System
    The retention period for invoice documents can be configured in the Customizing system. The posting date contained in the invoice document header is the key date for the retention period.
    If a retention period has not been set in Customizing, the system takes the minimum retention period as 9999 days.
    Presettings
    In Customizing for Invoice Verification you can set the retention period for invoice documents per company code under Define Document Lives.
    Hope it helps..
    Regards
    Priyanka.P

  • Invoice and delivery notes - idocs..

    Hello SD experts,
    I am new to SD.
    Can any one tell me what is the invoice. I mean
    what are the table AND transaction codes I have to go and check ?
    What are delivery notes ?
    My functional consultant is telling that
    there is a consolidated invoice and there are 2 delivery notes that are being combined for this invoice. The invoice # is 6016186004
    For DN#   6073107044 there is a VICS BOL that was passed back that is = 04000000000016146 
                   6073107045 there is a VICS BOL that was passed back that is = 04000000000016023
    and he wants to know how the program selects which VICS BOL fields in IDOC.  He gave me to use IDOC #77122253 in quality system for testing.
    In this case , Idoc checking/testing...I need to go to RSNAST00 program ?
    If so then what are the I need to give
    Output application    (is it V1 or MR ?)       
    Output type    ??

    hi ..
    Please refer below..
    for invoice ,  tables: VBRK and VBRP
    AND transaction codes : VF01 to 03.
    What are delivery notes ?
    after goods issue, we need to issues delivery note to customer.
    In this case , Idoc checking/testing...I need to go to RSNAST00 program ?
    you need to go to VL70 or you can process with RSNAST00.
    Output application type : V2
    Output type : LD00
    Regards
    Venkat.. Ananth Technologies

  • Excise invoice and domestic invoice sharing same number range

    Hi,gurus,my question is addresed to the sap cin gurus
    Scenario:-- Normally sap has provided provisions that the domestic invoice and the excise for the export will have different number range object
    Transaction-snum or snro(As per the rule the no range has to be approved by excise authorities)
    Requirement:--The present requirement of the client is that as per their requirement they will be using the same excise number range both for domestic and the export(They have got the approval from the excise department as per the amendment,that specifies the same)
    so i request you to pls guide me as how can it be done in sap that two different business process will share the same number range.
    as per my knowledge local excise number range is-J_1IEXCLOC
    and for exports is-J_1IEXCEXPand the both will use the same number range and,suppose 1 local invoice is created and say if the no is 1,then if the export excise invoice is created the number will be 2,pls guide me how is it possible that the same number range should be used.
    Thanks in advance---Anshuman chakraborty

    Dear sir,Thanks for attention towards the issue,but still i need to clarify some details-
    the number range forJ_1IEXCLOC are already configured .It is not the case like i have to configure it for the first time however ,so the issue remains how shall i proceed in this case
    Sir,i have already checked the transaction j1iin,it does not give any such box to check the-use local no range
    infact the error message which the system was throwing to the user that-number range object not assigned for Object: J_1IEXCEXP.
    The question remains from my side is what are the complete configuration steps I need to do ,to make the check box appear so as to select-use local number range,and is there any thing to be conveyed to my developer,so that the same appears,
    or is it the case like the anything should earlier have been done before the number range for J_1IEXCLOC was created.i would request u to pls guide me giving the complete details of the step to be followed.
    Thanks in advance
    Anshuman chakraborty

  • OUTSTANDING PO QTY AND OUTSTANDING PO VALUE

    Hi
        I am in need of report to print outstanding po qty and outstanding po value.
    could any one please give me the source code..
    Its very urgent.....
                   Thanks in advance

    Please find this report for Outstanding PO's
    report zaprropo message-id zm no standard page heading line-size 212
                                                           line-count 65.
    **** TABLES------------------------------------------------------------*
    tables:
          ekko,                            " Purchasing Document Header
          ekpo,                            " Purchasing Document Item
          ekbe,                            " History of PurchasingDocument
          essr.                            " Service Entry Sheet HeaderData
    **** DATA--------------------------------------------------------------*
    data  : begin of it_ekko occurs 0,
             ebeln like ekko-ebeln,
             ernam like ekko-ernam,
             ekgrp like ekko-ekgrp,
             bedat like ekko-bedat,
           end of it_ekko.
    data  : begin of it_ekbe_gr occurs 0,
              ebeln like ekbe-ebeln,
              ebelp like ekbe-ebelp,
              bewtp like ekbe-bewtp,
              dmbtr like ekbe-dmbtr,
            end of it_ekbe_gr.
    data  : begin of it_ekbe_ir occurs 0,
              ebeln like ekbe-ebeln,
              ebelp like ekbe-ebelp,
    *          bewtp LIKE ekbe-bewtp,
              dmbtr like ekbe-dmbtr,
            end of it_ekbe_ir.
    data  : begin of it_output occurs 0,
              ekgrp like ekko-ekgrp,
              ebeln like ekko-ebeln,
              ebelp like ekpo-ebelp,
              ernam like ekko-ernam,
              afnam like ekpo-afnam,
              bedat like ekko-bedat,
              txz01 like ekpo-txz01,
    *          bewtp LIKE ekbe-bewtp,
              netwr like ekpo-netwr,
              dmbtr like ekbe-dmbtr,
              iramt like ekbe-dmbtr,
              outst like ekpo-netwr,
              eindt like eket-eindt,
    *          effwr LIKE ekpo-effwr,
            end of it_output.
    data  :  begin of it_title occurs 0,
               h11(5),
               h0(5),
               h1(13),
               h2(7),
               h3(15),
               h4(15),
               h5(10),
               h6(40),
               h7(20),
               h8(20),
               h9(20),
               h10(20),
               h12(10),
             end of it_title.
    data : flength.
    data : s_no type i value 1.
    * ---- Added by Gopi
    * Internal table for PO / WO Delivery Date
    data : begin of it_eket occurs 0,
             ebeln like eket-ebeln,
             ebelp like eket-ebelp,
             eindt like eket-eindt,
           end of it_eket.
    ***** selections
    selection-screen : skip.
    selection-screen : begin of block block1 with frame title text-001.
    parameters : s_bukrs like ekko-bukrs.
    select-options :  s_ebeln for ekko-ebeln,
                      s_bedat for ekko-bedat,
                      s_ekgrp for ekko-ekgrp.
    *                  s_hdg   for ekko-ekgrp.
    selection-screen : end of block block1.
    selection-screen begin of block btch with frame title text-003.
    parameters: excel as checkbox,
                file(128) type c.
    selection-screen end of block btch.
    selection-screen begin of block block2 with frame title text-002.
    parameters: asat as checkbox,
                p_date like sy-datum.
    selection-screen end of block block2.
    *---------AT SELECTION-SCREEN------------------------------------------*
    at selection-screen.
    at selection-screen on value-request for file.
      perform get_file_name using file.
    **** main program code**************************************************
    start-of-selection.
      it_title-h11 = 'S.No'.
      it_title-h0  = 'Group'.
      it_title-h1  = 'PO Number'.
      it_title-h2  = 'PO Item'.
      it_title-h3  = 'PO Creator'.
      it_title-h4  = 'Requisitor'.
      it_title-h5  = 'PO Date'.
      it_title-h6  = 'PO Short Text'.
      it_title-h7  = 'PO Amount'.
      it_title-h8  = 'GR/SE Amount'.
      it_title-h9  = 'IR Amount'.
      it_title-h10 = 'Outstanding'.
      it_title-h12 = 'Del. Date'.
      append it_title.
      perform extract_po_details_new.                           "20070814
      perform extract_po_history_new.                           "20070814
      perform calculate_outstanding_new.                        "20070814
    end-of-selection.
      perform display_report.
      if excel = 'X'.
        perform download.
      endif.
    * ---- Added by Gopi
    top-of-page.
      perform page_heading.
    *************************** display_report ****************************
    form display_report.
    *  it_title-h11 = 'S.No'.
    *  it_title-h0  = 'Group'.
    *  it_title-h1  = 'PO Number'.
    *  it_title-h2  = 'PO Item'.
    *  it_title-h3  = 'PO Creator'.
    *  it_title-h4  = 'Requisitor'.
    *  it_title-h5  = 'PO Date'.
    *  it_title-h6  = 'PO Short Text'.
    *  it_title-h7  = 'PO Amount'.
    *  it_title-h8  = 'GR/SE Amount'.
    *  it_title-h9  = 'IR Amount'.
    *  it_title-h10 = 'Outstanding'.
    *  it_title-h12 = 'Del Date'.
    *  APPEND it_title.
    *  WRITE : / 'Outstanding PO Listing Report'.
    *  ULINE.
    *  FORMAT COLOR COL_HEADING.
    *  WRITE : /1   it_title-h11,
    *           7   it_title-h0,
    *           14  it_title-h1,
    *           29  it_title-h2,
    *           38  it_title-h3,
    *           53  it_title-h4,
    *           68  it_title-h5,
    *           79  it_title-h6,
    *           122 it_title-h7,
    *           142 it_title-h8,
    *           162 it_title-h9,
    *           182 it_title-h10,
    *           202 it_title-h12.
    *  FORMAT COLOR OFF.
    *  ULINE.
    * If Output table is not empty
      if not it_output[] is initial.
        loop at it_output.
          on change of it_output-ebeln.
            uline.
            write : /1(5)  s_no, 6 sy-vline,
                     7  it_output-ekgrp,
                    14  it_output-ebeln,
                    29  it_output-ebelp,
                    38  it_output-ernam,
                    53  it_output-afnam,
                    68  it_output-bedat,
                    79  it_output-txz01,
                    122 it_output-netwr,
                    142 it_output-dmbtr,
                    162 it_output-iramt,
                    182 it_output-outst,
                    202 it_output-eindt.
            s_no = s_no + 1.
          else.
            write :/6 sy-vline,
                    29  it_output-ebelp,
                    38  it_output-ernam,
                    53  it_output-afnam,
                    68  it_output-bedat,
                    79  it_output-txz01,
                    122 it_output-netwr,
                    142 it_output-dmbtr,
                    162 it_output-iramt,
                    182 it_output-outst,
                    202 it_output-eindt.
          endon.
    *      WRITE :/6 sy-vline.
          clear : it_output.
        endloop.
      else.
    * If Output table is empty
        format color 5 intensified on.
       write : / 'No outstanding report generated for the purchasing group'
                  ,s_ekgrp-low, 'to', s_ekgrp-high,'for the period'
                  ,s_bedat-low, 'to', s_bedat-high.
        format color off.
      endif.
    endform.
    **************************** download*********************************
    form download.
      data: begin of it_download_header occurs 1,
               h0(5),
               h1(13),
               h2(7),
               h3(15),
               h4(15),
               h5(10),
               h6(40),
               h7(20),
               h8(20),
               h9(20),
               h10(20),
               h12(10).
      data: end of it_download_header.
      it_download_header-h0  = 'Group'.
      it_download_header-h1  = 'PO Number'.
      it_download_header-h2  = 'PO Item'.
      it_download_header-h3  = 'PO Creator'.
      it_download_header-h4  = 'Requisitor'.
      it_download_header-h5  = 'PO Date'.
      it_download_header-h6  = 'PO Short Text'.
      it_download_header-h7  = 'PO Amount'.
      it_download_header-h8  = 'GR/SE Amount'.
      it_download_header-h9  = 'IR Amount'.
      it_download_header-h10 = 'Outstanding'.
      it_download_header-h12 = 'Del. Date'.
      append it_download_header.
      call function 'WS_DOWNLOAD'
           exporting
                codepage            = 'IBM'
                filename            = file
                filetype            = 'DAT'
           importing
                filelength          = flength
           tables
                data_tab            = it_download_header
           exceptions
                file_open_error     = 1
                file_write_error    = 2
                invalid_filesize    = 3
                invalid_table_width = 4
                invalid_type        = 5.
      call function 'WS_DOWNLOAD'
           exporting
                codepage            = 'IBM'
                filename            = file
                filetype            = 'DAT'
                mode                = 'A'
           importing
                filelength          = flength
           tables
                data_tab            = it_output
           exceptions
                file_open_error     = 1
                file_write_error    = 2
                invalid_filesize    = 3
                invalid_table_width = 4
                invalid_type        = 5.
      if sy-subrc ne 0.
        message e999 with 'error downloading file :' file.
      endif.
    endform.
    *&      Form  get_file_name
    *       text
    *      -->P_P_FNAME  text
    form get_file_name using    p_fname.
      call function 'WS_FILENAME_GET'
           exporting
                def_filename     = p_fname
                mask             = ',*.*,*.*.'
                mode             = 'S'
           importing
                filename         = p_fname
           exceptions
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                others           = 5.
    endform.                    " get_file_name
    *&      Form  page_heading
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form page_heading.
    *  it_title-h11 = 'S.No'.
    *  it_title-h0  = 'Group'.
    *  it_title-h1  = 'PO Number'.
    *  it_title-h2  = 'PO Item'.
    *  it_title-h3  = 'PO Creator'.
    *  it_title-h4  = 'Requisitor'.
    *  it_title-h5  = 'PO Date'.
    *  it_title-h6  = 'PO Short Text'.
    *  it_title-h7  = 'PO Amount'.
    *  it_title-h8  = 'GR/SE Amount'.
    *  it_title-h9  = 'IR Amount'.
    *  it_title-h10 = 'Outstanding'.
    *  it_title-h12 = 'Del. Date'.
    *  APPEND it_title.
      write : / 'Outstanding PO Listing Report'.
      uline.
      format color col_heading.
      write : /1   it_title-h11,
           7   it_title-h0,
           14  it_title-h1,
           29  it_title-h2,
           38  it_title-h3,
           53  it_title-h4,
           68  it_title-h5,
           79  it_title-h6,
           122 it_title-h7,
           142 it_title-h8,
           162 it_title-h9,
           182 it_title-h10,
           202 it_title-h12.
      format color off.
      uline.
    endform.                    " page_heading
    *&      Form  EXTRACT_PO_DETAILS_NEW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form extract_po_details_new.
      data: begin of it_po occurs 0,
        ebeln like ekko-ebeln,
        ebelp like ekpo-ebelp,
        ernam like ekko-ernam,
        ekgrp like ekko-ekgrp,
        bedat like ekko-bedat,
        txz01 like ekpo-txz01,
        netwr like ekpo-netwr,
        afnam like ekpo-afnam,
        effwr like ekpo-effwr.
      data: end of it_po.
      refresh it_output.
      if not p_date is initial.
        select a~ebeln b~ebelp a~ernam a~ekgrp a~bedat b~txz01 b~netwr
           b~afnam b~effwr
        into corresponding fields of table it_po
        from ekpo as b inner join ekko as a
        on b~ebeln = a~ebeln
        where a~bukrs = s_bukrs  and
            a~aedat le p_date  and
            a~ebeln in s_ebeln and
            a~bedat in s_bedat and
            a~ekgrp in s_ekgrp and
            a~frgke ne 'E'     and
            b~loekz not in ('L', 'S', 'X').
      else.
        select a~ebeln b~ebelp a~ernam a~ekgrp a~bedat b~txz01 b~netwr
           b~afnam b~effwr
        into corresponding fields of table it_po
        from ekpo as b inner join ekko as a
        on b~ebeln = a~ebeln
        where a~bukrs = s_bukrs  and
            a~ebeln in s_ebeln and
            a~bedat in s_bedat and
            a~ekgrp in s_ekgrp and
            a~frgke ne 'E'     and
            b~loekz not in ('L', 'S', 'X').
      endif.
      sort it_po by ebeln ebelp.
      delete adjacent duplicates from it_po.
      delete it_po where ekgrp eq 'HDB' and ebelp eq 10.    "20070814
      delete it_po where ebeln+0(1) eq '6'.
      loop at it_po.
        move-corresponding it_po to it_output.
        append it_output.
        clear it_output.
      endloop.
      refresh it_po.
      free it_po.
    endform.                    " EXTRACT_PO_DETAILS_NEW
    *&      Form  EXTRACT_PO_HISTORY_NEW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form extract_po_history_new.
      data: begin of it_ekbe occurs 2000,
              ebeln like ekbe-ebeln,
              ebelp like ekbe-ebelp,
              bewtp like ekbe-bewtp,
              shkzg like ekbe-shkzg,
              dmbtr like ekbe-dmbtr.
      data: end of it_ekbe.
      check not it_output[] is initial.
      select * into corresponding fields of table it_ekbe
        from ekbe for all entries in it_output
        where ebeln = it_output-ebeln and
              ebelp = it_output-ebelp and
              bewtp in ('E', 'N', 'Q', 'R', 'X').
      loop at it_ekbe.
        if it_ekbe-bewtp = 'E'.          "GET GR AMT
          move it_ekbe-ebeln to it_ekbe_gr-ebeln.
          move it_ekbe-ebelp to it_ekbe_gr-ebelp.
          move it_ekbe-bewtp to it_ekbe_gr-bewtp.
          if it_ekbe-shkzg = 'H'.
            it_ekbe_gr-dmbtr = it_ekbe-dmbtr * ( -1 ).
          else.
            it_ekbe_gr-dmbtr = it_ekbe-dmbtr.
          endif.
          collect it_ekbe_gr.
        else.                              "GET IR AMT
    *    ELSEIF IT_EKBE-BEWTP = 'N' OR     "GET IR AMT
    *           IT_EKBE-BEWTP = 'Q' OR
    *           IT_EKBE-BEWTP = 'R' OR
    *           IT_EKBE-BEWTP = 'X'.
          move it_ekbe-ebeln to it_ekbe_ir-ebeln.
          move it_ekbe-ebelp to it_ekbe_ir-ebelp.
          if it_ekbe-shkzg = 'H'.
            it_ekbe_ir-dmbtr = it_ekbe-dmbtr * ( -1 ).
          else.
            it_ekbe_ir-dmbtr = it_ekbe-dmbtr.
          endif.
          collect it_ekbe_ir.
        endif.
      endloop.
      refresh it_ekbe.
      free it_ekbe.
    endform.                    " EXTRACT_PO_HISTORY_NEW
    *&      Form  CALCULATE_OUTSTANDING_NEW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form calculate_outstanding_new.
    *  DATA: BEGIN OF IT_EKET OCCURS 10000,
    *          EBELN LIKE EKET-EBELN,
    *          EBELP LIKE EKET-EBELP,
    *          EINDT LIKE EKET-EINDT.
    *  DATA: END OF IT_EKET.
      sort: it_ekbe_gr, it_ekbe_ir.
      sort it_output by ebeln ebelp.
      loop at it_output.
        read table it_ekbe_gr with key ebeln = it_output-ebeln
                                       ebelp = it_output-ebelp.
        if sy-subrc = 0.
          move it_ekbe_gr-dmbtr to it_output-dmbtr.
        endif.
        read table it_ekbe_ir with key ebeln = it_output-ebeln
                                       ebelp = it_output-ebelp.
        if sy-subrc = 0.
          move it_ekbe_ir-dmbtr to it_output-iramt.
        endif.
        if it_output-iramt gt it_output-netwr.
          delete it_output. " where iramt gt it_output-netwr.
          clear : it_output.
          continue.
        endif.
        if it_output-ekgrp eq 'HDB'.
          if it_output-netwr = it_output-iramt.
            delete it_output.
            clear it_output.
          else.
            it_output-outst = it_output-netwr - it_output-iramt.
            modify it_output.
          endif.
        else.
          if it_output-netwr = it_output-dmbtr.
            if it_output-dmbtr = it_output-iramt.
              delete it_output.
              clear it_output.
            else.
              it_output-outst = it_output-netwr - it_output-iramt.
              modify it_output.
            endif.
          else.
            if it_output-netwr = it_output-iramt.
              delete it_output.
              clear it_output.
            else.
              it_output-outst = it_output-netwr - it_output-iramt.
              modify it_output.
            endif.
          endif.
        endif.
      endloop.
      sort it_output by ebeln ebelp.
      check not it_output[] is initial.
      select * into corresponding fields of table it_eket
        from eket for all entries in it_output
        where ebeln = it_output-ebeln and
              ebelp = it_output-ebelp.
      sort it_eket by ebeln ebelp.
      loop at it_output.
        read table it_eket with key ebeln = it_output-ebeln
                                    ebelp = it_output-ebelp.
        if sy-subrc = 0.
          it_output-eindt = it_eket-eindt.
        else.
          clear it_output-eindt.
        endif.
        modify it_output.
      endloop.
      sort it_output by ekgrp ebeln ebelp.
    endform.                    " CALCULATE_OUTSTANDING_NEW
    Regards
    Gopi

Maybe you are looking for