XL Reporter Sample AR Aging Report by Transaction come up blank

Hi,
I am running B1 2007 with PL38.  I downloaded the sample AR Aging Report by transaction from SAP but when I generated the report, I get the worksheet with blank Data.  Can anyone make any suggestions.
Regards,
Peter To

Peter,
We're at PL41, but I had the same problem and contacted SAP Support.  After reporting the problem, SAP logged onto my database via a WebEx session, got into SQL Server Console, and modified a ixView in the database views. They had to increase the size of two Ref fields in the view. Once they did that, everything worked fine.
You probably just need to open a message and get it scheduled.

Similar Messages

  • Report DETAILED RECEIVABLES AGING REPORT

    the client Arquicentro load report Customer Receivable Aging by Sales Employees
    they generate report DETAILED RECEIVABLES AGING REPORT but this report
    doesn´t show details documents with POSTING DATE
    The client has request that scales to support this improvement
    Dear Martha,
    The reported functionality does not exist in the present releases of SAP Business One, as you have already mentioned.
    As explained in note 1028874 regards missing Functionality, in case the missing functionality is regarding a legal compliance issue, please use the attached template to complete your request and send it back with this message.
    In all other cases (i.e. non-legal issues), like the case you described, we would like to ask you to post your requirement in our SAP Business One Product Development Collaboration forum and not via m essage (please kindly close the message if you have opened one for a non-legal requirement): /community
    For more information please go to that note.
    Kind Regards,
    Paulo Calado
    Senior Support Consultant
    SAP Product Support for SAP Business One

    Hello,
    This report is one of the hard coded PLD that do not allow you to add UDF.
    Thanks,
    Gordon

  • SAP B1 crystal report: Customer Receivable Aging report

    Hi All, I want to write a Customer Receivable Aging report  in crystal report. I was using query to union open AR crdit memo and AR invoice.   but, I foggot to add incomming payment ORCT.   I really have trouble to get Customer Receivable Aging report . Can anyone help me? thanks    Is that I did in wrong direction? 
    SELECT OINV.DocEntry,OINV.DocNum,OINV.ObjType,OINV.CardCode,OCRD.CntctPrsn,OCRD.fax,OINV.NumAtCard,OINV.Address,OCTG.PymntGroup
           ,OINV.CardName,OINV.DocDate,OINV.DocDueDate,OINV.DocCur,OINV.DocTotalFC,
           OINV.DocTotal, (OINV.DocTotal-OINV.PaidToDate) as AmountAUD
      FROM SAPLIVE.dbo.OINV OINV join SAPLIVE.dbo.OCTG OCTG
      On OINV.GroupNum=OCTG.GroupNum 
             join SAPLIVE.dbo.OCRD OCRD
             On OINV.CardCode=OCRD.CardCode
      WHERE OINV.CANCELED='N' AND OINV.DocStatus='O' AND (OINV.DocTotal-OINV.PaidToDate)>0
    union
    SELECT ORIN.DocEntry,ORIN.DocNum,ORIN.ObjType,ORIN.CardCode,OCRD.CntctPrsn,OCRD.fax,ORIN.NumAtCard,ORIN.Address,OCTG.PymntGroup
           ,ORIN.CardName,ORIN.DocDate,ORIN.DocDueDate,ORIN.DocCur,ORIN.DocTotalFC,
           ORIN.DocTotal,(ORIN.DocTotal-ORIN.PaidToDate)as AmountAUD
      FROM SAPLIVE.dbo.ORIN ORIN join SAPLIVE.dbo.OCTG OCTG
      On ORIN.GroupNum=OCTG.GroupNum
       join SAPLIVE.dbo.OCRD OCRD
             On ORIN.CardCode=OCRD.CardCode
      WHERE ORIN.CANCELED='N' AND ORIN.DocStatus='O' AND (ORIN.DocTotal-ORIN.PaidToDate)

    Hello Julian - maybe you can start with the JDT1 table which contains all of the General Ledger Journal Entries...
    Hope this helps...
    Regards - Zal
    --F-BP AR Aging Report Detail Ver 1 ZP 2011 04 16
    --DESCRIPTION:  SQL uses General Ledger Detail to create an Aging Report which shows
    actual invoices, credit memos, and payments by reference date in the JDT1 table.
    --AUTHOR(s):
    --Version 1 Zal Parchem 16 April 2011
    SELECT
    T1.CardCode AS 'Cust Num',
    T1.CardName AS 'Cust Name',
    T0.SysDeb AS 'Debit Amt',
    T0.SysCred * -1 AS 'Credit Amt',
    CASE
    WHEN T0.TransType = 13 THEN 'AR Invoice'
    WHEN T0.TransType = 14 THEN 'AR Cred Memo'
    WHEN T0.TransType = 24 THEN 'Payment'
    ELSE 'Other'
    END AS 'Trans Type',
    T0.Ref1 AS 'Reference',
    FcCurrency AS 'Currency',
    CONVERT(VARCHAR(10), RefDate, 103) 'Posting Date',
    CONVERT(VARCHAR(10), DueDate, 103) 'Due Date',
    CONVERT(VARCHAR(10), TaxDate, 103) 'Doc Date' ,
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 <  31 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '0-30 Days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 30
    AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 61 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '31 to 60 Days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 60
    AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 91 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '61 to 90 days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 90
    AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 121 THEN
    CASE
    WHEN SysCred < > 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '90 to 120 Days',
    CASE
    WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 120
    THEN
    CASE
    WHEN SysCred != 0 THEN SysCred * -1
    ELSE SysDeb
    END
    END AS '120 Plus Days'
    FROM JDT1 T0
    INNER JOIN OCRD T1
    ON T0.ShortName = T1.CardCode
    AND T1.CardType = 'C'
    WHERE
    T0.IntrnMatch = '0'
    AND T0.BalDueDeb !=  T0.BalDueCred
    ORDER BY
    T1.CardCode,
    T0.TaxDate
    FOR BROWSE

  • Data mismatch with ECC FBL5N report and debtor ageing report(BI side)

    Hi,
    I am facing a data mismatch problem with FBl5N(t-code for customer line item report) report in ECC side and Debtor ageing report in BI side.
    The problem is
    1) there are mismatch of data with some customer amounts in both ECC and Bi side.
    2) and also there are customer Nos with amounts in BI Debtor ageing report which are not there in the ECC FBL5N(t-code for customer line item report)
    for the second problem, I checked in the Tables BSID,BSAD in ECC side ,there also these customer Nos are not available.
    One more strange thing is that with the same selectionin report on both ECC and BI reports the data mismatch and The extra customers in Bi reports are changing everyday, i.e. we are getting new set of data mismatch and extra customers Nos in BI Side.
    If anyone  have worked on this type of issue.....kindly help...
    Thanks in advance

    Hi,
    on the one hand it may be delta mechanism of FI_*_4 extractors with the timestamps issue, that your comparision between BI and ECC is at no time up to date.
    FI Extraction
    on the other hand, it may be the delta problem between data targets in your BI-System, in case you load the FI-Data from a DSO to a cube and make a report on the cube. I have this problem at the moment and will watch this thread for more suggestions.

  • Open aging report

    This report has been extended from an existing query that has been posted on this forum. 
    This report is an aging report for ALL trasnactions, both open and closed.
    Is it possible to modify this query to report on OPEN / unreconciled trasnactions only?
    select T0.shortname,T2.cardcode 'Customer Code',T2.cardname 'Name',T2.U_BU, T2.U_DEPT, sysdeb 'Debit Amount',syscred 'Credit Amount',
    case T0.transtype
    when '13' then 'INV'
    when '14' then 'AR CN'
    when '24' then 'INCOMING'
    else 'Other'
    end 'Type',
    T1.BaseRef'Trans #',
    case T0.transtype
    when '13' then
    (Select Comments from OINV where OINV.Transid=T1.Transid)
    else '-'
    end 'Inv.Rem.',
    (Select SeriesName From NNM1 Where Series=T1.DocSeries and ObjectCode=T0.TransType)'Series',
    T0.Ref1,
    fccurrency 'BP Currency',
    CONVERT(VARCHAR(10), T0.refdate, 103)'Posting Date' ,
    CONVERT(VARCHAR(10), T0.duedate, 103) 'Due Date',
    CONVERT(VARCHAR(10), T0.taxdate, 103) 'Doc Date' ,
    CASE
    when (DATEDIFF(dd,T0.refdate,current_timestamp))+1 < 31
    then
    case
    when syscred <> 0 then syscred * - 1
    else sysdeb
    end
    end "0-30 days",
    case when ((datediff(dd,T0.refdate,current_timestamp))+1 > 30
    and (datediff(dd,T0.refdate,current_timestamp))+1< 61)
    then
    case
    when syscred <> 0 then syscred * - 1
    else sysdeb
    end
    end "31 to 60 days",
    case when ((datediff(dd,T0.refdate,current_timestamp))+1 > 60
    and (datediff(dd,T0.refdate,current_timestamp))+1< 91)
    then
    case
    when syscred <> 0 then syscred * - 1
    else sysdeb
    end
    end "61 to 90 days",
    CASE
    when (DATEDIFF(dd,T0.refdate,current_timestamp))+1 > 90
    then
    case
    when syscred= 0 then sysdeb
    when sysdeb= 0 then syscred * - 1
    end
    end "90 + days"
    from JDT1 T0
    Inner Join OJDT T1 On T1.TransId=T0.TransId
    left outer join
    OCRD T2 ON T2.cardcode =T0.shortname where
    T2.cardtype = 'c' and T0.intrnmatch = '0' and
    T2.U_Bu = %0and T2.U_Dept = %1
    ORDER BY T2.CARDCODE, T0.taxdate
    Thanks in advanced Lisa

    Thanks for the feedback Jule - I have changed the query as is as below
    Unfortunately,  the query is still reporting ALL transactions not just unreconciled transations.
    Would be grateful for any assistance.
    Cheers Lisa
    select T0.shortname,T2.cardcode 'Customer Code',T2.cardname 'Name',T2.U_BU, T2.U_DEPT, balscdeb 'Debit Amount',balsccred 'Credit Amount',
    case T0.transtype
    when '13' then 'INV'
    when '14' then 'AR CN'
    when '24' then 'INCOMING'
    else 'Other'
    end 'Type',
    T1.BaseRef'Trans #',
    case T0.transtype
    when '13' then
    (Select Comments from OINV where OINV.Transid=T1.Transid)
    else '-'
    end 'Inv.Rem.',
    (Select SeriesName From NNM1 Where Series=T1.DocSeries and ObjectCode=T0.TransType)'Series',
    T0.Ref1,
    fccurrency 'BP Currency',
    CONVERT(VARCHAR(10), T0.refdate, 103)'Posting Date' ,
    CONVERT(VARCHAR(10), T0.duedate, 103) 'Due Date',
    CONVERT(VARCHAR(10), T0.taxdate, 103) 'Doc Date' ,
    CASE
    when (DATEDIFF(dd,T0.refdate,current_timestamp))+1 < 31
    then
    case
    when balsccred <> 0 then balsccred * - 1
    else balscdeb
    end
    end "0-30 days",
    case when ((datediff(dd,T0.refdate,current_timestamp))+1 > 30
    and (datediff(dd,T0.refdate,current_timestamp))+1< 61)
    then
    case
    when balsccred <> 0 then balsccred * - 1
    else balscdeb
    end
    end "31 to 60 days",
    case when ((datediff(dd,T0.refdate,current_timestamp))+1 > 60
    and (datediff(dd,T0.refdate,current_timestamp))+1< 91)
    then
    case
    when balsccred <> 0 then balsccred * - 1
    else balscdeb
    end
    end "61 to 90 days",
    CASE
    when (DATEDIFF(dd,T0.refdate,current_timestamp))+1 > 90
    then
    case
    when balsccred= 0 then balscdeb
    when balscdeb= 0 then balsccred * - 1
    end
    end "90 + days"
    from JDT1 T0
    Inner Join OJDT T1 On T1.TransId=T0.TransId
    left outer join
    OCRD T2 ON T2.cardcode =T0.shortname where
    T2.cardtype = 'c' and
    T2.U_Bu = [%0]and T2.U_Dept = [%1]
    ORDER BY T2.CARDCODE, T0.taxdate

  • Regarding aging reports

    Hi Experts/Gurus
    I need the standard reports and transaction for customer aging report and vendor aging report.(I need only standard reports not the custom reports)
    Need immediate replies.
    Your answers can be rewarded with good points.
    Regards,
    kumar

    Hello,
    Check the link
    Aging Report for AR
    Vendor Ageing Report ?
    If useful reward.
    Vasanth

  • AR Aging Report by Due Date

    Hello:
    I did the OB transfer from another database. I transferred all the invoices by due date. After the transfer I tried to run an aging report. The aging report does not show the AR by age. I just see the total. Any help to resolve this will be much appreciated
    Thanks,
    Satish

    Hi Rahul:
    I entered them at Feb 01 date with the due date of the respective invoices. When I run the aging report by posting date all the transactions fall under < 30 days. But when I choose aging report by due date all the balances show under Balance due and there is no aging available. I tried doing this in the test data base and it worked fine there. But not in the active/production database. Please let me know why is this?
    Thanks,
    Satish

  • Customer aging report-needs the line items behind it

    We have created a Z report for customer aging report,is it feasible to get the drilldown against each aging bucket.I.e to call the FBL5n report to be displayed to see the line items behind each aging bucket.
    Regards
    Rekha

    If standard report does not suffice your requirement, then create your own.
    FOR vendor USE K in transaction code instead of D.
    Hello,
    The following example I have given is for customers.
    The only difference is in transaction codes. For customer you go to FDI1, for vendor you go to FKI1 (reports).
    For Customer you go to FDI4, for vendor you go to FKI4 for forms.
    Remaining all are the same.
    Hello,
    Go to transaction code FDI4
    Select Form Type RFFRRD20 Line item analysis
    Give your form name and description
    Structure (Two axis) - as defaulted
    Click on Create
    You will have lead column
    Delete the rows 2, 3 and 4
    Double click on column 1
    Enter the customer numbers from 1 to 999999
    First column double click (A)
    Slelect following values
    Due date analysis 1
    Days for net due date 0 to 30
    Give the short name, medium name and long text for the column.
    Repeat this step in next columns like 31 to 60, 61 to 90, 91 to 120 and 121 to 99999 days etc in other columns and select due date analysis 1. (B,C,D,E)
    Create one more column by way of formula. To create a new column you need to double click on blue line. Put formula add all five columns you have created above. (F = ABCDE)
    You prepare one more column with
    Due date analysis 2 (G)
    Now you prepare one more column add (F+G) = This will be total open items = over due and not due.
    Now go to FDI1 and prepare a report - assign the form created in FDI4 to the report.
    Characteristics you need to select are
    Account Type (Select Account Type as D for customers)
    Currency
    Customer
    Document Type
    Special G/L Ind
    Company Code
    Change the output types and options according to your requirement.
    Refer FDI2 and FDI3 for other standard reports created.
    Refer FDI5 and FDI6 for other standard forms created.
    Save your report and execute.
    From there you can put the cursor on customer number and from the menu goto -> line items then it will go for each line item wise..
    Regards,
    Nauma

  • Regarding standard aging reports

    Hi Experts/Gurus
        I need the standard reports for customer aging report and vendor aging report.
    Need immediate replies.
    Your answers can be rewarded with good points.
    Regards,
    kumar

    REPORT  zfi_customer_ageing
            NO STANDARD PAGE HEADING
            LINE-COUNT 58
           line-size 168
            MESSAGE-ID zh_msg.
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: kna1,           " Customer Master (General)
            t001,           " Company Codes
            rfpdo.
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S           *
    Internal Table for Customer Open Items Data
    DATA: BEGIN OF int_bsid OCCURS 0,
            kunnr   LIKE bsid-kunnr,         " Customer Number
            name1   LIKE kna1-name1,         " Customer Name
            shkzg   LIKE bsid-shkzg,         " Dr/Cr Indicator
            belnr   LIKE bsid-belnr,         " Document Number
            xblnr   LIKE bsid-xblnr,         " Ref Doc No
            blart   LIKE bsid-blart,         " Document Type
            zfbdt   LIKE bsid-zfbdt,         " Base Line Date
            zbd1t   LIKE bsid-zbd1t,         " Due date1
            zbd2t   LIKE bsid-zbd2t,         " Due Date2
            zbd3t   LIKE bsid-zbd3t,         " Due Date3
            waers   LIKE bsid-waers,         " Currency
            dmbtr   LIKE bsid-dmbtr,         " Amount in Local Curr
          END OF int_bsid.
    Internal Table for Amounts Sum Up Data
    DATA: BEGIN OF int_final OCCURS 0,
            kunnr   LIKE bsid-kunnr,         " Customer Number
            name1   LIKE kna1-name1,         " Customer Name
            total1  LIKE bsid-dmbtr,         " Amount in Local Curr
            total2  LIKE bsid-dmbtr,         " Amount in Local Curr
            total3  LIKE bsid-dmbtr,         " Amount in Local Curr
            total4  LIKE bsid-dmbtr,         " Amount in Local Curr
            total5  LIKE bsid-dmbtr,         " Amount in Local Curr
            total6  LIKE bsid-dmbtr,         " Amount in Local Curr
            total   LIKE bsid-dmbtr,         " Amount in Local Curr
          END OF int_final.
               D A T A  D E C L A R A T I O N S
    DATA : v_flag,                          " Flag
           v_gtotal1     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal2     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal3     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal4     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal5     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal6     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal      LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal1   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal2   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal3   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal4   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal5   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal6   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal    LIKE bsid-dmbtr,   " Amount Totals
           v_date        LIKE bsid-zfbdt,   " Due Date
           v_tage1(4),                      " Age 30 days
           v_tage2(4),                      " Age 60 days
           v_tage3(4),                      " Age 90 days
           v_fir(15),                       " Column Text1
           v_sec(15),                       " Column Text2
           v_thir(15),                      " Column Text3
           v_four(17),                      " Column Text4
           v_fidd(4),                       " Days field1
           v_sedd(4),                       " Days field2
           v_thdd(4),                       " Days field3
           v_fodd(4),                       " Days field4
           v_str  TYPE  SY-LISEL,           " String
           v_str1(11),                      " String
           v_tage(3),                       " String
           v_date1(10).                     " Date field
         R A N G E   D E C L A R A T I O N S
    RANGES: r_date1 FOR bsid-zfbdt,      " Date Range 1
            r_date2 FOR bsid-zfbdt,      " Date Range 2
            r_date3 FOR bsid-zfbdt,      " Date Range 3
            r_date4 FOR bsid-zfbdt.      " Date Range 4
             S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_kunnr FOR kna1-kunnr. "Customer account
    PARAMETERS:     p_bukrs LIKE t001-bukrs. "Co. Code
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS:   p_allgst LIKE rfpdo-allgstid OBLIGATORY DEFAULT sy-datum.
    "Open items at key date
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS: p_tage1 LIKE rfpdo1-allgfael DEFAULT '30',
                p_tage2 LIKE rfpdo1-allgfael DEFAULT '60',
                p_tage3 LIKE rfpdo1-allgfael DEFAULT '90',
                p_tage4 LIKE rfpdo1-allgfael DEFAULT '120'.
    SELECTION-SCREEN END OF BLOCK b3.
                  A T  S E L E C T I O N  S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_flds.
                   S T A R T  O F  S E L E C T I O N                    *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                           T O P  O F  P A G E
    Header
    TOP-OF-PAGE.
      PERFORM header.
                           E N D  O F  P A G E
    Footer
    END-OF-PAGE.
      ULINE.
       T O P  O F  P A G E  D U R I N G  L I N E  S E L E C T I O N     *
    Top of Page in Secondary List
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM header1.
                  A T  L I N E  S E L E C T I O N                    *
    AT LINE-SELECTION.
    Perform Line Selections
      PERFORM line_selection.
                     E N D  O F  S E L E C T I O N
    END-OF-SELECTION.
    List generation
      PERFORM basic_list.
    *&      Form  validate_flds
    Validation of Selection Screen fields
    FORM validate_flds .
    Validate Customer Code
      CLEAR kna1-kunnr.
      SELECT kunnr UP TO 1 ROWS
          INTO kna1-kunnr
          FROM kna1
          WHERE kunnr IN s_kunnr AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH 'Invalid Customer Code range'(023).
      ENDIF.
    Validate Company Code
      CLEAR t001-bukrs.
      SELECT bukrs  UP TO 1 ROWS
          INTO t001-bukrs
          FROM t001
          WHERE bukrs =  p_bukrs AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e021.      " Invalid Company Code range
      ENDIF.
      IF ( p_tage1 > p_tage2 ) OR ( p_tage1 > p_tage3 ) OR
          ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 1 greater'(004)
                    'than Column# 2 or 3 or 4'(005).
      ENDIF.
    *column 2
      IF ( p_tage2 > p_tage3 ) OR ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 2 greater'(006)
                    'than Column# 3 or 4'(007).
      ENDIF.
    *column3
      IF ( p_tage3 > p_tage4 ).
        MESSAGE e999 WITH 'Column 3 greater'(008)
                    'than Column#4'(009).
      ENDIF.
    ENDFORM.                    " validate_flds
    *&      Form  fetch_data
    Fetching Data from Database Tables
    FORM fetch_data .
    Date Range Population
      r_date1-sign   = 'I'.
      r_date1-option = 'BT'.
      r_date1-low    = p_allgst.
      r_date1-high    = r_date1-low + p_tage1.
      APPEND r_date1.
      r_date2-sign   = 'I'.
      r_date2-option = 'BT'.
      r_date2-low    =  r_date1-high + 1.
      r_date2-high    = r_date1-low + p_tage2.
      APPEND r_date2.
      r_date3-sign   = 'I'.
      r_date3-option = 'BT'.
      r_date3-low    = r_date2-high + 1.
      r_date3-high    = r_date1-low + p_tage3.
      APPEND r_date3.
      r_date4-sign   = 'I'.
      r_date4-option = 'BT'.
      r_date4-low    = r_date3-high + 1.
      r_date4-high    = r_date1-low + p_tage4.
      APPEND r_date4.
    Select the Customer Open Items data from bsid
      SELECT l~kunnr
             l1~name1
             b~waers
             b~dmbtr
             b~zfbdt
             b~zbd1t
             b~zbd2t
             b~zbd3t
             b~belnr
             b~xblnr
             b~shkzg
             b~blart
       INTO CORRESPONDING FIELDS OF TABLE int_bsid
       FROM knb1 AS l INNER JOIN kna1 AS l1
                    ON lkunnr  = l1kunnr
           INNER JOIN   bsid AS b
             ON lkunnr  = bkunnr AND
                lbukrs  = bbukrs
             WHERE l~kunnr  IN s_kunnr AND
                   l~bukrs = p_bukrs and
                   b~zfbdt le p_allgst.
      IF SY-SUBRC <> 0.
        MESSAGE i000 WITH 'No Data found'(027).
      ENDIF.
    Removing the date limit to get the due items in the past
      DELETE int_bsid WHERE
                  ( blart  NE 'RE' AND blart  NE 'KR' ) OR
                    shkzg  NE 'H'.
      SORT int_bsid BY kunnr.
    ENDFORM.                    " fetch_data
    *&      Form  header
    Display the Report Columns
    FORM header .
      v_tage1 = p_tage1 + 1.
      v_tage2 = p_tage2 + 1.
      v_tage3 = p_tage3 + 1.
      v_fidd = p_tage1.
      v_sedd = p_tage2.
      v_thdd = p_tage3.
      v_fodd = p_tage4.
      MOVE v_fodd0(4) TO v_fodd1(3).
      v_fodd+0(1) = space.
      CONCATENATE '1 to'(010) v_fidd INTO v_fir.
      CONCATENATE v_tage1 ' to '(011) v_sedd INTO v_sec.
      CONCATENATE v_tage2 ' to '(011) v_thdd INTO v_thir.
      CONCATENATE v_tage3 ' to '(011) space v_fodd INTO v_four.
    Standard header
      clear: v_date1, v_str, v_str1, v_tage.
      write p_allgst to v_date1.
      Move  p_tage4 to v_tage.
      concatenate '>' v_tage text-025 into v_str1.
      concatenate
      'Summary of Ageing Analysis for Customer Open Invoices as on'(013)
       v_date1 into v_str separated by space.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR OFF.
      WRITE  : /1(168) sy-uline.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1 sy-vline, 13 sy-vline, 49 sy-vline,
            50(101) 'Invoices Due For(In Days)'(014) CENTERED,
           151 sy-vline, 168 sy-vline .
      WRITE :/1 sy-vline,  2(11)  'Customer#'(015) CENTERED,
             13 sy-vline ,14(35) 'Customer Name'(016) CENTERED,
             49 sy-vline,
             50(101) sy-uline,151 sy-vline,
            152(16) 'Total'(017) CENTERED,
            168 sy-vline.
      WRITE : /1 sy-vline,13 sy-vline,      49 sy-vline,
              50(16) v_fir CENTERED,        66 sy-vline,
              67(16) v_sec CENTERED,        83 sy-vline,
              84(16) v_thir CENTERED,      100 sy-vline,
             101(16) v_four CENTERED,      117 sy-vline,
             118(16) v_str1 centered,      134 sy-vline,
             135(16) 'Already Overdue'(018) CENTERED,151 sy-vline,
             168 sy-vline.
      FORMAT COLOR OFF.
      WRITE  : /1(168) sy-uline.
    ENDFORM.                    " header
    *&      Form  basic_list
    Display the Basic List
    FORM basic_list .
      NEW-PAGE LINE-SIZE 168.
      LOOP AT int_bsid.
        CLEAR v_date.
        IF int_bsid-zbd3t <> ' '.
          v_date = int_bsid-zfbdt + int_bsid-zbd3t.
        ELSE.
          IF int_bsid-zbd2t <> ' '.
            v_date = int_bsid-zfbdt + int_bsid-zbd2t.
          ELSE.
            v_date = int_bsid-zfbdt + int_bsid-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsid-zbd1t = ' '.
          v_date = int_bsid-zfbdt.
        ENDIF.
        IF v_date IN r_date1.
          int_final-total1 =   int_final-total1 +  int_bsid-dmbtr.
        ELSEIF v_date IN r_date2.
          int_final-total2 =   int_final-total2 +  int_bsid-dmbtr.
        ELSEIF v_date IN r_date3.
          int_final-total3 =   int_final-total3 +  int_bsid-dmbtr.
        ELSEIF v_date IN r_date4.
          int_final-total4 =   int_final-total4 +  int_bsid-dmbtr.
        ELSEif v_date > r_date4-high.
          int_final-total5 =   int_final-total5 +  int_bsid-dmbtr.
        ELSEif v_date < p_allgst.
          int_final-total6 =   int_final-total6 +  int_bsid-dmbtr.
        ENDIF.
        AT END OF kunnr.
          v_flag = 1.
        ENDAT.
        IF v_flag = 1.
          int_final-kunnr = int_bsid-kunnr.
          int_final-name1 = int_bsid-name1.
          int_final-total =   int_final-total1 + int_final-total2 +
           int_final-total3 + int_final-total4 + int_final-total5 +
           int_final-total6.
          APPEND int_final.
          v_gtotal1 = v_gtotal1 + int_final-total1.
          v_gtotal2 = v_gtotal2 + int_final-total2.
          v_gtotal3 = v_gtotal3 + int_final-total3.
          v_gtotal4 = v_gtotal4 + int_final-total4.
          v_gtotal5 = v_gtotal5 + int_final-total5.
          v_gtotal6 = v_gtotal6 + int_final-total6.
          v_gtotal = v_gtotal + int_final-total.
          WRITE: /1 sy-vline,
                  2 int_final-kunnr COLOR 4 INTENSIFIED ON,
                 13 sy-vline,
                 14 int_final-name1 COLOR 4 INTENSIFIED ON,
                 49 sy-vline.
          DATA : v_rem.
          v_rem = sy-tabix MOD 2.
          IF v_rem NE 0.
            FORMAT COLOR 2 INTENSIFIED.
            WRITE :    50 int_final-total1 CURRENCY int_bsid-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsid-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsid-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsid-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsid-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsid-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsid-waers,
                      168 sy-vline.
          ELSE.
            WRITE :    50 int_final-total1 CURRENCY int_bsid-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsid-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsid-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsid-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsid-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsid-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsid-waers,
                      168 sy-vline.
          ENDIF.
          FORMAT COLOR OFF.
          HIDE int_final.
          CLEAR int_final.
          v_flag = 0.
        ENDIF.
        AT LAST.
          WRITE  : /1(168) sy-uline.
          FORMAT COLOR 3 INTENSIFIED.
          WRITE : /1 sy-vline,  2(47) 'GRAND TOTAL'(022) CENTERED,
                  49 sy-vline, 50 v_gtotal1 CURRENCY int_bsid-waers,
                  66 sy-vline, 67 v_gtotal2 CURRENCY int_bsid-waers,
                  83 sy-vline, 84 v_gtotal3 CURRENCY int_bsid-waers,
                 100 sy-vline,101 v_gtotal4 CURRENCY int_bsid-waers,
                 117 sy-vline,118 v_gtotal5 CURRENCY int_bsid-waers,
                 134 sy-vline,135 v_gtotal6 CURRENCY int_bsid-waers,
                 151 sy-vline,152 v_gtotal CURRENCY int_bsid-waers,
                 168 sy-vline.
          HIDE :  v_gtotal1,
                  v_gtotal2,
                  v_gtotal3,
                  v_gtotal4,
                  v_gtotal5,
                  v_gtotal6,
                  v_gtotal.
        ENDAT.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE  : /1(168) sy-uline.
    ENDFORM.                    " basic_list
    *&      Form  line_selection
    When double clicked on the line display the seconday list
    FORM line_selection .
      NEW-PAGE LINE-SIZE 206.
    Sy-lsind = 1.
      DATA : v_rem,v_cnt LIKE sy-tabix.
      v_cnt = 0.
      SORT int_bsid BY belnr zfbdt.
      LOOP AT int_bsid WHERE kunnr EQ int_final-kunnr.
        v_rem = v_cnt MOD 2.
        CLEAR v_date.
        IF int_bsid-zbd3t <> ' '.
          v_date = int_bsid-zfbdt + int_bsid-zbd3t.
        ELSE.
          IF int_bsid-zbd2t <> ' '.
            v_date = int_bsid-zfbdt + int_bsid-zbd2t.
          ELSE.
            v_date = int_bsid-zfbdt + int_bsid-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsid-zbd1t = ' '.
          v_date = int_bsid-zfbdt.
        ENDIF.
        IF v_rem NE 0.
          format color 2 intensified.
          WRITE :/1 sy-vline, 2 int_bsid-belnr,
                 12 sy-vline,13 int_bsid-kunnr,
                 23 sy-vline,24 int_bsid-name1,
                 59 sy-vline,60 int_bsid-xblnr,
                 76 sy-vline,77 int_bsid-zfbdt,
                 87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
                  138 sy-vline,155 sy-vline,
                  172 sy-vline, 189 sy-vline,
                  190 int_bsid-dmbtr CURRENCY int_bsid-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsid-dmbtr.
            WRITE : 88 int_bsid-dmbtr  CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsid-dmbtr.
            WRITE : 105 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsid-dmbtr.
            WRITE : 122 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsid-dmbtr.
            WRITE : 139 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsid-dmbtr.
            WRITE : 156 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsid-dmbtr.
            WRITE : 173 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ENDIF.
          format color off.
        ELSE.
          WRITE :/1 sy-vline, 2 int_bsid-belnr,
                 12 sy-vline,13 int_bsid-kunnr,
                 23 sy-vline,24 int_bsid-name1,
                 59 sy-vline,60 int_bsid-xblnr,
                 76 sy-vline,77 int_bsid-zfbdt,
                 87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
                  138 sy-vline,155 sy-vline,
                  172 sy-vline,189 sy-vline,
                  190 int_bsid-dmbtr CURRENCY int_bsid-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsid-dmbtr.
            WRITE : 88 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsid-dmbtr.
            WRITE : 105 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsid-dmbtr.
            WRITE : 122 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsid-dmbtr.
            WRITE : 139 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsid-dmbtr.
            WRITE : 156 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsid-dmbtr.
            WRITE : 173 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ENDIF.
        ENDIF.
        FORMAT COLOR OFF.
        v_cnt = v_cnt + 1.
      ENDLOOP.
      WRITE : /1(206) sy-uline.
      v_subtotal = v_subtotal1 + v_subtotal2 + v_subtotal3
                  + v_subtotal4 + v_subtotal5 + v_subtotal6.
      FORMAT COLOR 3 INTENSIFIED.
      WRITE : /1 sy-vline,
                 2(85) 'Total'(017) CENTERED CURRENCY int_bsid-waers ,
                 87 sy-vline,
                 88 v_subtotal1 CURRENCY int_bsid-waers,
                104 sy-vline,
                105 v_subtotal2 CURRENCY int_bsid-waers,
                121 sy-vline,
                122 v_subtotal3 CURRENCY int_bsid-waers,
                138 sy-vline,
                139 v_subtotal4 CURRENCY int_bsid-waers,
                155 sy-vline,
                156 v_subtotal5 CURRENCY int_bsid-waers,
                172 sy-vline,
                173 v_subtotal6 CURRENCY int_bsid-waers,
                189 sy-vline,
                190 v_subtotal CURRENCY int_bsid-waers,
                206 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(206) sy-uline.
      CLEAR : v_subtotal,v_subtotal1,v_subtotal2,v_subtotal3,
              v_subtotal4,v_subtotal5,v_gtotal1,v_gtotal2,v_gtotal3,
              v_gtotal4, v_gtotal5,v_gtotal,v_subtotal6,v_gtotal6.
    ENDFORM.                    " line_selection
    *&      Form  header1
    Secondary List Header
    FORM header1 .
    Standard header
      clear: v_date1, v_str, v_str1, v_tage.
      write p_allgst to v_date1.
      Move  p_tage4 to v_tage.
      concatenate '>' v_tage text-025 into v_str1.
      concatenate
       'Details of Ageing Analysis for Customer Open Invoices as on'(024)
        v_date1 into v_str separated by space.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 =  v_str.
      FORMAT COLOR 1 intensified.
      WRITE  :/1(206) sy-uline.
      WRITE  :/1 sy-vline,12 sy-vline ,
              23 sy-vline,59 sy-vline,76 sy-vline,87 sy-vline,
              88(101) 'Invoices Due For(In Days)'(014) CENTERED,
             189 sy-vline,206 sy-vline.
      WRITE  : /1 sy-vline,  2(10) 'Doc Number'(021) CENTERED,
               12 sy-vline, 13(10) 'Customer#'(015) CENTERED,
               23 sy-vline, 24(35) 'Customer Name'(016) CENTERED,
               59 sy-vline, 60(16) 'Ref invoice#'(019) CENTERED,
               76 sy-vline, 77(10) 'Inv dt'(020) CENTERED,
               87 sy-vline, 88(101) sy-uline,
              189 sy-vline,190(16) 'Total'(017) CENTERED,
              206 sy-vline.
      WRITE : /1 sy-vline, 12 sy-vline,
               23 sy-vline,59 sy-vline,
               76 sy-vline,87 sy-vline,
               88(16) v_fir CENTERED, 104 sy-vline,
              105(16) v_sec CENTERED, 121 sy-vline,
              122(16) v_thir CENTERED, 138 sy-vline,
              139(16) v_four CENTERED, 155 sy-vline,
              156(16) v_str1 CENTERED,
              172    sy-vline,
              173(16) 'Already Overdue'(018) CENTERED,
              189 sy-vline,
              206 sy-vline.
              format color off.
      WRITE  : /1(206) sy-uline.
    ENDFORM.                                                    " header1
    REPORT  zfi_vendor_ageing
            NO STANDARD PAGE HEADING
            LINE-COUNT 58
           line-size 168
            MESSAGE-ID zh_msg.
    Report Name : Vendor Open Items Ageing Report
    Purpose     : This report displays the Vendor Open Items based on
                   different Ageing days (Calculated by taking the Base
                   Line date and the days mentioned in Payment Terms)
    M O D I F I C A T I O N    L O G
    Date       | Change Number | Initials      | Description
    30-Aug-2004 | DTSK900****   | Anji Reddy    | Initial
           D A T A B A S E  T A B L E S   D E C L A R A T I O N
    TABLES: lfa1,           " Vendor Master (General)
            t001,           " Company Codes
            rfpdo.
         I N T E R N A L  T A B L E S  D E C L A R A T I O N S           *
    Internal Table for Vendor Open Items Data
    DATA: BEGIN OF int_bsik OCCURS 0,
            lifnr   LIKE bsik-lifnr,         " Vendor Number
            name1   LIKE lfa1-name1,         " Vendor Name
            shkzg   LIKE bsik-shkzg,         " Dr/Cr Indicator
            belnr   LIKE bsik-belnr,         " Document Number
            xblnr   LIKE bsik-xblnr,         " Ref Doc No
            blart   LIKE bsik-blart,         " Document Type
            zfbdt   LIKE bsik-zfbdt,         " Base Line Date
            zbd1t   LIKE bsik-zbd1t,         " Due date1
            zbd2t   LIKE bsik-zbd2t,         " Due Date2
            zbd3t   LIKE bsik-zbd3t,         " Due Date3
            waers   LIKE bsik-waers,         " Currency
            dmbtr   LIKE bsik-dmbtr,         " Amount in Local Curr
          END OF int_bsik.
    Internal Table for Amounts Sum Up Data
    DATA: BEGIN OF int_final OCCURS 0,
            lifnr   LIKE bsik-lifnr,         " Vendor Number
            name1   LIKE lfa1-name1,         " Vendor Name
            total1  LIKE bsik-dmbtr,         " Amount in Local Curr
            total2  LIKE bsik-dmbtr,         " Amount in Local Curr
            total3  LIKE bsik-dmbtr,         " Amount in Local Curr
            total4  LIKE bsik-dmbtr,         " Amount in Local Curr
            total5  LIKE bsik-dmbtr,         " Amount in Local Curr
            total6  LIKE bsik-dmbtr,         " Amount in Local Curr
            total   LIKE bsik-dmbtr,         " Amount in Local Curr
          END OF int_final.
               D A T A  D E C L A R A T I O N S
    DATA : v_flag,                          " Flag
           v_gtotal1     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal2     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal3     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal4     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal5     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal6     LIKE bsik-dmbtr,   " Amount Totals
           v_gtotal      LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal1   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal2   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal3   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal4   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal5   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal6   LIKE bsik-dmbtr,   " Amount Totals
           v_subtotal    LIKE bsik-dmbtr,   " Amount Totals
           v_date        LIKE bsik-zfbdt,   " Due Date
           v_tage1(4),                      " Age 30 days
           v_tage2(4),                      " Age 60 days
           v_tage3(4),                      " Age 90 days
           v_fir(15),                       " Column Text1
           v_sec(15),                       " Column Text2
           v_thir(15),                      " Column Text3
           v_four(17),                      " Column Text4
           v_fidd(4),                       " Days field1
           v_sedd(4),                       " Days field2
           v_thdd(4),                       " Days field3
           v_fodd(4),                       " Days field4
           v_str  TYPE  SY-LISEL,           " String
           v_str1(11),                      " String
           v_tage(3),                       " String
           v_date1(10).                     " Date field
         R A N G E   D E C L A R A T I O N S
    RANGES: r_date1 FOR bsik-zfbdt,      " Date Range 1
            r_date2 FOR bsik-zfbdt,      " Date Range 2
            r_date3 FOR bsik-zfbdt,      " Date Range 3
            r_date4 FOR bsik-zfbdt.      " Date Range 4
             S E L E C T I O N  S C R E E N                      *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr. "Vendor account
    PARAMETERS:     p_bukrs LIKE t001-bukrs. "Co. Code
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS:   p_allgst LIKE rfpdo-allgstid OBLIGATORY DEFAULT sy-datum.
    "Open items at key date
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS: p_tage1 LIKE rfpdo1-allgfael DEFAULT '30',
                p_tage2 LIKE rfpdo1-allgfael DEFAULT '60',
                p_tage3 LIKE rfpdo1-allgfael DEFAULT '90',
                p_tage4 LIKE rfpdo1-allgfael DEFAULT '120'.
    SELECTION-SCREEN END OF BLOCK b3.
                  A T  S E L E C T I O N  S C R E E N                   *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_flds.
                   S T A R T  O F  S E L E C T I O N                    *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
                           T O P  O F  P A G E
    Header
    TOP-OF-PAGE.
      PERFORM header.
                           E N D  O F  P A G E
    Footer
    END-OF-PAGE.
      ULINE.
       T O P  O F  P A G E  D U R I N G  L I N E  S E L E C T I O N     *
    Top of Page in Secondary List
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM header1.
                  A T  L I N E  S E L E C T I O N                    *
    AT LINE-SELECTION.
    Perform Line Selections
      PERFORM line_selection.
                     E N D  O F  S E L E C T I O N
    END-OF-SELECTION.
    List generation
      PERFORM basic_list.
    *&      Form  validate_flds
    Validation of Selection Screen fields
    FORM validate_flds .
    Validate Vendor Code
      CLEAR lfa1-lifnr.
      SELECT lifnr UP TO 1 ROWS
          INTO lfa1-lifnr
          FROM lfa1
          WHERE lifnr IN s_lifnr AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH 'Invalid Vendor Code range'(023).
      ENDIF.
    Validate Company Code
      CLEAR t001-bukrs.
      SELECT bukrs  UP TO 1 ROWS
          INTO t001-bukrs
          FROM t001
          WHERE bukrs =  p_bukrs AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e021.      " Invalid Company Code range
      ENDIF.
      IF ( p_tage1 > p_tage2 ) OR ( p_tage1 > p_tage3 ) OR
          ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 1 greater'(004)
                    'than Column# 2 or 3 or 4'(005).
      ENDIF.
    *column 2
      IF ( p_tage2 > p_tage3 ) OR ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 2 greater'(006)
                    'than Column# 3 or 4'(007).
      ENDIF.
    *column3
      IF ( p_tage3 > p_tage4 ).
        MESSAGE e999 WITH 'Column 3 greater'(008)
                    'than Column#4'(009).
      ENDIF.
    ENDFORM.                    " validate_flds
    *&      Form  fetch_data
    Fetching Data from Database Tables
    FORM fetch_data .
    Date Range Population
      r_date1-sign   = 'I'.
      r_date1-option = 'BT'.
      r_date1-low    = p_allgst.
      r_date1-high    = r_date1-low + p_tage1.
      APPEND r_date1.
      r_date2-sign   = 'I'.
      r_date2-option = 'BT'.
      r_date2-low    =  r_date1-high + 1.
      r_date2-high    = r_date1-low + p_tage2.
      APPEND r_date2.
      r_date3-sign   = 'I'.
      r_date3-option = 'BT'.
      r_date3-low    = r_date2-high + 1.
      r_date3-high    = r_date1-low + p_tage3.
      APPEND r_date3.
      r_date4-sign   = 'I'.
      r_date4-option = 'BT'.
      r_date4-low    = r_date3-high + 1.
      r_date4-high    = r_date1-low + p_tage4.
      APPEND r_date4.
    Select the Vendor Open Items data from BSIK
      SELECT l~lifnr
             l1~name1
             b~waers
             b~dmbtr
             b~zfbdt
             b~zbd1t
             b~zbd2t
             b~zbd3t
             b~belnr
             b~xblnr
             b~shkzg
             b~blart
       INTO CORRESPONDING FIELDS OF TABLE int_bsik
       FROM lfb1 AS l INNER JOIN lfa1 AS l1
                    ON llifnr  = l1lifnr
           INNER JOIN   bsik AS b
             ON llifnr  = blifnr AND
                lbukrs  = bbukrs
             WHERE l~lifnr  IN s_lifnr AND
                   l~bukrs = p_bukrs and
                   b~zfbdt le p_allgst.
      IF SY-SUBRC <> 0.
        MESSAGE i000 WITH 'No Data found'(027).
      ENDIF.
    Removing the date limit to get the due items in the past
      DELETE int_bsik WHERE
                  ( blart  NE 'RE' AND blart  NE 'KR' ) OR
                    shkzg  NE 'H'.
      SORT int_bsik BY lifnr.
    ENDFORM.                    " fetch_data
    *&      Form  header
    Display the Report Columns
    FORM header .
      v_tage1 = p_tage1 + 1.
      v_tage2 = p_tage2 + 1.
      v_tage3 = p_tage3 + 1.
      v_fidd = p_tage1.
      v_sedd = p_tage2.
      v_thdd = p_tage3.
      v_fodd = p_tage4.
      MOVE v_fodd0(4) TO v_fodd1(3).
      v_fodd+0(1) = space.
      CONCATENATE '1 to'(010) v_fidd INTO v_fir.
      CONCATENATE v_tage1 ' to '(011) v_sedd INTO v_sec.
      CONCATENATE v_tage2 ' to '(011) v_thdd INTO v_thir.
      CONCATENATE v_tage3 ' to '(011) space v_fodd INTO v_four.
    Standard header
      clear: v_date1, v_str, v_str1, v_tage.
      write p_allgst to v_date1.
      Move  p_tage4 to v_tage.
      concatenate '>' v_tage text-025 into v_str1.
      concatenate
      'Summary of Ageing Analysis for Vendor Open Invoices as on'(013)
       v_date1 into v_str separated by space.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR OFF.
      WRITE  : /1(168) sy-uline.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1 sy-vline, 13 sy-vline, 49 sy-vline,
            50(101) 'Invoices Due For(In Days)'(014) CENTERED,
           151 sy-vline, 168 sy-vline .
      WRITE :/1 sy-vline,  2(11)  'Vendor#'(015) CENTERED,
             13 sy-vline ,14(35) 'Vendor Name'(016) CENTERED,
             49 sy-vline,
             50(101) sy-uline,151 sy-vline,
            152(16) 'Total'(017) CENTERED,
            168 sy-vline.
      WRITE : /1 sy-vline,13 sy-vline,      49 sy-vline,
              50(16) v_fir CENTERED,        66 sy-vline,
              67(16) v_sec CENTERED,        83 sy-vline,
              84(16) v_thir CENTERED,      100 sy-vline,
             101(16) v_four CENTERED,      117 sy-vline,
             118(16) v_str1 centered,      134 sy-vline,
             135(16) 'Already Overdue'(018) CENTERED,151 sy-vline,
             168 sy-vline.
      FORMAT COLOR OFF.
      WRITE  : /1(168) sy-uline.
    ENDFORM.                    " header
    *&      Form  basic_list
    Display the Basic List
    FORM basic_list .
      NEW-PAGE LINE-SIZE 168.
      LOOP AT int_bsik.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_date IN r_date1.
          int_final-total1 =   int_final-total1 +  int_bsik-dmbtr.
        ELSEIF v_date IN r_date2.
          int_final-total2 =   int_final-total2 +  int_bsik-dmbtr.
        ELSEIF v_date IN r_date3.
          int_final-total3 =   int_final-total3 +  int_bsik-dmbtr.
        ELSEIF v_date IN r_date4.
          int_final-total4 =   int_final-total4 +  int_bsik-dmbtr.
        ELSEif v_date > r_date4-high.
          int_final-total5 =   int_final-total5 +  int_bsik-dmbtr.
        ELSEif v_date < p_allgst.
          int_final-total6 =   int_final-total6 +  int_bsik-dmbtr.
        ENDIF.
        AT END OF lifnr.
          v_flag = 1.
        ENDAT.
        IF v_flag = 1.
          int_final-lifnr = int_bsik-lifnr.
          int_final-name1 = int_bsik-name1.
          int_final-total =   int_final-total1 + int_final-total2 +
           int_final-total3 + int_final-total4 + int_final-total5 +
           int_final-total6.
          APPEND int_final.
          v_gtotal1 = v_gtotal1 + int_final-total1.
          v_gtotal2 = v_gtotal2 + int_final-total2.
          v_gtotal3 = v_gtotal3 + int_final-total3.
          v_gtotal4 = v_gtotal4 + int_final-total4.
          v_gtotal5 = v_gtotal5 + int_final-total5.
          v_gtotal6 = v_gtotal6 + int_final-total6.
          v_gtotal = v_gtotal + int_final-total.
          WRITE: /1 sy-vline,
                  2 int_final-lifnr COLOR 4 INTENSIFIED ON,
                 13 sy-vline,
                 14 int_final-name1 COLOR 4 INTENSIFIED ON,
                 49 sy-vline.
          DATA : v_rem.
          v_rem = sy-tabix MOD 2.
          IF v_rem NE 0.
            FORMAT COLOR 2 INTENSIFIED.
            WRITE :    50 int_final-total1 CURRENCY int_bsik-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsik-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsik-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsik-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsik-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsik-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsik-waers,
                      168 sy-vline.
          ELSE.
            WRITE :    50 int_final-total1 CURRENCY int_bsik-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsik-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsik-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsik-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsik-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsik-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsik-waers,
                      168 sy-vline.
          ENDIF.
          FORMAT COLOR OFF.
          HIDE int_final.
          CLEAR int_final.
          v_flag = 0.
        ENDIF.

  • Vendor Ref. no. not displayed in print preview in vendor aging report

    Dear SAP team,
    Vendor reference number is not displayed in print preview/print on vendor liabliteis aging report,
    but this vendor reference number actually show in report,We are taking report by journal postings,
    vendor reference entered in NumAtCard in AP invoice get copied to Ref2 in Journal Entry,then
    why it is not showing in print preview/print.
    Whether this is an application error / missing functionality ?
    We are using SAP Business One 2005 B (7.40.252)  SP: 00  PL: 36.
    Whether upgrade to latest patch 2005B PL46 will solve this issue ?
    Jeyakanthan

    Hello Jeyakanthan,
    I would like to draw your attention to the enhancements we delivered within Aging Report in 2007 version and plan for 8.8 release.
    The primary enhancement in 2007 version is reflecting new concept of Internal Reconciliation with more convenient backward reporting.
    Within the 8.8 release ...
    - when you generate the aging report you can group the report by customer or sales employee in the customer receivables aging report, and by vendor or buyer in the vendor liabilities aging report;
    - when the aging report has been generated, you can view multicustomer/multivendor detailed information in the aging report window. There is no need to double-click each customer/vendor row to view the details.
    We would strongly to recommend you to upgrade to 2007 version or join the ramp-up of 8.8 release soon.
    Peter Dominik
    B1 Solution Management

  • Material Ageing Report Through ABAP( MC46 Tcode Wise)

    Hi,
    I want to develop report for Material Ageing Report which is similar to the Tcode MC46 but the problem is functional consultant told me about this tcode only and there is no such information regarding the specified tables which are to be used. I had searched in SDN also but i did not got the desired  information.
    Edited by: nav009 on Mar 11, 2010 12:31 PM

    Hi,
    After comparing the tcodes MC46 and MC50,i am able to trace out that data is coming from the MBEW table but the problem is the ageing logic works on As On Date and the data to be *picked Less Than Equal to Posting Date *.
    There is no such field present on which i can made this logic succesful.. i tried to develop the report through different tables also(BSIM,MSEG and MKPF) but the quantites and the amount is coming accurate after comparing it with the above mentioned Tcodes.
    Is there any other table through which this problm can be solved....?
    Edited by: nav009 on Mar 12, 2010 5:42 AM
    Edited by: nav009 on Mar 14, 2010 12:21 PM

  • Crystal Report A/R Aging

    In Crystal Report A/R Aging Report Detail section, I set the '@Paid' field formula as:
    if {OJDT.TransType} = '13' then
    {JDT1.BalFcDeb} - {JDT1.FCDebit}
    else {jdt1.fccredit} - {jdt1.balfccred}
    In Group Footer #1 (Group: OCRD: CardName), I set up '@Paid2' using formula :
    {OCRD.BalanceFC} - sum({OJDT.FcTotal}) - {@Paid}
    Group Footer #2 (Group: OCRD: CardName), '@TotalPaid'  is the sum of the above two (@Paid + @Paid2) .
    In Page Footer, I need the grand total of 'TotalPaid'. I used the following formula:
    whileprintingrecords;
    global numbervar GTotal:=Sum({@TotalPaid});
    It gave me error message, 'the above cannot be summarized'. How do I fix the grand total field? Thanks.

    Hi,
    Token may only be used for key column. Your definition of the token would not be accepted by system.
    Thanks,
    Gordon

  • T code for sales ageing report plant wise

    Is there any standard report to sales ageing report plant wise & material wise. Pls guide me with the

    Hi Amit,
    based on your configuration, the following standard reports can be usefull
    S_ALR_87012168- Due date analysis for open items
    S_ALR_87012178-Customer open items analysis by balance of overdue items
    S_ALR_87012174- List of customer open items
    S_ALR_87012175-Open items customer due date forecast
    Hope this helps
    Thanks
    Akash

  • Ar Aging Report based on transaction lines

    Hi all,
    I am trying to write a query to calculate aging report at line level. The user needs a query which calculates the aging value at at line level because the ra_customer_trx_lines_all has attribute1 populated with a value from (A,B,C,D).I need get the aging value for each group(attribute).
    select sum(nvl(lines.line_recoverable,0)+nvl(adj.adj_amt,0)-nvl(rec.rec_amt,0)),lines.attribute1
    from ra_customer_trx_lines_all lines,
    (select CUSTOMER_TRX_LINE_ID trx_line,
    sum(amount) adj_amt
    from ar_adjustments_all
    where status = 'A'
    group by CUSTOMER_TRX_LINE_ID) adj
    ,(select REF_CUSTOMER_TRX_LINE_ID trx_line,
    sum(nvl(amount_cr,0))-sum(nvl(amount_dr,0)) rec_amt
    from ar_distributions_all
    where source_table='RA'
    and source_type='REC'
    group by ref_customer_trx_line_id) rec
    where lines.CUSTOMER_TRX_LINE_ID=adj.trx_line(+)
    and lines.CUSTOMER_TRX_LINE_ID=rec.trx_line(+)
    and lines.customer_trx_line_id in ('18293')
    group by lines.attribute1
    Also I dint yet add the as of date parameter.I suppose the tables have to change in that case.Can any one help me with that tooo.
    The above query kinda generated the value I was looking for.But when I ran the query for just a few more lines included.The query took forever to run.
    Can you please help me on this ASAP.
    Thanks for all your tips in advance.
    Mach
    Edited by: krismach_85 on Oct 27, 2009 8:38 AM

    Hi,
    You can run the Transaction Register report for specific Transaction reason/ a range and see the related material transactions.
    Karthik.

  • Aging reports that display reconciled transactions

    Currently ie 2007a PL 35, when an aging report is run that displays reconciled transactions it is displaying all reconciled transactions including those reconciled before the aging date. My understanding of this feature was that it was intended to allow clients to run past dated aging correctly and for totals it does. However I have a client who works with detailed aging extensively and they would like a feature that would allow an aging report that would only show open balances that had been reconciled after the aging date. would it be possible to implement this into the current aging selection criteria?? It would help clients produce more accurate historical aging reports.
    Regards,
    John-Michael

    Which SAP B1 Version and Patch is under use at your end ?
    There were issues in SAP B1 regarding reconcilliations in versions prior to 2007 series.
    Samir Gandhi

Maybe you are looking for