Ageing report-Days range as an I/p

Based on posting date we designed an Ageing report
0  30  60  90  120  ....
now users want day range as an i/p
means => user will i/p day range say 40 then report will be executed for 0  40  80  120 .....
if i/p for day range is 60 then 0  60  120  180 ......
previously we resticted the key figure by posting date variable by settng the offset range
like RFK1--- 0balance restricted by var (0-30)
      RKF2--- 0balance restricted by var (31-60) and so on...
before we were able to hardcore it but with the current requirment we have to take user i/p var and then accordingly ageing report will be generated..
pl let us know the right way

okay...
we have created one char : ZOFFSET (no of days) and included in the target on which ageing report is based on...,,,, after that we crearted a user exit variable Zvar_offset(ready for i/p) on char ZOFFSET.....
In ZXRSRU01,
when zpost_dt  {zpost_dt is the user exit variable ,ready for i/p,defined for posting date}
if i_step = 1
date_low = zpost_dt.
date_high = zpost_dt - Zvar_offset. {not sure whether this logic will work or not!!!}
CLEAR L_S_RANGE.
L_S_RANGE-LOW  = date_low.
L_S_RANGE-high  = date_high.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT  = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
even after this we cant achieve the motive, as zpost_dt will have range value high and low after user exit execution  but in our query its a single value i/p (user will give only one posting date) ,,,
also what abt other buckets (other ranges for the same offset) because code will return only one range however we want more ranges for different intervals

Similar Messages

  • AP Aging report day by day

    Hi,
    Can some one help me with below query.
    Posting Date,  Doc #,  Doc Status (Open Olny), Card Code, Card Name,  Supplier ref. No, Doc Total, Total Paid, Balance Due, Today due, tomorrow due, day after tomorrow, like same till month end. (for salected period) (T0.[DocDueDate]  >=  [%0] and T0.[DocDueDate] <=[%1]).
    Regards,
    Suresh

    Hi,
    Check this if it helps you for start :
    select t1.docdate As 'Posting Date', t1.DocNum as 'Document #', t1.DocStatus as 'Status',
    t1.CardCode as 'BP Code', t1.cardname as 'BP Name', t1.numatcard as 'Reference Number',
    t1.doctotal as 'Document Total',t1.paidsum as 'Paid Amount',
    t1.DocTotal-t1.PaidSum as 'Balance Due',
    datediff(dd,t1.docdate, getdate())as 'Overduedays'
    from JDT1 T3 inner join OPCH t1 on t3.transid = t1.transid and t3.shortname <> t3.account
    inner join PCH1 t5 on t5.docentry = t1.docentry 
    where t1.DocStatus = 'O' and t3.refdate >= '2011.01.01' and t3.refdate <= '2011.12.31'
    order by datediff(dd,t1.docdate,getdate())
    If you need Overduedays in different column, then you have to check Pivot.
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Variable of No of Days Outstanding in Vendor Liabilities Aging Report

    Dear Experts,
    Which Variable No is use for No of Days Outstanding in Vendor Liabilities Aging Report?
    Thanks,
    Srujal Patel

    Yes I m asking for No of Days Outstanding and I know thats the day.
    But as per My Formula only Days are calculate.
    1. Eg, 10/11/2011 Due Date  14/11/2011 Aging Date
    Result is 4 Days Out Standing thats right.
    But
    2. Eg. 10/09/2011 Due Date 14/11/2011 Aging Date
    Result is 4 Days outstanding thats wrong
    Actual result is 65 Days
    So, which formula I have use in PLD to get proper result

  • Ageing report on over 30 days

    Hi Experts
    How to do the selection for Ageing Report in Over 30days, Over 211 days Above 30 days, Total Over 30 days  explain detailed with offest values.
    Edited by: Sk Babu999 on Dec 29, 2010 2:01 PM

    Hi:
    Take a look at the paper by Surendra Reddy.
    "Calculating the Ageing of the Materials"
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f15839-0cf1-2b10-c6a7-ebe68cc87cdc?quicklink=index&overridelayout=true
    Another example is the paper by Neelesh Kumar Jain.
    "Creating Bucket Scenarios using Exception Aggregation (SAP Netweaver 7.0 BI)"
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c09f49c2-7448-2c10-ac92-d75f263a0dce?quicklink=index&overridelayout=true
    Regards,
    Francisco Milán.

  • POSTING DATE RANGE INCLUDED IN CUSTOMER RECEIVABLE AGEING REPORT PLD

    Dear All,
    Please can you tell me how to print the posting date range selected in the parameter selection for Customer Receivable Ageing Report PLD.
    Thanks
    Gary

    Dear Rahul,
    I know that but it is really painful to develop the whole report in crystal where it is available in SAP itself. Imagine just for one requirement i will have to build the whole report in crystal. I think SAP should give flexibility to change the hard coded reports.
    Regards,
    Gary

  • No. of days outstanding variable in aging report for SAP 8.8

    Hi All,
    Would like to check whether anyone knows what are the variable numbers for 'No of days outstanding' column in aging report? I would like to include this field in the detail aging report print out. Thanks.

    Hi....
    Check this link: [PLD_Variables_8.8|https://websmp105.sap-ag.de/~sapidb/011000358700000449672010E/HowTo_PLD_Variables_88.zip]
    Regards,
    Bala

  • Aging Report, variable for Days Outstanding

    Does anyone know the Variable for the 'No. of Days Outstanding' in the Aging report?
    Thanks,
    Marisa

    Hi Marisa......
    It is Variable No. 40 for no. of Days Outstanding.......
    Hope this will work.....
    Regards,
    Rahul

  • 180 days - customer aging report

    Hi Experts,
    I'm required to revise the Customer Receivable Aging Report from  Business Partners > Business Partner Reports > Aging > Customer Receivable Aging.  the Standard report shows only up to 120+ days.  We require  180+ days.  Could you help me with the work around on this.

    Hi Sachin,
    Could you please send your SQL (and maybe also Crystal Report) for SAP B1 "Customer Aging Report" to me too?
    I am trying to write the SQL which will mimic the SAP B1 standard report, and then add a few more fields because Management wants these.I need to do a lot of Excel gymnastics each time I produce an ageing. I am looking for an SQL Query that will   give the same total as the standard report. It must also list all outstanding invoices individually and their amounts, as well as all other unreconciled items.
    Send me what you have (SQL). I'll try to modify it to suit my requirements. As I'm newbee, it is much easier for me to start from some existing code.
    Thanks a lot
    LEONLAI

  • Open sale order aging report

    Need a report on open order aging.  The open order means not delivered or partially delivered. Further with days range since its open or not fully delievered i.e. > 15 days or 15-30 days and so on.
    The standard transactions Va05 and VL10c can provide the list but dont provide any aging info.
    Kindly help in this.
    thanks
    anu

    Dear Anu
    1. First in VA05 you can use Variants and get the report as desired by you,create one variant and use Filter along with greater then, less then (all are in selection option icon)
    This way you can create three variants.
    But limitation is dates has to be manually changed in variants each time.
    2. Try this Tcodes
    S_ALR_87014387 Display Document Flow
    S_ALR_87014392 Display Document Flow
    This reports will give you document flow run report with ticking checkbox for sales order,delivery and goods isse then after getting the list expand all (Shift+F12)
    you will get the quantities for sales order, and what is delivered and what is issued.
    3. As such if you want exactly the report you can take help of ABAP to create the ALV
    4. Report or create Queries in SQVI , or else create MCSI report
    Regards
    Jitesh

  • Need to convert AP Invoice Aging Report in Excel format

    Hi,
    Need to convert AP Invoice Aging Report in excel format..there was an existing Invoice Aging report in AP and that was in paper format. That we need to convert to rtf template..
    There was an other concurrent program called 'Invoice Aging Report (XML) - Reserveed for future use', when i am using that rtf template..to get the report output it was taking more than 1 hr time.
    1)Is there any way/patch to get that XML report to be used in 12.1.3 EBS version
    2) is there any other way to get the report output faster.
    Thanks..

    Hi,
    When submitting the request, you may change the output to Excel and get the output in Excel. Otherwise as you mention if you getting the output in text format, you may download the text format and open the document in excel and use the delimitation to format in excel as per your requirement.
    1)Is there any way/patch to get that XML report to be used in 12.1.3 EBS version
    2) is there any other way to get the report output faster.
    Is your statistics up to date, when did you last run gather schema statistics program in Sysadmin responsibility.
    Also what is the record quantity that you are expecting here? Is date range parameter available in the report and if yes, did you try running the report for a day to check the output.
    Thanks &
    Best Regards,

  • 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.

  • Aging report from a different base date

    Hi,
    There is a requirement in Aging report. The report should show the the 30, 30-60, 60-90 etc with a different base date/(reference date (OPEN DATE) in stead of the current date. In this case current date should be shown as RUNDATE and there should be one more date field as OPEN DATE  in the page footer.
    Please help me to solve this. Thanks in advance.
    BABASHARI

    Add a parameter for the date that you want to age by.  Use the datediff() function to determine the age of each item in a formula field that uses that age to group items by the range of dates desired (basic syntax):
    dim days as number
    days = datediff("d",{due date}, {?date parameter})
    if days < 31
      formula = "  0 to  30"
    elseif days < 61
      formula = " 31 to  60"
    elseif days < 91
      formula = " 61 to  90"
    elseif days < 121
      formula = " 91 to 120"
    else
      formula = "Over 120"
    end if
    HTH,
    Carl

  • What is an ageing report? What are the data sources used to develop an agin

    Hello BW gurus,
    I was going thru some of the BW resumes. I could not understand some of the points mentioned below. Kindly go thru them and please explain each of it.
    Thank you.
    TR.
    •     Developed AR ageing report, created invoice layout and processed invoices.
    What is an ageing report? What are the data sources used to develop an aging report
    •     Worked on month-end and year end processes such as Balance Sheet Statements and Profit and Loss Accounts. 
    What data sources does one use to get Balance sheet and P&L accounts tables and fields.
    •     Involved in the end to end implementation of BW at Reliance Group as a team member.
    What are the tasks a BW consultant normally performs when he is involved in an end to end implementation project or
    a full life cycle project?
    •     Extensively worked on BW Statistics to optimize the performance of Info Cubes and to create Aggregates.
    What do you mean when you say worked on BW statistics to optimize the performance of Info Cubes.
    What are aggregates why do you need them?
    •     Prepared design documents from the Business Requirement documents and identified the
    relevant data targets for satisfying the customer requirements.
    What are the design documents does one prepare, please give an example. 
    Is cube a data target?

    What is an ageing report? What are the data sources used to develop an aging report
    Aging refers to values in different time period ranges. Example, the customer (credit) aging report can look like this.
    customer (credit)  for current period, 0 to 30 days, 30 to 90 days, 90 to 120 days. This is the way aging is classified.
    What data sources does one use to get Balance sheet and P&L accounts tables and fields.
    For P&L information, you may use 0FI_GL_6 datasource (or 0FI_GL_10 if you use ERP 5.0 version). This datasource reads the same information used in R/3 transaction f.01 (table glt0).
    What are the tasks a BW consultant normally performs when he is involved in an end to end implementation project or a full life cycle project?
    Requirement gathering, blueprint creation, development etc
    Refer to posts on Sap Methodology  and Sap lifecyle
    What do you mean when you say worked on BW statistics to optimize the performance of Info Cubes. What are aggregates why do you need them?
    Please check these links
    http://help.sap.com/saphelp_nw04/helpdata/en/8c/131e3b9f10b904e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/f0/3c8c3bc6b84239e10000000a114084/plain.htm
    What are the design documents does one prepare, please give an example.
    Design document is basically a document to say  how the design is to be developed for a particular solution ex: FI it says what is the data fow and what are the data targets  to be used and how data shld be stored  for providing the client a solution they need.
    Is cube a data target?
    Yes cube is a data target.
    Hope this Helps
    Anand Raj

  • FI-AR Aging Report

    Hi Friends,
    I am working on FI-AR Aging report on 0FIAR_C03 Cube. My BI objects for calculations are:
    0DEB_CRE_DC (KeyFigure)
    0NETDUEDATE (Char)
    When user execute the query, he has to key-in few variables:
    Type-In date (default is today’s date)
    Aging Basket (user configurable 0-30 days, 31-60 days, etc.)
    Calculation needed:
    Current Due Amount = 0DEB_CRE_DC, whenType-In date is greater or equal to Net Due Date
    Past Due Amount = 0DEB_CRE_DC, when Type-In date is less than Net Due Date
    Current and Past Due Amount should be displayed on Aging colums (0-30days, 31-60 days, etc)
    If anyone has done similar queries please help.
    Thank you and regards,
    ~S

    Hi Andor,
    Thank you for quick answer. I understand your explanation well. In fact, I have somewhat different requirements. I have only one date variable (user key-in date, i.e. 0P_KEYDT). I have Aging Basket (YGARCAG1, YGARCAG2, etc. user can input data such as 20 days aging, 60 days aging, 110 days aging etc.)
    0P_KEYDT could be Greater, equal or Less than 0NETDUEDATE.
    If 0P_KEYDT is greater than 0NETDUEDATE, then it is called Past Due Period
    If 0P_KEYDT is less than 0NETDUEDATE, then it is called Current Due Period.
    I have to prepare Account Receivable amount for each customer for each period (i.e. Past Due Period, and Current Due Period, for each Aging Basket Variable (such as "YGARCAG1", "YGARCAG1 to YGARCAG2", "YGARCAG31 to YGARCAG4", etc.)
    It is a complex report.
    =======================
    Another question:
    Can I have two selection variables (range) for 0NETDUEDATE.
    I want to use following two conditions together for 0NETDUEDATE:
    (a)  Between YGARCAG1 and 0PKEYDT+1
    (b)  Greater Than Equal to 0P_KEYDT
    If I SAP BEx allows, two selections for a data, then I think, my query can be built.
    Regards,
    ~S

  • GL Aging report

    Hello everyone,
    I need some clarification on what it means by an Aging report in SAP BW. Is there or can there be such a thing as a "GL Aging report" or are there only AR/AP aging reports? What is the structure of an aging report in terms of report layout (characteristics and key figures)? Are there special formulae? Is the calculation done at report level or at cube level? I have searched quite a bit for specifics on GL aging report in BW but haven't seen anything. Is there a standard (business content) aging report?
    I'm sorry if this is too basic a question but I would appreciate an explanation on what aging really is and then a step by step possibly on how to create one.
    Thanks a lot in advance for your input.

    Hi,
    I only used/created and AP/AR aging report and have never been requested to create a GL aging report probably because it doesn't make much business sense.
    Here is an example of the report that I found on google.
    The aging reports are created using Restricted Key figures in Columns. Each restricted Keyfigure  would be a bucket or time 1 - 30 days, 31 - 60 days etc. You can manage this using Offsets on a date range.
    I think either AP or AR has a business content report which can be activate.
    In the Rows section of your query designer one would generally have the necessary Vendors/Customer either AP or AR.
    I hope this helps.
    Regards
    -Sid

Maybe you are looking for