Help me plese...vendor aging report

Dear Experts,
When i execute report S_ALR_87012078, it gives me short dump saying :
A PERFORM was used to call the routine "START" of the program "SAPMKCBR ".The current call contains 7 actual parameter(s),but the routine "START" expects 9 parameters.
Inside this report program GPDBALD1U1O2MD0JTFS2L4XWO8M
it is calling subroutine START by passing paramenter
PERFORM START(SAPMKCBR) TABLES B SP S0
                                                 USING   G_S_SUMMLEV.
here parameter S1 is missing.
Now, how can i make changes to this standard report.
Please help me....
regards,
B.Siddhesh

Hi,
Generally aging report shows the items due by the vendor for specific dates, like for a month, 2 months, 3 months etc. As long as the item is in open status, the same will appear in the aging report.
There are SAP standard Aging reports which will give clarity
S_ALR_87012078 - Due Date Analysis for Open Items
S_ALR_87012083 - List of Vendor Open Items for Printing
'S_ALR_87012084 - Open Items - Vendor Due Date Forecast '
S_ALR_87012105 - List of Down Payments Open On Key Date - Vendors
F.41 - Open Items
You can select the fields as per your requirements to get into the details of the report
hope this clarifies
regards,
radhika

Similar Messages

  • Help me plz - Vendor Aging Report

    Dear Experts,
    When i execute report S_ALR_87012078, it gives me short dump saying :
    A PERFORM was used to call the routine "START" of the program "SAPMKCBR ".The current call contains 7 actual parameter(s),but the routine "START" expects 9 parameters.
    Inside this report program GPDBALD1U1O2MD0JTFS2L4XWO8M
    it is calling subroutine START by passing paramenter
    PERFORM START(SAPMKCBR) TABLES B SP S0
                                                     USING   G_S_SUMMLEV.
    here parameter S1 is missing.
    Now, how can i make changes to this standard report.
    Please help me....
    regards,
    B.Siddhesh

    Hi,
    Generally aging report shows the items due by the vendor for specific dates, like for a month, 2 months, 3 months etc. As long as the item is in open status, the same will appear in the aging report.
    There are SAP standard Aging reports which will give clarity
    S_ALR_87012078 - Due Date Analysis for Open Items
    S_ALR_87012083 - List of Vendor Open Items for Printing
    'S_ALR_87012084 - Open Items - Vendor Due Date Forecast '
    S_ALR_87012105 - List of Down Payments Open On Key Date - Vendors
    F.41 - Open Items
    You can select the fields as per your requirements to get into the details of the report
    hope this clarifies
    regards,
    radhika

  • Vendor Aging Report

    Hi All
    i am trying to get a legitimate vendor Aging report from within SAP
    The 2 reports that I am currently looking at are:
    S_ALR_87012085 - Vendor Payment History with OI Sorted List
    S_ALR_87012084 - Open Items - Vendor Due Date Forecast
    But both these do not bring out the output the way i want it - and i tried changing the output control and it still doesnt bring out the report as i want it - I want a report like the S_ALR_87012178 for customers, with output control 1, 6 and a 0 - which gives me a logical list of the aged customers.
    Is there one like this for vendors too? Any suggestions?
    Thank you
    Rukshana

    Hi Ruksaana,
    You can customize the vendor report to show the items overdue per vendor by using the following steps
    1. Create a form using T Code - FKI4
        In this form ( two-axis structure) provide the details for each column as per your Client requirement - Due from 0 - 30 days
        etc. You can create a column (using formula method) at the end by adding the previous columns, this will give you total     
        amount of overdue items for each vendor
    2. Create a report using T Code - FKI1
        Based on the Form created in the above step. Make additional selections based on  client  requirements like document type,
        company code, account type, currency etc. Execute the report.
    The following link will give provides detail steps for the creation of the aforementioned form and report.
    Re: AR aging report (summary by customer)
    Hope this helps.
    - Sadha.

  • Vendor ageing report

    Hi all,
    i have to prepare vendor ageing report.In that there is one exception that is if "no. of overdue days > 7 " color should be red.But here no. of overdue days can be calculated with the following formula as shown below.
    no. of overdue days = query date(today's date) - orginal confirmation date.
    but my query is there is no orginal confirmation date present in the infocube 0pur_c01 . how to get that ?
    plz help me in this regards,
    Thanx & Regards,
    RaviChandra

    Hi suman,
    thanx for ur reply , but my question is how to get the orginal confirmation date from the cube 0pur_c01 , my requirement is to find the no. of overdue days.
    no. of overdue day = today's date - orginal confirmation date.
    Here we can get the today's date , but how to  get the orginal confirmation date from the cube 0pur_c01 ,
    I hope u understand the question.
    Thanx & Regards,
    RaviChandra
    Edited by: Ravichandra.bi on Sep 18, 2011 7:32 AM

  • I need a code for VENDOR AGEING REPORT

    plz help me i am in urgent need of source code of
    VENDOR AGEING REPORT.
    if any body help me regarding this above report i will be
    great ful to him/her.
    bcoz deadline is today.
    i  need ur urgent help, i treid very much but i failed,
    so hope help from anybody there.

    REPORT  zvender_os NO STANDARD PAGE  HEADING
                                  LINE-SIZE 132
                                  LINE-COUNT 65.
    Tables
    TABLES: bsik,          "open items (A/C: Secondary Index for Customers)
            lfa1,          "customer master
            lfb1,
            rf140,        "temp stru (Work Fields for Corrence(SAPF140*))
            bsak,          "cleared items (A/c Secnd Index for Cust(Clrms))
            skat.
    constants and variables
    TYPE-POOLS: slis.
    DATA: fieldcat             TYPE slis_t_fieldcat_alv,
          fieldcat1             TYPE slis_t_fieldcat_alv,
          fieldcat_ln          TYPE slis_fieldcat_alv,
          layout_in            TYPE slis_layout_alv,
          layout_in1           TYPE slis_layout_alv,
          sortcat              TYPE slis_t_sortinfo_alv,
          sortcat1              TYPE slis_t_sortinfo_alv,
          sortcat_ln           LIKE LINE OF sortcat,
          eventcat1             TYPE slis_t_event,
          eventcat             TYPE slis_t_event,
          eventcat_ln          LIKE LINE OF eventcat,
          col_pos              TYPE i.
    DATA:  targ_month(2)         TYPE n,                        "0001
           targ_year(4)          TYPE n,                        "0001
           targ_mth_abs          TYPE p,                        "0001
           doc_month(2)          TYPE n,                        "0001
           doc_year(4)           TYPE n,                        "0001
           doc_mth_abs           TYPE p,                        "0001
           mth_result            TYPE p,                        "0001
           doc_days              TYPE p,
           targ_days             TYPE p,
           addl_days             TYPE p,
           ext_days              TYPE p,
           v_days(3)             TYPE c,
           v_kkber               LIKE knkk-kkber.
    DATA:
          BEGIN OF inrec OCCURS 1000,                           "0001
            lifnr    LIKE bsik-lifnr,
            belnr    LIKE bsik-belnr,
            gjahr    LIKE bsik-gjahr,
            bldat    LIKE bsik-bldat,
            xblnr    LIKE bsik-xblnr,
            blart    LIKE bsik-blart,
            sgtxt    LIKE bsik-sgtxt,
            shkzg    LIKE bsik-shkzg,
            dmbtr    LIKE bsik-dmbtr,
            zfbdt    LIKE bsik-zfbdt,
            zbd1t    LIKE bsik-zbd1t,
            zbd2t    LIKE bsik-zbd2t,
            zbd3t    LIKE bsik-zbd3t,
            zuonr    LIKE bsik-zuonr,
          END OF inrec.
    DATA:
          BEGIN OF inrect OCCURS 1000,                          "0001
            lifnr    LIKE bsik-lifnr,
            belnr    LIKE bsik-belnr,
            gjahr    LIKE bsik-gjahr,
            bldat    LIKE bsik-bldat,
            xblnr    LIKE bsik-xblnr,
            blart    LIKE bsik-blart,
            sgtxt    LIKE bsik-sgtxt,
            shkzg    LIKE bsik-shkzg,
            dmbtr    LIKE bsik-dmbtr,
            zfbdt    LIKE bsik-zfbdt,
            zbd1t    LIKE bsik-zbd1t,
            zbd2t    LIKE bsik-zbd2t,
            zbd3t    LIKE bsik-zbd3t,
            zuonr    LIKE bsik-zuonr,
          END OF inrect,
          BEGIN OF t_item OCCURS 1000,                          " 0001
            lifnr LIKE bsik-lifnr,
            belnr LIKE bsik-belnr,
            gjahr LIKE bsik-gjahr,
            bldat LIKE bsik-bldat,
            xblnr LIKE bsik-xblnr,
            blart LIKE bsik-blart,
            sgtxt LIKE bsik-sgtxt,
            zfbdt LIKE bsik-zfbdt,
            dmbtr LIKE bsik-dmbtr,
            days(3)  TYPE c,
            zuonr    LIKE bsik-zuonr,
          END OF t_item,
          t_line LIKE t_item OCCURS 1000 WITH HEADER LINE,      " 0001
          BEGIN OF itab OCCURS 1000,
            lifnr    LIKE lfa1-lifnr,
            total    LIKE bsik-dmbtr,
            zfuture  LIKE bsik-dmbtr,
            zcurrent LIKE bsik-dmbtr,
            crbal   LIKE bsik-dmbtr,
            30days   LIKE bsik-dmbtr,
            60days   LIKE bsik-dmbtr,
            90days   LIKE bsik-dmbtr,
            99days   LIKE bsik-dmbtr,
            120days  LIKE bsik-dmbtr,
            180days  LIKE bsik-dmbtr,
            365days  LIKE bsik-dmbtr,
            bzirk    LIKE knvv-bzirk,
            vkbur    LIKE knvv-vkbur,
            vwerk    LIKE knvv-vwerk,
            vkgrp    LIKE knvv-vkgrp,
            klimk    LIKE knkk-klimk,
            cashd    LIKE knkk-cashd,
            grupp    LIKE knkk-grupp,
            erdat    LIKE lfa1-erdat,
            name1    LIKE lfa1-name1,
            name2    LIKE lfa1-name2,
            stras    LIKE lfa1-stras,
            ort01    LIKE lfa1-ort01,
            telf1    LIKE lfa1-telf1,
            psort(10),
            sperr    LIKE lfa1-sperr,
            totsal   LIKE bsik-dmbtr,
            txt50    LIKE skat-txt50,
            gsber    LIKE bsik-gsber,
          END OF itab.
    DATA: sel_tab     TYPE TABLE OF rsparams WITH HEADER LINE,
          p_debit(1) TYPE c,
          p_credit(1) TYPE c.
    DATA: t_variant LIKE disvariant OCCURS 0 WITH HEADER LINE.
    parameters and select-options
    SELECTION-SCREEN BEGIN OF BLOCK blck0 WITH FRAME TITLE text-002.
    PARAMETERS: stida LIKE sy-datum DEFAULT sy-datum OBLIGATORY,
                p_bukrs LIKE t001-bukrs DEFAULT 'PIIL' MEMORY ID buk
    OBLIGATORY.
              P_BUKRS LIKE T001-BUKRS DEFAULT 'CC01' OBLIGATORY.  "0003
    SELECT-OPTIONS: s_lifnr   FOR bsik-lifnr ,
                   s_vkbur FOR knvv-vkbur,
                   s_vkgrp FOR knvv-vkgrp,
                   s_bzirk FOR knvv-bzirk,
                   s_konda FOR knvv-konda,
                   s_kdgrp FOR knvv-kdgrp NO-DISPLAY ,
                   s_kvgr2 FOR knvv-kvgr2 NO-DISPLAY ,
                   s_kkber FOR knkk-kkber NO-DISPLAY ,
                   s_grupp FOR knkk-grupp NO-DISPLAY ,
                   s_ctlpc FOR knkk-ctlpc,
                    s_akont FOR lfb1-akont,
                    s_gsber FOR bsik-gsber.
    PARAMETERS: p_future AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK blck0.
    SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME TITLE text-002.
    PARAMETERS: p_abs RADIOBUTTON GROUP zrad,
                p_due RADIOBUTTON GROUP zrad DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK blck1.
    *SELECTION-SCREEN BEGIN OF BLOCK blck2 WITH FRAME TITLE text-003.
    *PARAMETERS: c_run RADIOBUTTON GROUP zrac DEFAULT 'X',
               c_blk RADIOBUTTON GROUP zrac,
               c_all RADIOBUTTON GROUP zrac.
    *SELECTION-SCREEN END OF BLOCK blck2.
    *SELECTION-SCREEN BEGIN OF BLOCK blck3 WITH FRAME TITLE text-004.
    *PARAMETERS: p_debit AS CHECKBOX DEFAULT 'X' ,
               p_credit AS CHECKBOX DEFAULT 'X' NO-DISPLAY,
    *selection-screen end of block blck3.
    start-of-selection.
    START-OF-SELECTION.
    PERFORM BUILD_EVENTCAT.
      p_debit = 'X'.
      p_credit = 'X'.
      PERFORM get_customer_invoices.
    filter records based on selection criteria
      PERFORM filter_records.
    END-OF-SELECTION.
      PERFORM add_sort_field.
      PERFORM modify_field.
      PERFORM write_report.
    *&      Form  FILTER_RECORDS
          To collect all the required data from DB and store them in
          internal table.
    -->  p1        text
    <--  p2        text
    FORM filter_records.
    delete records based on selection criteria
      LOOP AT itab.
       SELECT vkbur vkgrp vwerk erdat konda kdgrp bzirk kvgr2
         INTO (itab-vkbur, itab-vkgrp, itab-vwerk, knvv-erdat,
               knvv-konda, knvv-kdgrp,itab-bzirk,knvv-kvgr2)
         FROM knvv WHERE lifnr =  itab-lifnr
                   ORDER BY erdat DESCENDING.
    AKS :- Not Required for PI
         CASE itab-vkbur.
           WHEN 'SA1'.
             itab-vkbur = 'SF25'.
           WHEN 'QLD1'.
             itab-vkbur = 'SF23'.
           WHEN 'WA1'.
             itab-vkbur = 'SF26'.
         ENDCASE.
    AKS.
         EXIT.
       ENDSELECT.
       IF itab-vkbur IN s_vkbur AND
          itab-vkgrp IN s_vkgrp AND
          knvv-konda IN s_konda AND
          knvv-kdgrp IN s_kdgrp AND
          itab-bzirk IN s_bzirk AND
          knvv-kvgr2 IN s_kvgr2.
       ELSE.
         DELETE itab.
         CONTINUE.
       ENDIF.
       SELECT SINGLE klimk grupp cashd
         INTO (itab-klimk, itab-grupp, itab-cashd)
         FROM knkk WHERE lifnr =  itab-lifnr
                   AND   kkber IN s_kkber
                   AND   ctlpc IN s_ctlpc
                   AND   grupp IN s_grupp.
       IF SY-SUBRC NE 0.
         DELETE ITAB.
         CONTINUE.
       ENDIF.
        SELECT SINGLE skat~txt50
             INTO (itab-txt50)
             FROM lfb1 INNER JOIN skat
             ON lfb1akont EQ skatsaknr
             WHERE lfb1~lifnr =  itab-lifnr
                       AND   lfb1~akont IN s_akont
                       AND   skat~spras EQ 'EN'.
        IF sy-subrc NE 0.
          DELETE itab.
          CONTINUE.
        ENDIF.
        SELECT SINGLE name1 name2 telf1 erdat stras ort01 sperr
             INTO (itab-name1, itab-name2, itab-telf1,
                     itab-erdat, itab-stras, itab-ort01, itab-sperr )
               FROM lfa1
               WHERE lifnr =  itab-lifnr
        IF sy-subrc NE 0 .
          DELETE itab.
          CONTINUE.
        ENDIF.
    AKS For Filteration of Customer base on Block Area.
       IF c_all NE 'X'.
         IF c_run EQ 'X' AND itab-sperr EQ 'X'.
           DELETE itab.
           CONTINUE.
         ELSE.
           IF c_blk EQ 'X' AND itab-sperr NE 'X'.
             DELETE itab.
             CONTINUE.
           ENDIF.
         ENDIF.
       ENDIF.
        MODIFY itab.
      ENDLOOP.
    ENDFORM.                               " FILTER_RECORDS
    *&      Form  GET_CUSTOMER_INVOICES
          text
    -->  p1        text
    <--  p2        text
    FORM get_customer_invoices.
      DATA:ztotcre  LIKE bsik-dmbtr.
      DATA:ztotsal  LIKE bsik-dmbtr.
      DATA: fsdate LIKE sy-datum.
      DATA: l_perio(4) TYPE c.
      MOVE stida             TO rf140-stida.
      MOVE rf140-stida+4(2)  TO targ_month.
      MOVE rf140-stida+0(4)  TO targ_year.
      MOVE rf140-stida+6(2)  TO targ_days.
      targ_mth_abs           =  ( targ_year * 12 ) + targ_month.
      CALL FUNCTION 'ZGET_PERIOD_FROM_DATE'
        EXPORTING
          i_date  = stida
        IMPORTING
          e_perio = l_perio.
      CONCATENATE l_perio '0401' INTO fsdate.
    select open items.
      IF p_due EQ 'X'.
        SELECT lifnr belnr gjahr bldat xblnr blart sgtxt        " 0001
               shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
               zuonr
          FROM bsik INTO TABLE inrect
          WHERE bukrs =  p_bukrs
          AND   budat LE stida
          AND   lifnr IN s_lifnr
          AND   gsber IN s_gsber
          AND   umskz NE 'T'
          AND   umskz NE 'F'
          AND   umskz NE 'R'
          AND   umskz NE 'P'
          AND   umskz NE 'J'
          AND umskz NE 'L'.
    LOOP AT INREC.
       IF INREC-SHKZG = 'H'.
         INREC-DMBTR  = INREC-DMBTR * -1.
       ENDIF.
       MOVE-CORRESPONDING INREC TO T_ITEM.                     " 0001
       PERFORM COLLECT_INVOICE USING   INREC-lifnr    INREC-DMBTR
                                       INREC-ZFBDT    INREC-ZBD1T
                                       INREC-ZBD2T    INREC-ZBD3T.
       APPEND T_ITEM.
       CLEAR T_ITEM.
    ENDLOOP.
        LOOP AT inrect.
          inrec-lifnr = inrect-lifnr.
          inrec-belnr    = inrect-belnr.
          inrec-gjahr    = inrect-gjahr.
          inrec-bldat    = inrect-bldat.
          inrec-xblnr    = inrect-xblnr.
          inrec-blart    = inrect-blart.
          inrec-sgtxt    = inrect-sgtxt.
          inrec-shkzg    = inrect-shkzg.
          inrec-dmbtr    = inrect-dmbtr.
          CALL FUNCTION 'NJ_CAL_DATE_IN_INTERVAL'
            EXPORTING
              date      = inrect-zfbdt
              days      = inrect-zbd1t
              months    = 00
              signum    = '+'
              years     = 00
            IMPORTING
              calc_date = inrec-zfbdt.
          inrec-zbd1t    = inrect-zbd1t.
          inrec-zbd2t    = inrect-zbd2t.
          inrec-zbd3t    = inrect-zbd3t.
          inrec-zuonr    = inrect-zuonr.
          APPEND inrec.
          CLEAR inrec.
        ENDLOOP.
      ELSE.
        SELECT lifnr belnr gjahr bldat xblnr blart sgtxt        " 0001
               shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
               zuonr
          FROM bsik INTO TABLE inrec
          WHERE bukrs =  p_bukrs
          AND   budat LE stida
          AND   lifnr IN s_lifnr
          AND   gsber IN s_gsber
          AND   umskz NE 'T'
          AND   umskz NE 'F'
          AND   umskz NE 'R'
          AND   umskz NE 'P'
          AND   umskz NE 'J'
          AND umskz NE 'L'.
      ENDIF.
      SORT inrec BY lifnr shkzg zfbdt .
      LOOP AT inrec.
        AT NEW lifnr.
    For Customers Credit Balance Transaction to be display in Report
    End of Credit Balance
          ztotcre = 0.
          ztotsal = 0.
        ENDAT.
        IF inrec-shkzg = 'H'.
          inrec-dmbtr = inrec-dmbtr * -1.
          ztotcre = ztotcre + inrec-dmbtr.
        ELSE.
          IF inrec-blart = 'RV'.
            IF inrec-bldat GE fsdate.
              ztotsal = ztotsal + inrec-dmbtr.
            ENDIF.
          ENDIF.
          ztotcre = ztotcre +  inrec-dmbtr.
       endif.
          IF p_debit EQ 'X'.
            IF ztotcre > 0.
              MOVE-CORRESPONDING inrec TO t_item.               " 0001
              PERFORM collect_invoice USING inrec-lifnr    ztotcre
                                          inrec-zfbdt    inrec-zbd1t
                                          inrec-zbd2t    inrec-zbd3t
                                          ztotsal.
              APPEND t_item.
              CLEAR t_item.
              ztotcre = 0.
              ztotsal = 0.
            ENDIF.
          ENDIF.
        ENDIF.
        IF p_credit EQ 'X'.
         AT END OF lifnr.
          IF ztotcre < 0.
            MOVE-CORRESPONDING inrec TO t_item.                 " 0001
            PERFORM collect_invoice USING inrec-lifnr    ztotcre
                                        inrec-zfbdt       inrec-zbd1t
                                        inrec-zbd2t    inrec-zbd3t
                                        ztotsal.
            APPEND t_item.
            CLEAR t_item.
            ztotcre = 0.
            ztotsal = 0.
           APPEND t_item.
           CLEAR t_item.
          ENDIF.
         ENDAT.
        ENDIF.
      ENDLOOP.
    select cleared items
      IF p_due EQ 'X'.
        REFRESH inrect.  CLEAR inrect.
        SELECT lifnr belnr gjahr bldat xblnr blart sgtxt
               shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
               zuonr
          FROM bsak INTO TABLE inrect
          WHERE bukrs =  p_bukrs
          AND   budat LE stida
          AND   augdt >  stida
          AND   lifnr IN s_lifnr
          AND   gsber IN s_gsber
        REFRESH inrec.  CLEAR inrec.
        LOOP AT inrect.
          inrec-lifnr = inrect-lifnr.
          inrec-belnr    = inrect-belnr.
          inrec-gjahr    = inrect-gjahr.
          inrec-bldat    = inrect-bldat.
          inrec-xblnr    = inrect-xblnr.
          inrec-blart    = inrect-blart.
          inrec-sgtxt    = inrect-sgtxt.
          inrec-shkzg    = inrect-shkzg.
          inrec-dmbtr    = inrect-dmbtr.
          CALL FUNCTION 'NJ_CAL_DATE_IN_INTERVAL'
            EXPORTING
              date      = inrect-zfbdt
              days      = inrect-zbd1t
              months    = 00
              signum    = '+'
              years     = 00
            IMPORTING
              calc_date = inrec-zfbdt.
          inrec-zbd1t    = inrect-zbd1t.
          inrec-zbd2t    = inrect-zbd2t.
          inrec-zbd3t    = inrect-zbd3t.
          inrec-zuonr    = inrect-zuonr.
          APPEND inrec.
          CLEAR inrec.
        ENDLOOP.
      ELSE.
        REFRESH inrec.  CLEAR inrec.
        SELECT lifnr belnr gjahr bldat xblnr blart sgtxt
               shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
               zuonr
          FROM bsak INTO TABLE inrec
          WHERE bukrs =  p_bukrs
          AND   budat LE stida
          AND   augdt >  stida
          AND   lifnr IN s_lifnr
          AND   gsber IN s_gsber
      ENDIF.
      SORT inrec BY lifnr shkzg zfbdt .
      LOOP AT inrec.
        AT NEW lifnr.
          ztotcre = 0.
          ztotsal = 0.
        ENDAT.
        IF inrec-shkzg = 'H'.
          inrec-dmbtr = inrec-dmbtr * -1.
          ztotcre = ztotcre + inrec-dmbtr.
        ELSE.
          IF inrec-blart = 'RV'.
            IF inrec-bldat GE fsdate.
              ztotsal = ztotsal + inrec-dmbtr.
            ENDIF.
          ENDIF.
          ztotcre = ztotcre +  inrec-dmbtr.
      endif.
          IF p_debit EQ 'X'.
            IF ztotcre > 0.
              MOVE-CORRESPONDING inrec TO t_item.               " 0001
              PERFORM collect_invoice USING inrec-lifnr    ztotcre
                                          inrec-zfbdt    inrec-zbd1t
                                          inrec-zbd2t    inrec-zbd3t
                                          ztotsal.
              APPEND t_item.
              CLEAR t_item.
              ztotcre = 0.
              ztotsal = 0.
            ENDIF.
          ENDIF.
        ENDIF.
        IF p_credit EQ 'X'.
         AT END OF lifnr.
          IF ztotcre < 0.
            MOVE-CORRESPONDING inrec TO t_item.                 " 0001
            PERFORM collect_invoice USING inrec-lifnr    ztotcre
                                        inrec-zfbdt    inrec-zbd1t
                                        inrec-zbd2t    inrec-zbd3t
                                        ztotsal.
            APPEND t_item.
            CLEAR t_item.
            ztotcre = 0.
            ztotsal = 0.
           APPEND t_item.
           CLEAR t_item.
          ENDIF.
         ENDAT.                                                " 0001
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_CUSTOMER_INVOICES
    *&      Form  COLLECT_INVOICE
          text
         -->P_bsik_lifnr  text
         -->P_bsik_DMBTR  text
         -->P_bsik_ZFBDT  text
         -->P_bsik_ZFBDT1  text
         -->P_bsik_ZFBDT2  text
         -->P_bsik_ZFBDT3  text
    FORM collect_invoice USING    pp_lifnr
                                  pp_dmbtr
                                  pp_zfbdt
                                  pp_zbd1t
                                  pp_zbd2t
                                  pp_zbd3t
                                  pp_ztotsal.
      doc_month            =  pp_zfbdt+4(2).
      doc_year             =  pp_zfbdt+0(4).
      doc_mth_abs          =  ( doc_year * 12 ) + doc_month.
      mth_result           =  ( targ_mth_abs    - doc_mth_abs ).
    logic given by Mr. Ashok Singhvi
      doc_days             =  pp_zfbdt+6(2).
      addl_days            =  ( doc_days  -  targ_days ).
      IF addl_days <= 0.
        ADD 1 TO mth_result.
      ENDIF.
      IF NOT pp_zbd3t IS INITIAL.
        MOVE pp_zbd3t TO ext_days.
      ELSEIF NOT pp_zbd2t IS INITIAL.
        MOVE pp_zbd2t TO ext_days.
      ELSEIF NOT pp_zbd1t IS INITIAL.
        MOVE pp_zbd1t TO ext_days.
      ELSE.
        CLEAR ext_days.
      ENDIF.
    CHECK with Andrew whether this is working or not
    if extended payment terms exist, subtract no of mths from mth_result
    IF NOT ext_days IS INITIAL.
       CASE ext_days.
         WHEN 30.
           SUBTRACT 1 FROM mth_result.
         WHEN 60.
           SUBTRACT 2 FROM mth_result.
         WHEN 90.
           SUBTRACT 3 FROM mth_result.
         WHEN 120.
           SUBTRACT 4 FROM mth_result.
       ENDCASE.
    ENDIF.
    change to key date
      IF pp_dmbtr > 0.
        IF p_future = 'X'.                                      " 0001
          IF mth_result      <= 0.
            itab-zcurrent    =  pp_dmbtr.
            t_item-days       = 'CUR'.
          ELSEIF mth_result  =  1.
            itab-30days      =  pp_dmbtr.
            t_item-days       = '30D'.
          ELSEIF mth_result  =  2.
            itab-60days      =  pp_dmbtr.
            t_item-days        = '60D'.
          ELSEIF mth_result  =  3.
            itab-90days      =  pp_dmbtr.
            t_item-days        = '90D'.
          ELSEIF mth_result  >  3 AND mth_result  <=  4 .
            itab-99days      =  pp_dmbtr.
            t_item-days        = '99D'.
          ELSEIF mth_result  >  4 AND mth_result  <=  6 .
            itab-120days      =  pp_dmbtr.
            t_item-days        = '120D'.
          ELSEIF mth_result  >  6 AND mth_result  <=  12 .
            itab-180days      =  pp_dmbtr.
            t_item-days        = '180D'.
          ELSEIF mth_result  >  12 .
            itab-365days      =  pp_dmbtr.
            t_item-days        = '365D'.
          ENDIF.
        ELSE.
          IF mth_result      < 0.
            itab-zfuture     =  pp_dmbtr.
            t_item-days       = 'FUT'.
          ELSEIF mth_result  = 0.
            itab-zcurrent = pp_dmbtr.
            t_item-days       = 'CUR'.
          ELSEIF mth_result  =  1.
            itab-30days      =  pp_dmbtr.
            t_item-days       = '30D'.
          ELSEIF mth_result  =  2.
            itab-60days      =  pp_dmbtr.
            t_item-days       = '60D'.
          ELSEIF mth_result  =  3.
            itab-90days      =  pp_dmbtr.
            t_item-days       = '90D'.
          ELSEIF mth_result  >  3 AND mth_result  <=  4 .
            itab-99days      =  pp_dmbtr.
            t_item-days        = '99D'.
          ELSEIF mth_result  >  4 AND mth_result  <=  6 .
            itab-120days      =  pp_dmbtr.
            t_item-days        = '120D'.
          ELSEIF mth_result  >  6 AND mth_result  <=  12 .
            itab-180days      =  pp_dmbtr.
            t_item-days        = '180D'.
          ELSEIF mth_result  >  12 .
            itab-365days      =  pp_dmbtr.
            t_item-days        = '365D'.
          ENDIF.
        ENDIF.                                                  " 0001
        itab-crbal         = 0.
        itab-total         = pp_dmbtr.
      ELSE.
        IF p_future = 'X'.                                      " 0001
          IF mth_result      <= 0.
            itab-zcurrent    =  pp_dmbtr.
            t_item-days       = 'CUR'.
          ELSEIF mth_result  =  1.
            itab-30days      =  pp_dmbtr.
            t_item-days       = '30D'.
          ELSEIF mth_result  =  2.
            itab-60days      =  pp_dmbtr.
            t_item-days        = '60D'.
          ELSEIF mth_result  =  3.
            itab-90days      =  pp_dmbtr.
            t_item-days        = '90D'.
          ELSEIF mth_result  >  3 AND mth_result  <=  4 .
            itab-99days      =  pp_dmbtr.
            t_item-days        = '99D'.
          ELSEIF mth_result  >  4 AND mth_result  <=  6 .
            itab-120days      =  pp_dmbtr.
            t_item-days        = '120D'.
          ELSEIF mth_result  >  6 AND mth_result  <=  12 .
            itab-180days      =  pp_dmbtr.
            t_item-days        = '180D'.
          ELSEIF mth_result  >  12 .
            itab-365days      =  pp_dmbtr.
            t_item-days        = '365D'.
          ENDIF.
        ELSE.
          IF mth_result      < 0.
            itab-zfuture     =  pp_dmbtr.
            t_item-days       = 'FUT'.
          ELSEIF mth_result  = 0.
            itab-zcurrent = pp_dmbtr.
            t_item-days       = 'CUR'.
          ELSEIF mth_result  =  1.
            itab-30days      =  pp_dmbtr.
            t_item-days       = '30D'.
          ELSEIF mth_result  =  2.
            itab-60days      =  pp_dmbtr.
            t_item-days       = '60D'.
          ELSEIF mth_result  =  3.
            itab-90days      =  pp_dmbtr.
            t_item-days       = '90D'.
          ELSEIF mth_result  >  3 AND mth_result  <=  4 .
            itab-99days      =  pp_dmbtr.
            t_item-days        = '99D'.
          ELSEIF mth_result  >  4 AND mth_result  <=  6 .
            itab-120days      =  pp_dmbtr.
            t_item-days        = '120D'.
          ELSEIF mth_result  >  6 AND mth_result  <=  12 .
            itab-180days      =  pp_dmbtr.
            t_item-days        = '180D'.
          ELSEIF mth_result  >  12 .
            itab-365days      =  pp_dmbtr.
            t_item-days        = '365D'.
          ENDIF.
        ENDIF.                                                  " 0001
        itab-total         = pp_dmbtr.
        itab-crbal         = 0.
      ENDIF.
      itab-lifnr         = pp_lifnr.
      itab-totsal        = pp_ztotsal.
      COLLECT itab.
      CLEAR itab.
    ENDFORM.                    " COLLECT_INVOICE
    *&      Form  ADD_SORT_FIELD
          text
    -->  p1        text
    <--  p2        text
    FORM add_sort_field.
      DATA: l_amount(9)  TYPE n.
      IF p_future = 'X'.
        LOOP AT itab.
          l_amount = 999999999.
          IF     itab-365days > 0.
            l_amount = l_amount - itab-365days.
            CONCATENATE 'A' l_amount INTO itab-psort.
          ELSEIF     itab-180days > 0.
            l_amount = l_amount - itab-180days.
            CONCATENATE 'B' l_amount INTO itab-psort.
          ELSEIF     itab-120days > 0.
            l_amount = l_amount - itab-120days.
            CONCATENATE 'C' l_amount INTO itab-psort.
          ELSEIF     itab-99days > 0.
            l_amount = l_amount - itab-99days.
            CONCATENATE 'D' l_amount INTO itab-psort.
          ELSEIF itab-90days > 0.
            l_amount = l_amount - itab-90days.
            CONCATENATE 'E' l_amount INTO itab-psort.
          ELSEIF itab-60days > 0.
            l_amount = l_amount - itab-60days.
            CONCATENATE 'F' l_amount INTO itab-psort.
          ELSEIF itab-30days > 0.
            l_amount = l_amount - itab-30days.
            CONCATENATE 'G' l_amount INTO itab-psort.
          ELSEIF itab-zcurrent > 0.
            l_amount = l_amount - itab-zcurrent.
            CONCATENATE 'H' l_amount INTO itab-psort.
        ELSEif itab-zfuture > 0.
          L_AMOUNT = L_AMOUNT - ITAB-zfuture.
          CONCATENATE 'F' L_AMOUNT INTO ITAB-PSORT.
          ELSE.
            l_amount = ABS( itab-total ).
            CONCATENATE 'I' l_amount INTO itab-psort.
          ENDIF.
          MODIFY itab.
        ENDLOOP.
      ELSE.
        LOOP AT itab.
          l_amount = 999999999.
          IF     itab-365days > 0.
            l_amount = l_amount - itab-365days.
            CONCATENATE 'A' l_amount INTO itab-psort.
          ELSEIF     itab-180days > 0.
            l_amount = l_amount - itab-180days.
            CONCATENATE 'B' l_amount INTO itab-psort.
          ELSEIF     itab-120days > 0.
            l_amount = l_amount - itab-120days.
            CONCATENATE 'C' l_amount INTO itab-psort.
          ELSEIF     itab-99days > 0.
            l_amount = l_amount - itab-99days.
            CONCATENATE 'D' l_amount INTO itab-psort.
          ELSEIF itab-90days > 0.
            l_amount = l_amount - itab-90days.
            CONCATENATE 'E' l_amount INTO itab-psort.
          ELSEIF itab-60days > 0.
            l_amount = l_amount - itab-60days.
            CONCATENATE 'F' l_amount INTO itab-psort.
          ELSEIF itab-30days > 0.
            l_amount = l_amount - itab-30days.
            CONCATENATE 'G' l_amount INTO itab-psort.
          ELSEIF itab-zcurrent > 0.
            l_amount = l_amount - itab-zcurrent.
            CONCATENATE 'H' l_amount INTO itab-psort.
          ELSEIF itab-zfuture > 0.
            l_amount = l_amount - itab-zfuture.
            CONCATENATE 'I' l_amount INTO itab-psort.
          ELSE.
            l_amount = ABS( itab-total ).
            CONCATENATE 'J' l_amount INTO itab-psort.
          ENDIF.
          MODIFY itab.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " ADD_SORT_FIELD
    *&      Form  WRITE_REPORT
          text
    -->  p1        text
    <--  p2        text
    FORM write_report.
      PERFORM build_fieldcat.
      PERFORM build_sortcat.
      PERFORM build_eventcat.
      PERFORM build_layout.
      PERFORM start_list_viewer.
    ENDFORM.                    " WRITE_REPORT
    *&      Form  BUILD_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat.
    lifnr
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
      fieldcat_ln-ref_tabname        = 'lfa1'.
      fieldcat_ln-fieldname          = 'LIFNR'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      APPEND fieldcat_ln TO fieldcat.
    Name1
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
      fieldcat_ln-ref_tabname        = 'lfa1'.
      fieldcat_ln-fieldname          = 'NAME1'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-seltext_l          = 'Name'.
      APPEND fieldcat_ln TO fieldcat.
    City Details
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
      fieldcat_ln-ref_tabname        = 'lfa1'.
      fieldcat_ln-fieldname          = 'ORT01'.
      fieldcat_ln-seltext_l          = 'City'.
      fieldcat_ln-col_pos            = col_pos.
      APPEND fieldcat_ln TO fieldcat.
    Credit Limit
    ADD 1 TO col_pos.
    CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'KNKK'.
    fieldcat_ln-fieldname          = 'KLIMK'.
    fieldcat_ln-col_pos            = col_pos.
    fieldcat_ln-emphasize = 'C41'.
    APPEND fieldcat_ln TO fieldcat.
    ADD 1 TO col_pos.
    CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
    fieldcat_ln-fieldname          = 'CRBAL'.
    fieldcat_ln-col_pos            = col_pos.
    fieldcat_ln-emphasize = 'C41'.
    fieldcat_ln-do_sum             = 'X'.
    fieldcat_ln-seltext_l          = 'Cr. Bal.'.
    fieldcat_ln-seltext_m          = 'Cr. Bal.'.
    fieldcat_ln-seltext_s          = 'Cr. Bal.'.
    APPEND fieldcat_ln TO fieldcat.
    Total Amount
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
      fieldcat_ln-fieldname          = 'TOTAL'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-seltext_l          = 'Out.St.Amt.'.
      fieldcat_ln-seltext_m          = 'Out.St.Amt.'.
      fieldcat_ln-seltext_s          = 'Out.St.Amt.'.
      fieldcat_ln-ref_tabname        = 'zbsik'.
      fieldcat_ln-ref_fieldname      = 'ZDMBTR'.
      APPEND fieldcat_ln TO fieldcat.
      IF p_future NE 'X'.
    Future
        ADD 1 TO col_pos.
        CLEAR fieldcat_ln.
       fieldcat_ln-ref_tabname        = 'bsik'.
       fieldcat_ln-ref_fieldname      = 'DMBTR'.
        fieldcat_ln-fieldname          = 'ZFUTURE'.
        fieldcat_ln-col_pos            = col_pos.
        fieldcat_ln-do_sum             = 'X'.
        fieldcat_ln-hotspot            = 'X'.
        fieldcat_ln-emphasize = 'C41'.
        fieldcat_ln-seltext_l          = 'Future Due'.
        fieldcat_ln-seltext_m          = 'Future Due'.
        fieldcat_ln-seltext_s          = 'Future Due'.
        APPEND fieldcat_ln TO fieldcat.
      ENDIF.
    Current
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = 'ZCURRENT'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = 'Normal Due'.
      fieldcat_ln-seltext_m          = 'Normal Due'.
      fieldcat_ln-seltext_s          = 'Normal Due'.
      APPEND fieldcat_ln TO fieldcat.
    30 Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '30DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '0-30 Days'.
      fieldcat_ln-seltext_m          = '0-30 Days'.
      fieldcat_ln-seltext_s          = '0-30 Days'.
      APPEND fieldcat_ln TO fieldcat.
    60 Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '60DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '31-60 Days'.
      fieldcat_ln-seltext_m          = '31-60 Days'.
      fieldcat_ln-seltext_s          = '31-60 Days'.
      APPEND fieldcat_ln TO fieldcat.
    90 Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '90DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '61-90 Days'.
      fieldcat_ln-seltext_m          = '61-90 Days'.
      fieldcat_ln-seltext_s          = '61-90 Days'.
      APPEND fieldcat_ln TO fieldcat.
    99 Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '99DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '91-120 Days'.
      fieldcat_ln-seltext_m          = '91-120 Days'.
      fieldcat_ln-seltext_s          = '91-120 Days'.
      APPEND fieldcat_ln TO fieldcat.
    *120Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '120DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '121-180 Days'.
      fieldcat_ln-seltext_m          = '121-180 Days'.
      fieldcat_ln-seltext_s          = '121-180 Days'.
      APPEND fieldcat_ln TO fieldcat.
    *180 Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '180DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '181-365 Days'.
      fieldcat_ln-seltext_m          = '181-365 Days'.
      fieldcat_ln-seltext_s          = '181-365 Days'.
      APPEND fieldcat_ln TO fieldcat.
    *365 Days
      ADD 1 TO col_pos.
      CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'bsik'.
    fieldcat_ln-ref_fieldname      = 'DMBTR'.
      fieldcat_ln-fieldname          = '365DAYS'.
      fieldcat_ln-col_pos            = col_pos.
      fieldcat_ln-do_sum             = 'X'.
      fieldcat_ln-hotspot            = 'X'.
      fieldcat_ln-emphasize = 'C41'.
      fieldcat_ln-seltext_l          = '>365 Days'.
      fieldcat_ln-seltext_m          = '>365 Days'.
      fieldcat_ln-seltext_s          = '>365 Days'.
      APPEND fieldcat_ln TO fieldcat.
    Last Payment Date
    ADD 1 TO col_pos.
    CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'KNKK'.
    fieldcat_ln-fieldname          = 'CASHD'.
    fieldcat_ln-col_pos            = col_pos.
    APPEND fieldcat_ln TO fieldcat.
    Street Name
    ADD 1 TO COL_POS.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-REF_TABNAME        = 'lfa1'.
    FIELDCAT_LN-FIELDNAME          = 'STRAS'.
    FIELDCAT_LN-COL_POS            = COL_POS.
    APPEND FIELDCAT_LN TO FIELDCAT.
    Telephone
    ADD 1 TO COL_POS.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-REF_TABNAME        = 'lfa1'.
    FIELDCAT_LN-FIELDNAME          = 'TELF1'.
    FIELDCAT_LN-COL_POS            = COL_POS.
    APPEND FIELDCAT_LN TO FIELDCAT.
    Credit Group
    ADD 1 TO COL_POS.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-REF_TABNAME        = 'KNKK'.
    FIELDCAT_LN-FIELDNAME          = 'GRUPP'.
    FIELDCAT_LN-COL_POS            = COL_POS.
    APPEND FIELDCAT_LN TO FIELDCAT.
    *Sales District
    ADD 1 TO col_pos.
    CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'KNVV'.
    fieldcat_ln-fieldname          = 'BZIRK'.
    fieldcat_ln-col_pos            = col_pos.
    fieldcat_ln-seltext_l          = 'S_Distt'.
    fieldcat_ln-seltext_m          = 'S_Distt'.
    fieldcat_ln-seltext_s          = 'S_Distt'.
    APPEND fieldcat_ln TO fieldcat.
    Sales Office
    ADD 1 TO col_pos.
    CLEAR fieldcat_ln.
    fieldcat_ln-ref_tabname        = 'KNVV'.
    fieldcat_ln-fieldname          = 'VKBUR'.
    fieldcat_ln-col_pos            = col_pos.
    fieldcat_ln-seltext_l          = 'S_Off'.
    fieldcat_ln-seltext_m          = 'S_Off'.
    fieldcat_ln-seltext_s          = 'S_Off'.
    APPEND fieldcat_ln TO fieldcat.
    Cust Creat Date
    ADD 1 TO COL_POS.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-REF_TABNAME        = 'lfa1'.
    FIELDCAT_LN-FIELDNAME          = 'ERDAT'.
    FIELDCAT_LN-COL_POS            = COL_POS.
    APPEND FIELDCAT_LN TO FIELDCAT.

  • Vendor ageing report data for all doc type needed(urgent)

    hello everyone
    once again i need ur help guys.
    in the vendor ageing report i am getting data for only one document type and not of other.
    ex- see i have two documents type-
    1.KD 2. EJ
    so i am getting data for document type KD only.
    so how to get the data of document type EJ along with KD.
    below is my code .
    so tell what modifications i have to made .
    *& Report  Z_VENDOR AGEING                                                    *
    *&  in this repoet I am calculating the vendor ageing
        which is depending on formula
        AGEING = Current Date(or any date entered by user) – Bline Date(BSIK-ZFBDT)                                                                 *
    REPORT  z_vendor  NO STANDARD PAGE HEADING
                      LINE-SIZE 200
                      LINE-COUNT 65(3).
    TABLES : bsik.
    DATA : BEGIN OF t_out OCCURS 0,
           bukrs LIKE bsik-bukrs,
           saknr LIKE bsik-saknr,
           bldat LIKE bsik-bldat,
           wrbtr LIKE bsik-wrbtr,
           lifnr LIKE bsik-lifnr,
           zfbdt like bsik-zfbdt,
           zbd1t like bsik-zbd1t,
           ageing type i,
           END OF t_out.
    parameters : p_date1 type d.
    SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,
                     s_saknr FOR bsik-saknr,
                     s_lifnr FOR bsik-lifnr.
    SELECT bukrs saknr bldat wrbtr lifnr zfbdt zbd1t
           FROM bsik
           INTO  TABLE t_out
           WHERE saknr IN s_saknr
           AND bukrs IN s_bukrs
           AND lifnr IN s_lifnr.
    Loop at t_out.
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis                   = p_date1
        i_datum_von                   = t_out-zfbdt
      I_KZ_EXCL_VON                 = '0'
      I_KZ_INCL_BIS                 = '0'
      I_KZ_ULT_BIS                  = ' '
      I_KZ_ULT_VON                  = ' '
      I_STGMETH                     = '0'
      I_SZBMETH                     = '1'
    IMPORTING
       E_TAGE                        = t_out-ageing
    EXCEPTIONS
      DAYS_METHOD_NOT_DEFINED       = 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.
    Modify t_out.
    Clear t_out.
    Endloop.
    LOOP AT T_OUT.
    IF T_OUT-SHKZG = ‘H’.
    T_OUT-WRBTR = T_OUT-WRBTR * -1.
    T_OUT-WRBTR = T_OUT-DMBTR * -1.
    ENDIF.
    DATA: TOTAL(16) TYPE P DECIMALS 2.
    TOTAL = TOTAL + T_OUT-DMBTR.
    Endloop.
    LOOP AT t_out.
      WRITE : / t_out-saknr,
                t_out-lifnr,
                t_out-wrbtr,
                t_out-zfbdt,
                T_OUT-DMBTR,
                t_out-ageing.
    AT LAST.
    WRITE:/ TOTAL.
    CLEAR TOTAL.
    ENDAT.
    ENDLOOP.
    Message was edited by: sanjeev singh

    Sanjeev,
    Can you tell what is document type EJ representing...Secondly, if you check couple of documents of EJ type and check if data is available as per you WHERE clause filters.
    Regards
    Anurag

  • I want to modify vendor aging report F.18.

    HI gurus,
    I want to add vendor name in vendor aging report f.18. I have copy std prg and make z prg and also put vendor name in internal table but in last that table's field getting clear so its not printing in report. So , if anybody knows then help.
    Thanks in Advance,
    Nainesh Patadia.

    I run this report but it show all details like vendor name etc

  • Creation of Vendor Aging Report in SAP BI.

    Hello,
    There is requirement to create the Vendor Aging report in SAP BI Cube.
    In order to show the Aging of the Vendor in different buckets.
    Can anyone help me out with the Links/Blogs/Wiki  ... URL's .
    I tried finding in net couldnt get anything related to this.
    Thank you for the help in advance.
    Regards,
    Adhvi

    Hello Obaid,
    Thanks for the reply.
    got the URL for Vendor Aging Report ..which has better detailed information.
    http://help.sap.com/saphelp_nw70/helpdata/EN/69/b4e9503d6a4f39b66e67b1cedf41af/frameset.htm
    0FIAP_M30_Q0003 not found in the BI Content
    Creation of Vendor Aging Report in SAP BI.
    Vendor Ageing formula
    If you come across any further Customization of the Reports related to the Vendor ageing reports based on the URL mentioned below...let me know.
    Thanks & Regards,
    Adhvi

  • Customized Vendor Aging Report

    Dear Experts,
    We had developed a customized Vendor Aging Crystal Report as on Date for one of our customer which is similar to SAP's Vendor Liabilities Aging, just a minor change we have been done in our report for calculating the due date of AP Invoice only for the document type as Item, from AP Invoice document date to GRPO's posting date.
    So to build this report we had consider following transactions AP Invoice, AP Credit Memo, AP Down Payment Invoice, Outgoing Payment, Incoming Payment & Journal Entry and also we had concluded following scenario's:-
    AP Invoice based on GRPO
    Standalone AP Invoice's Item / Service.
    AP Invoice adjusted against AP Credit Memo.
    AP Invoice knocked off against Reconciliation.
    AP Credit Memo based on AP Invoice
    AP Credit Memo standalone Item /Service
    AP Credit Memo adjusted against Outgoing Payment
    AP Credit Memo knocked off against Reconciliation
    AP Down Payment Invoice - Open.
    Outgoing Payment - On Account
    Outgoing Payment - Against Transaction.
    Outgoing Payment - Direct Knocked off in Reconciliation.
    Incoming Payment - On Account
    Incoming Payment - Direct Knocked off in Reconciliation.
    Journal Entry - Adjusted and Unadjusted
    After considering all the possible scenario which do have impact with Vendor has been covered but still our report gets failed to tally with SAP Vendor Liabilities Aging Report on back dated date specially with reco happened transaction which get failed on comparison with Input parameter date against transaction date and reconciled date.
    Please refer the attachment contains Store Procedure of this report. We would highly appreciate and thankful if some one could help us in optimizing our store procedure which could get tallied with SAP Vendor Liabilities Aging Report.
    Many Thanks in Advance......
    Regards
    Krishna Kumar

    Hi,
    Not able to open attached file. Please check these threads:
    Vendor Aging Report SAP B1
    Customer Receivables Aging - Query
    Thanks & Regards,
    Nagarajan

  • Required Standard Vendor ageing report

    Hi FI Experts,
    I am SD Person, i have required Vendor ageing report, where we were see the vendor's due & non due out standing in mass up to perticular period.
    Please help me.
    Regards
    BK GAIKWAD

    Hi,
       Check with the following links.
    Need standrad program for vendor aging report
    Vendor Aging Report
    Regards,
    Radhika.

  • Customer and Vendor ageing report by ItemGroup@%@#$%@#$??

    Hi All
    How do we get Customer and Vendor ageing report by "ItemGroup"?
    I know there is a standard report in Business One which gives you the ageing report by Business Partner Group.  But I dont know whether it is possible to get by "ItemGroup".  Please help me and excuse me for weird requirement..
    Thanks

    Hi Gordon,
    that query is actually designed for getting the purchase reports with all the excise and other tax related information per line item in the marketing document.   my requirement is something different than this where the client wants to see the ageing report by Itemgroup. 
    Since ageing is based on the invoice due date it looks difficult to bifurcate the each individual line item, its group, its line total and their due date.  means we should add all the open invoices' line items to be grouped with its total based on the due date.  any other way to solve this?
    thanks

  • Vendor Ageing Report Through Report Painter

    Dear All
    As per my company requirement we are trying to develop vendor ageing report through report painter, by using library 8A4 (EC CPA: Drill Down Open Item), our requirement is all normal items and some special GL transactions (Not all) has to flow in this report.
    In FKI4 / FKI5 if we assign any special GL, then data flowing in to report relating to that particular special GL transactions only, normal items are not flowing in to report. If we not assign any special GL then all normal and special GL transaction are flowing in to report.
    Can anybody suggest how to restrict flow of some special GL transaction data in to report. Our requirement is all normal transaction along with some specified special GL transaction data has to flow in to report. Points will be rewarded on helpful answer.
    Thanks & Regards
    Madhava

    Hi Madhava
    You can pull all values whether Sp GL or Normal GL values. For a particular 'Column' if you assign Sp Gl Indicator you will fetch all Sp Gl Values in that column. Same way in other column, you dont assign Sp Gl Indicator, instead you calculate manually as shown below;
    In a similar fashion you can calculate all values for (00-30), (31-60) ...and so on.
    Hope this clears all your doubts?
    Regards
    Abbas

  • Customer & Vendor Ageing Reports

    Hi
    Can you please tell how can i get vendor and customer ageing report,  Ex.Open items from 10-20,21-30,31-40 so on...
    where i can get the report?
    Mammu.

    Hi,
    Customer aging report -
    S_ALR_87012168
    S_ALR_87012176
    S_ALR_87012197
    S_ALR_87012178 (open item aging analysis)
    vendor aging report -
    S_ALR_87012085 - Vendor Payment History with OI Sorted List
    S_ALR_87012078 - Due Date Analysis for Open Items
    S_ALR_87012084 - Open Items - Vendor Due Date Forecast
    hope this helps
    regards,
    radhika

  • Vendor ageing report(urgent)

    in vendor ageing report i am getting the data for the vendors with open item only means those vendors who have to pay depending on the parameter date which we r passing
    in selection screen.
    but i  want all those records with cleared item also depending on that date.
    means suppose there r 2 vendors
    1.sanjeev-he has to pay 1000 but he has paid 500 and left
    with 500 due.
    2. amit -he has to pay 1000 and he had not paid anything till now.
    so when i am executing my report it is showing only
    sanjeev 500
    amit 1000
    but i need
    sanjeev 1000
    amit 1000
    to be displayed but as sanjeev has already paid 500
    so it is not showing the output as above.
    so how it could be achieved

    hi sanjeev,
    anver here.
    do like this.
    if has_paid < has_to_pay.
    write has_to_pay.
    endif.
    rgds
    anver

  • Vendor Aging Report to show zero balance does not show all vendors

    Hi all,
    I would like to see a list of all my vendors in the Vendor Aging Report. I clicked on show vendors with zero balance, however, I still only get a partial list of the vendors. Is there a setting I need to set to show all the vendors? Any advice would be appreciated.
    Thank you!
    Jane

    Hi,
    I think your requirement is you want all vendors displayed irrespective of the transactions entered for that Business Partner.
    The Aging Report will display only those BPs which have transactions posted to them.
    The function of 'Display Vendors with zero balance' checkbox is that it behaves like a selection creteria and leads to inclusion
    of all those Business Partners who do not have a balance as of the current date but had a balance on the selected backdate.
    example :
    If a vendor has a balance as on 01.08.08 and is paid on 10.08.08, then the vendor will not be included in aging report (when run on 01.08.08) unless "Include Vendors with zero balance" is checked.
    This checkbox does not allow you to display all the vendors created in the database.
    Regards,
    Jitin
    SAP Business One Forum Team

  • Need standrad program for vendor aging report

    Hi
      Need standrad program for vendor aging report.
    Please reply me only standrad programs.
    Point are sure.
    Regards,
    kumar

    Hi Pankaj
       sorry to say that this is not my required program.
    I need vendor aging report like s_alr_87012178 tc leads to customer aging report.
    Thanks for your effort.
    points are awarded.
    Regards,
    kumar

Maybe you are looking for

  • How to open two projects in the same time?

    I have over 40 file project. Stadium. I am in finish of my work, but I forgot about something. I didn't notice that I lost a few keyfreme animation. I didn't realize that in 30 project and I am more over 40 right now. I made a lot of work and I can't

  • Using 4TB WD drives on M58p in Win/7 Pro x64

    After taking advantage of Cyber Monday deals in December, 2013 for Western Digital WD4001FAEX 4 TByte drives, I suddenly was faced with the "32-bit MBR" issue on systems with normal BIOS (not UEFI) like my 7630 and 7483 M58p Small Form Factor PC's. 

  • Report or Spreadsheet in a Form

    Can you Generate Report, Excel of PDF Spreadsheet within a Form?

  • TREX Monitor

    Hi all. I've trying to create indexes and i have a problem, the portal gives me the following error: 'Index could not be created; creating index failed: There are no active http servers known at the nameserver. (Errorcode 7218)' And when i try to loo

  • Is T code OOHAP_BASIC in Performanace management system(PMS)  available in IMG Node ?

    Hi, Is T code OOHAP_BASIC in Performanace management system(PMS)  available in IMG Node ? please revert . I am not able to find the same in IMG. Thanks Srikant .