SQL for AR Aging 7 Buckets Report

Hi,
I am currently working on producing a query to produce the same results as the Aging 7 Buckets report in the AR module of Oracle Enterprise Suite.
I have take the code from the Oracle report and produced my query but it is slightly out.
Has anyone come across this before??
Rgds,
Al

I had a couple of reasons to rewrite the Aging 7 Buckets Report. First of all it just looked like a mess, especially to me who is still fairly new to Reports. We had rows labeled as type Paym that would show up even if they were not selected in the report parameters. The last reason I forget, but I know I had one at the time. I think it may of had something to do with the functionality of the date parameter.

Similar Messages

  • Customize AP Trial Balance XML Data Definition for adding Aging Buckets

    Hi
    I have to customize AP Trial Balance Report XML Data Definition Template for adding Aging Buckets & Supplier details in R12 , Could you let me know how i can modify XML file?
    Thanks
    Pravin

    Hi,
    My requirement is different from the one which is in below link.
    I need to add Aging Buckets & Supplier details to AP Trial Balance report (R12) , here i need to modify the XML Data definition template.
    Please help me, very urgent.
    Thanks
    Pravin

  • AR - Aging Bucket report Customisation

    I have a requirement from end users to be able to run an aged debt report for any date range in the past e.g. From 01-Jan-2008 to 01-Jan-2013.
    Aging Bucket report only has, "As of date" field in the parameters.
    Is it possible to add additional parameters to this report?

    Hi.
    I don't believe such parameter can be included in the Aging reports. According to the user manual, the design of the report is to:
    Receivables includes all open items whose GL date is before or the same as the date you enter, and whose GL date closed is after the date you enter. The default is the current date.
    Besides, such parameter would cause debts to be excluded from the balance.
    Octavio

  • Functional Spec for VENDOR AGE ANALYSIS report

    Hi experts
    I need to develope a VENDOR AGE ANALYSIS REPORT. But due to some reason i cant be able to get the Functional Specification for that object. So could you please help me by sending the above mention functional Specification.
    thanks and regadrs
    Pratik

    got the following from sdn thread:
    This is the sample report for vendor aging:
    Std reports Tcodes are:
    customer : s_alr_87012178
    vendor : s_alr_87012084
    Custom designed:
    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.
    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_bsik-waers,
    66 sy-vline, 67 v_gtotal2 CURRENCY int_bsik-waers,
    83 sy-vline, 84 v_gtotal3 CURRENCY int_bsik-waers,
    100 sy-vline,101 v_gtotal4 CURRENCY int_bsik-waers,
    117 sy-vline,118 v_gtotal5 CURRENCY int_bsik-waers,
    134 sy-vline,135 v_gtotal6 CURRENCY int_bsik-waers,
    151 sy-vline,152 v_gtotal CURRENCY int_bsik-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_bsik BY belnr zfbdt.
    LOOP AT int_bsik WHERE lifnr EQ int_final-lifnr.
    v_rem = v_cnt MOD 2.
    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_rem NE 0.
    format color 2 intensified.
    WRITE :/1 sy-vline, 2 int_bsik-belnr,
    12 sy-vline,13 int_bsik-lifnr,
    23 sy-vline,24 int_bsik-name1,
    59 sy-vline,60 int_bsik-xblnr,
    76 sy-vline,77 int_bsik-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_bsik-dmbtr CURRENCY int_bsik-waers,
    206 sy-vline.
    IF v_date IN r_date1.
    v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
    WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEIF v_date IN r_date2.
    v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
    WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEIF v_date IN r_date3.
    v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
    WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEIF v_date IN r_date4.
    v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
    WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEif v_date > r_date4-high.
    v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
    WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEif v_date < p_allgst.
    v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
    WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ENDIF.
    format color off.
    ELSE.
    WRITE :/1 sy-vline, 2 int_bsik-belnr,
    12 sy-vline,13 int_bsik-lifnr,
    23 sy-vline,24 int_bsik-name1,
    59 sy-vline,60 int_bsik-xblnr,
    76 sy-vline,77 int_bsik-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_bsik-dmbtr CURRENCY int_bsik-waers,
    206 sy-vline.
    IF v_date IN r_date1.
    v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
    WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEIF v_date IN r_date2.
    v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
    WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEIF v_date IN r_date3.
    v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
    WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEIF v_date IN r_date4.
    v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
    WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEif v_date > r_date4-high.
    v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
    WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
    ELSEif v_date < p_allgst.
    v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
    WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-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_bsik-waers ,
    87 sy-vline,
    88 v_subtotal1 CURRENCY int_bsik-waers,
    104 sy-vline,
    105 v_subtotal2 CURRENCY int_bsik-waers,
    121 sy-vline,
    122 v_subtotal3 CURRENCY int_bsik-waers,
    138 sy-vline,
    139 v_subtotal4 CURRENCY int_bsik-waers,
    155 sy-vline,
    156 v_subtotal5 CURRENCY int_bsik-waers,
    172 sy-vline,
    173 v_subtotal6 CURRENCY int_bsik-waers,
    189 sy-vline,
    190 v_subtotal CURRENCY int_bsik-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 Vendor 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) 'Vendor#'(015) CENTERED,
    23 sy-vline, 24(35) 'Vendor 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
    The below link will give Tables & Relations.
    http://www.erpgenie.com/abap/tables.htm
    http://goldenink.com/abap/files_in_sap.html
    http://abap4.tripod.com/SAP_Tables.html
    http://www.geocities.com/sapcircle/Relations.pdf
    regards,
    indranil

  • How to consider internal transfer movement for material aging Z report

    Hello Expert ,
    we are developing Z repot for material ageing .
          In this we are using BSIM table  but in our case internal transfer movement such as ( 411 ,412 ,413 ,etc.) create debit credit entry in BSIM for this reason value of material getting correct but age of material get disturbed .
    we are having sale order stock (E), WBS stock(Q) , Collective stock , Vendor Stock (o) & stock transfer between stock type possible.
    For all above consideration how to calculate material Age.

    Dear experts
    i have the same issue, could you pls advise the answer?
    another question; how to unify the stock locations rather than maintaining different locations such as sales order stock, free goods, commercial stock and in the same time the margin reporting to be based on transaction/line item in sales invoice?
    thanks

  • Error while running awrrpt.sql for Automatic Workload Repository Report

    Hi
    I am trying to run awrrpt.sql.While running the query in sql*plus it ask me for file format then no of days
    & then begin & end snapshot Id & then eventually the sql*plus session get closed . I am unable find
    why sql*plus session getting closed automatically.Please tell me How to run awrrpt.sql to generate AWR reports. Please guide.

    1008032 wrote:
    Dear
    This is happen due to you are given the begin snap id and end snap id not between the shut down time .EX begin snap it at 12 am 1521 and you shut down at 12:30 am and you you give the 1:00 am snap id 1522 .That time system can not collect the statistics betwwn 1521 and 1522.
    Or you should enable statistics_level parameter if it 11gr2 you should enable controlfile_management_pack _access='DIAGNOSTIC+TUNING'
    issue not resolved please post your error..........
    Thanks&regards
    SS.vijaibabuI checked my statistics_level it shows value TYPICAL which I think is right.
    SQL> sho parameter statistics_level
    NAME TYPE VALUE
    statistics_level string TYPICALAlso I given snap id which between single startup & shutdown still the problem is same sqlplus session get closed after asking for snal ids.
    If error gets generated where it gets generated?

  • I AM DEVELOPING THE Z-REPORT FOR SHELF AGEING MATERIAL

    HI
    USER WANTS Z-REPORT FOR SHELF AGEING MATERIAL WITH STOCK QTY AND STOCK VALUE.
    I WANT TABLE NAME FOR SHELF AGEING MATERIAL REPORT.
    SPECIALLY, FOR DAYS (REMAINING SHELF LIFE PERIOD FOR  MATERIAL IN DYAS)

    Hi,
    Ask the abaper to write an query from the table S032 there you can find the option of last good receipt date and the last goods issue issue date.
    consider the various good mvt in between these dates calcuate the diffence betwee the current date and the last good issue date, so that you can abel to get the stock list that is not moving for more than 60 days,120 days etc
    You can also use MC46, MC50,  MB5M - expiration date list . In case if that does not solve their requirement then you need take logic from client and you need to develop own report
    pherasath

  • Create aging bucket in BEx - based on  date variable

    Hi everyone,
    I have a report for which we need to create account receivable aging bucket to classify arrears (1>29 / 30>59 / etcu2026).
    Our solution overall architecture is the following :
    Source System (SAP) >  BW back end...Multiprovider > Super BEx Query > Universe > Webi Report
    BW 7.0
    BO XI 3.2 SP3.0
    In this report, each bucket is defined by the difference between:
    -     the Net Due Date (which is the due date of payment of the invoice)
    -     and the Current Date (date for which the report is run u2013 can be the date of the day or a date in the past)
    We can develop this either in BEx or in Webi, but to avoid potential performance issues in Webi, we take the try to develop this in BEx.
    As you can easily imagine, this BEx query will be used for many reportsu2026so not only for this specific report.
    What weu2019ve done so far:
    1-     We created a variable to prompt the user with the date he wants to run the report for
               - ZTEST is an optional variable, single value, User input, based on characteristic 0CALDAY
    2-     We developed RKF in BEx
    -     Key Figure restricted by Amount
    -     Net Due Date restricted by the variable ZTEST using the between function and an offset (to determine the range)
    => When we save the query we are getting a warning message saying u201CVariable ZTEST for characteristic Net Due Date has been converted to a required entryu201D
    Why? (you probably knowu2026) Because my RKF is using a variable with an offsetu2026which automatically turn on my variable as mandatory and no more as optional.
    Consequences:
    -     In BEx: My variable, which is required to be optional (because we donu2019t have to have this field as mandatory for each and every report running on top of this query) is now mandatory.
    -     In Webi: If I use the variable (funnel in webi), my report is working fineu2026but if I donu2019t use it in the webi report, I get an error message saying u201Cvalue required for ZTESTu201D
    o     Funnel is configured as optional in the universe designer (so the issue is not coming from here)
    => 2 consequencesu2026same issue
    Question: What can we do to keep our bucket logic running in BEx and avoid this variable to become mandatory?
    Solutions (potential)
    -     Create a custom exit routine to work around this issue u2013 how?
    -     Create CKF/Custom exit to create our bucket (using ZTEST as an entry value to determine the range) and then use the created range in our RKF to restrict the amount u2013 how? Not so easyu2026
    -     Build the logic in Webi
    -     Any other suggestions?
    Here we are, any advice would be really appreciated
    Thank you guys
    Regards
    Henri

    Hi peeps,
    We finally find a solution for this problem! So I can share it with you.
    The overall solution is pretty easy to understand.
    1st step is to prompt with the user with a 0DATE variable. The date selected becomes a date input for the next step.
    The variables is defined as a range [01/01/1900;variable_value)...in order to retrieve the right data set.
    2nd step is to use this date to create our aging bucket, dates range.
    To do so, we created 4 user exit variables (for each aging bucket).
    3rd step is to use these ranges in RKF.
    This way you get aging bucket dynamically defined by the user input pretty cool!
    Regards
    H

  • Problenin vendor age wise report

    Hi sap gais
    Cient he is asked for vendor age wise report and include that document date also required the report
    pls
    yps

    hi,
    vendor age wise report
    path: easy access - financial accounting - A/P - Information system - Reports for A/P accounting - Vendors items - S_ALR_87012085vandor pay history with OI stored list
    on these step document date wise,
    S_ALR_87012078 due date wise analysis
    under output contorl data
    Due Date stored list mention the days or age 10  20  40   50   100
    i think ur doubt clear

  • Ageing analysis report

    Dear SAP Gurus,
    I have to desin a customized report in SAP
    Giving the Ageing analysis report for the total sales happening in a period per customer Account Group with the sales person responsible.
    For this Ageing analysis report has been working finw .I have now to assign the Sales personnel to the report.
    The Sales person is already assigned as a partner function in the Customer Account Group.
    Please tell me is there any procedure that I can assign a particular sales person in the Customer Master record.
    posted by
    Amlan Sarkar

    Hi
    The ageing analysis report is available in the standard. Please check for that report using the Tcode SARP and select FIAR and browse for the report. You have to make the required changes to that standard to suit your requirement, with the help of your abaper.
    Thanks,
    Ravi

  • V V URGENT Report  for Vendor Aging

    Hi ABAP Gurus,
    I have to develop a report for VENDOR AGING. My requirement is i have to post an invoice. From Payment terms i have to get Dependent on posting date. Let us assume if payment term is 100 by adding posting date + payment term (100) i have to get due date. I'am giving I/P terms as Company code & Period. If i enter company code i have to get O/P as vendor name(lfa1-name1),vendor no(bsik-lifnr),bill no(bsik-xblnr),bill date(bsik-bldat) i.e., baseline date,amount(bsik-dmbtr) and duedate (this i have to pick from payment terms). For period i have to get O/P as 1st week bucket,2nd week bucket,3rd week bucket,4th week bucket and beyond. For this you have to take the difference b/n due date and that buckets based on this result you have to put that amount of rupees whether it is going to pay in 1st week r 2nd r 3rd r 4th or beyond this. If that due date is less than or equal to 1st week it has to come and fall in 1st week. THIS IS MY REQUIREMENT.
    For this i'am using tables BSIK,LFA1.
    Can any body send me the code on this. For this my delivery date is on monday.
    Please help me on this it's very Urgent...
    I will REWARD you the points definitely for those who help me on this.
    my mail id : [email protected]
    waiting for your VALUABLE REPLIES. Please intimate me if you send it to my mail.
    Thanks and Regards,
    Sundeep.

    Hi
    See the report code and modify as per your requirements
    REPORT  zfi_vendor_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: 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.
        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_bsik-waers,
                  66 sy-vline, 67 v_gtotal2 CURRENCY int_bsik-waers,
                  83 sy-vline, 84 v_gtotal3 CURRENCY int_bsik-waers,
                 100 sy-vline,101 v_gtotal4 CURRENCY int_bsik-waers,
                 117 sy-vline,118 v_gtotal5 CURRENCY int_bsik-waers,
                 134 sy-vline,135 v_gtotal6 CURRENCY int_bsik-waers,
                 151 sy-vline,152 v_gtotal CURRENCY int_bsik-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_bsik BY belnr zfbdt.
      LOOP AT int_bsik WHERE lifnr EQ int_final-lifnr.
        v_rem = v_cnt MOD 2.
        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_rem NE 0.
          format color 2 intensified.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
                 12 sy-vline,13 int_bsik-lifnr,
                 23 sy-vline,24 int_bsik-name1,
                 59 sy-vline,60 int_bsik-xblnr,
                 76 sy-vline,77 int_bsik-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_bsik-dmbtr CURRENCY int_bsik-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr  CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
          format color off.
        ELSE.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
                 12 sy-vline,13 int_bsik-lifnr,
                 23 sy-vline,24 int_bsik-name1,
                 59 sy-vline,60 int_bsik-xblnr,
                 76 sy-vline,77 int_bsik-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_bsik-dmbtr CURRENCY int_bsik-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-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_bsik-waers ,
                 87 sy-vline,
                 88 v_subtotal1 CURRENCY int_bsik-waers,
                104 sy-vline,
                105 v_subtotal2 CURRENCY int_bsik-waers,
                121 sy-vline,
                122 v_subtotal3 CURRENCY int_bsik-waers,
                138 sy-vline,
                139 v_subtotal4 CURRENCY int_bsik-waers,
                155 sy-vline,
                156 v_subtotal5 CURRENCY int_bsik-waers,
                172 sy-vline,
                173 v_subtotal6 CURRENCY int_bsik-waers,
                189 sy-vline,
                190 v_subtotal CURRENCY int_bsik-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 Vendor Open Invoices as on'(024)
        v_date1 into v_str separated by space.
      CALL FUNCTION 'Z_STANDARD_HEADER'
        EXPORTING
         title1 = '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) 'Vendor#'(015) CENTERED,
               23 sy-vline, 24(35) 'Vendor 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
    Reward points if useful
    Regards
    Anji

  • Aging 7 Buckets Report ARXAGMW  error REP-1212 Object Body is not enclosed

    Hi
    I am customising standard AR Aging 7 buckets report by account(ARXAGMW).
    I just need to add 2 fields,That i have added successfully.
    But the report output format is not printing properly.
    I mean if there are 4 columns custname,custno,endcustname,endcustno.
    it is printing the output as
    custname custno endcustname endcustno
    abc communications inc 1234 abc communicatio 1234
    xyz communications inc 5678 pqr communicatio 9657
    but i want to print with full name(endcustname) as how it is printing for custname.
    So itried to increase the report width to 300 and try to run the report,but i am getting the error.
    I tried with standard report also by increasing the width but same error.
    Could anyone please tell me when we increase report width what else i should change.
    The error is
    REP-1212: Object 'Body' is not fully enclosed by its enclosing object 'P_REPORTING_ENTITY_NAME'.
    Thanks,
    Malla

    Hi,
    "Not allowing" means? Do you get any error?
    Is this the same style used by this concurrent program? I assume that the report type is text.
    If the report type is bitmap, size the page size in the "Execution Options" field as "PAGESIZE= <width>x<height>" and submit the report again.
    Note: 297522.1 - How to investigate printing issues and work towards its resolution ?
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=297522.1
    Regards,
    Hussein

  • To create monthly buckets for a keyfigure in report...

    Hi Gurus,
    I have a keyfigure called Demand in my report.  For Demand, I need to create monthly buckets in the form of columns, ie Demand-Month1, Demand-Month2, Demand-Month3 whereas from R3 the demand values for Month1, Month2, and Month3 flows in rows.  In short, I need to transpose it to columns from the report level in BW. 
    Also, in the description of the columns, for example: If month1 flowing from R3 is July, then Demand-Month1 should be Demand-July, Demand-Month2 should be Demand-August, Demand-Month3 should be Demand-September.
    Can I do this with the help of variables or some other method.  Please help me in detail.
    Thanks,
    Edited by: sachitp on Oct 5, 2010 6:55 PM

    Hi ,
    inorder to design a bucketing report For this you need to create a formula variable with replacement path on the date and take the system date varaible which is provided by SAP.
    create a formula to calculate the difference of days.
    based on the diff of days you can create the formula to get the buckets.
    Check the below blog link which will give you some idea to go ahead.
    Calculating the Ageing of the Materials
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f15839-0cf1-2b10-c6a7-ebe68cc87cdc
    REgards
    KP

  • Need standrad program for vendor aging report

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

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

  • Standard Report for stock Aging

    Hello all,
    can anyone plz let us know that is there any standard report in SAP for stock aging? actually i have to see the materials quantity whose 311 movement not done after 321 and also from how many days it is pending.
    Kindly help and tell how can i find those materials quantity, while user also do 311 for partial quantity?
    Regards.

    Hi  @ABAP@
    Check the followings...
    MB24 - Reservations for Material
    MB25 - Reservations for Account Assignment
    MB51 - Material Document List
    MB52 - List of Warehouse Stocks on Hand MB53 - Display Plant Stock Availability
    MB54 - Consignment Stocks
    MB56 - Analyze Batch Where-Used List
    MB57 - Build Up Batch Where-Used List
    MB58 - Consgmt and Ret. Packag. at Customer
    MB59 - Material Document List
    MB5B - Stocks for Posting Date
    MB5C - Pick-Up List
    MB5L - List of Stock Values: Balances
    MB5M - ShL.exp/prod.date
    MB5S - Display List of GR/IR Balances
    MB5W - List of Stock Values
    MB9A - Analyze Archived Material Documents
    MBAL - Material Documents: Read Archive
    MBGR - Display Material Documents by Movement Reason
    MBSI - Find Inventory Sampling
    MBSM - Display Cancelled Material Documents
    MMBE - Stock Overview
    MD07 - Current Material Overview
    MR51 - Material Line Items
    MRKO - Settle Consignment/Pipeline Liabilities
    MB5T - Stock in transit CC

Maybe you are looking for