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

Similar Messages

  • Age Analysis report

    Hello Experts !!!!
    My Client requires a Stock Age analysis report .
    It is a trading company of steel .
    my client wants to know that how old my stock is in warehouse or how much is 30 days old ,60 days old ,90 days old.
    Below is my query
    SELECT  T0.ITEMCODE , T0.DSCRIPTION,T2.U_WT,SUM(T0.QUANTITY)AS QUANTITY,T1.DOCDATE,
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())<30 THEN SUM(T0.QUANTITY) END '<30 Days(Qty)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())<30 THEN SUM(T0.QUANTITY)*T2.U_WT END '<30 Days(MT)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())>30 AND Datediff(day, T1.DOCDATE,GETDATE())<60 THEN  SUM(T0.QUANTITY) END '<60 Days(Qty)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())>30 AND Datediff(day, T1.DOCDATE,GETDATE())<60 THEN  SUM(T0.QUANTITY)*T2.U_WT END '<60 Days(MT)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())>60 AND Datediff(day, T1.DOCDATE,GETDATE())<90 THEN  SUM(T0.QUANTITY) END '<90 Days(Qty)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())>60 AND Datediff(day, T1.DOCDATE,GETDATE())<90 THEN  SUM(T0.QUANTITY)*T2.U_WT END '<90 Days(MT)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())>90 AND Datediff(day, T1.DOCDATE,GETDATE())<120 THEN  SUM(T0.QUANTITY) END '<120 Days(Qty)',
    CASE WHEN Datediff(day, T1.DOCDATE,GETDATE())>90 AND Datediff(day, T1.DOCDATE,GETDATE())<120 THEN  SUM(T0.QUANTITY) END '<120 Days(MT)'
    FROM PDN1 T0 INNER JOIN OPDN T1 ON T0.DOCENTRY =T1.DOCENTRY INNER JOIN OITM T2 ON T0.ITEMCODE=T2.ITEMCODE
    GROUP BY T0.ITEMCODE , T0.DSCRIPTION,T1.DOCDATE,T2.U_WT
    but problem is that i am able to track when goods were arrived in warehouse .But i am enable to track how much went out warehouse.
    " MY CLIENT WANTS THE REPORT GOODS RECEIPT NOTE WISE REPORT.  " that how much qty has been delivered against a particular Goods receipt note. But we havn't provided any reference to delivery of goods receipt note .
    Experts Thanx in advance.
    Krishna Vamsi

    Hello Krishna Vamsi,
    Try this:
    SELECT T1.ITEMCODE,T1.ItemName,T1.U_WT,SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0)) AS QUANTITY,T0.DOCDATE,
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())<30 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0)) END '<30 Days(Qty)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())<30 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0))*T1.U_WT END '<30 Days(MT)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())>30 AND Datediff(dd, T0.DOCDATE,GETDATE())<60 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0)) END '<60 Days(Qty)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())>30 AND Datediff(dd, T0.DOCDATE,GETDATE())<60 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0))*T1.U_WT END '<60 Days(MT)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())>60 AND Datediff(dd, T0.DOCDATE,GETDATE())<90 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0)) END '<90 Days(Qty)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())>60 AND Datediff(dd, T0.DOCDATE,GETDATE())<90 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0))*T1.U_WT END '<90 Days(MT)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())>90 AND Datediff(dd, T0.DOCDATE,GETDATE())<120 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0)) END '<120 Days(Qty)',
    CASE WHEN Datediff(dd, T0.DOCDATE,GETDATE())>90 AND Datediff(dd, T0.DOCDATE,GETDATE())<120 THEN SUM(IsNull(T0.INQty,0)-IsNull(T0.OutQty,0)) END '<120 Days(MT)'
    FROM dbo.OINM T0
    INNER JOIN dbo.OITM T1 ON T0.ITEMCODE=T1.ITEMCODE
    GROUP BY T1.ITEMCODE,T1.ItemName,T0.DOCDATE,T1.U_WT
    Thanks,
    Gordon

  • Age Analysis report for asset

    Hi All,
    I have to create a Age analysis report for FI documents
    which have line items with posting key 75 & 70 (Asset)
    Given logic is
    1 Selection screen has parameters  - Company code, Key date
    2 Need to take all line items with posting key 70 & 75
    (BSEG-BSCHL = 70 or 75)
    Layout of report is
    Asset no       0-30 31-60      61-90      91-120 . 151-360  (days)
    80000003     2000.00    3000.00    1000.00   4000.00    7000.0
    80000006     1000.00    5000.00     300.00    5000.00    4000.0
    Local curency amount should be categorised under the days
    diferences between key date (selection screen) & posting date
    of the accounting document.
    My problem is,
    Posting date of the document is not in the BSEG table. It is
    in the BKPF table.Therefore I have to extract all FI documents(Not only documents with posting key 75 or 70)  within  360 days from Key date in BKPF the table.
    I cannot join BSEG & BKPF. Because,  BSEG table is a cluster table.
    Can you please tell me the way how can i extract the data for this report with out any performance issues.
    Pra

    Great idea, but I dont think it is going to work.
    The 1st problem should be, how do you work out the key date... You will need some good code for that.
    Have a look at the customer aged debt reports for some help.
    After that, if you just want asset documents, do they have their own unique document type, if so, you could use the doc type from BKPF to reduce the number you want to select in BSEG.
    Have you looked at any of the standard Asset dep reports, perhaps there is something there you could use.

  • 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

  • Need conding in debit ageing analysis report.....

    Hi Experts,
    I am working on BW 3.5.
    I have Debit ageing analysis report like 0-30  31-60  61-90  91-180  181-365  >365.
    these ageing is calculating on DOCUMENT DATE wise.
    Now I want to put one condition in this report.
    IF DOCUMENT TYPE = AB then ageing should be calculate on BASE DATE wise.
    Is it possible??
    plese help to acheive this.....
    Thanks in advance.
    Venkat.

    Hi,
    Yes you can do it. Use Formula variables on DOCUMENT TYPE & date and do it.
    Take DOCUMENT DATE, BASE DATE & DOCUMENT TYPE in formula variables then create formula and check DOCUMENT TYPE = AB based on that write logic informula.
    See some material Aging report in.
    wiki.sdn.sap.com/wiki/display/profile/SurendraKumarReddy+Koduru
    Thanks
    Reddy

  • Aging Analysis Reports for Inventories & Receivables

    Hello,
    Can any one answer me how to get aging analysis reports for inventories & receivables in SAp R3 system?
    Thanking You,
    Regards
    Santosh Rothe

    hi
    the age analysis report format should be like
    Material list   | 0 - 3 months | 3 - 6 Months  | 6 - 12 months | above 1 year|
    M1                10                  50                    0                       0               pc
    M2                0                   0                      12                    10               Kg
    etc  .
    Pls suggest the suitable T.code or step for configuring to get in the above report format
    Regards
    Santosh Rothe

  • Vendor aging analysis report

    Vendor aging analysis application, which extract the data from Vendor Master Table and Vendor Transaction Tables supports Accounts Payable. Vendor master display the risk category and transactions record of vendor. How does company plan the cash resources forecast with this application? Explain in detail, how this application analyze vendor payment performance?

    In cash if you do not have Cash Management in place, where you can link your vendor / customer records.
    If you do not have CM, in such case, you can prepare cash flow statements according to your needs.
    Make sure you have completed your financial statement version in OB58.
    Cash Flow Statement (Indirect Method) Variant 1 and Variant 2, please note that these reports are coming from the form 0SAPRATIO-03 Cash flow (indirect) (Refer T code FSI5) and Reports 0SAPRATIO-03 Cash flow (indirect method) variant 1 (Refer Tcode FSI2) & 0SAPRATIO-01 Cash flow (indirect method) variant 2 (Refer T code FSI2)
    0SAPRATIO-04 Cash flow (direct) Form
    0SAPRATIO-04 Cash flow (direct method)
    You should know what format you should like to see in the cash flow statement.
    You should the FS items accordingly copy the standard forms and changed according to your format.
    Regards,
    Ravi
    You should be conversant enough to do basic report painter.
    Pelase let me know if you need further help.
    Regards

  • Vendor Ageing Analysis Report for the postings for this fiscal year

    Hi All,
    I require report that lists every supplier that my company has spent money in this fiscal year, need the actual average payment terms, number of days etc. And also how much has been spent with each supplier.
    Kindly let me know the report or the process to extract this data from SAP R/3 system.

    Regarding Ageing analysis of Vendor below three reports may meet your requirements provided transactions to the vendors are done in disciplined manner.
    S_ALR_87012078 - Due Date Analysis for Open Items
    S_ALR_87012084 - Open Items - Vendor Due Date Forecast
    S_ALR_87012085 - Vendor Payment History with OI Sorted List
    Regards,
    Alok

  • Aging Analysis report for open Items in SD

    Hi ,
    Please give the code snippet for the following case.
    aging analysis program for open items:-
    payments not receivecd for 15 days,30 ,60 ,90days
    imput:
    custno range
    sales area
    days 30,60,90 selection sort by cust no,sales organization
    output :report program ALV grid format
    Many Thanks in Advance.
    Raj

    There are couple of  Standard Report for Customer Open Items.
    RFDOPO00 - List of Customer Open Items.
    RFDSLD00 -  Cutomer Balances
    Also there is another standard report....
    Run the Tcode 'S_ALR_87012178", that is "Customer open Item analysis by Balance of Over dues".
    Copy the Report and make necessary changes.
    Modification is always required to get a "good looking" aging report, there is no standard.
    Hope this helps.
    Vinodh Balakrishnan

  • Stock Aging Analysis Report by Serial Number

    Hi Experts,
    Is it right to create a Stock Analysis Report for all materials based on Serial Numbers? Because I have now developed a Stock Aging Report which will display the values of stock aging based on Goods Receipt created however, when I base it on Goods Receipt and Serial Numbers, the number won't tally. Please explain what happened? Is this approach not feasible?
    Please help.
    Thanks a lot for your answers!

    Hi @Bijoy,
    We are now experiencing a lot of issues regarding tracking the stock by serial numbers because the current stock aging report only applies to a FIFO stock system. There are also stocks that are transferred from Location to another Location (Sto Loc to Sto Loc2) and they wanted their stocks' aged to be based on the first Storage Location Posted. Please tell me if this is feasible.
    Thanks a Lot!

  • Customer aging analysis report layout

    hi experts,
    i have a client that needs the aging report to display in the following way. when doing an aging analysis for one month, all previous months invoices should be aggregated in one line as an opening balance. Then the invoices for the aging month should be listed under that opening balance and the aging schedule below should age the total of opening balance and the month's invoice. The way SAP Business One does the aging is such that EITHER the opening balance is displayed + the month's invoices but the aging schedule below is for that month's invoices only OR it lists all the invoices relating to that customer existing in the system and does the aging of the total invoices.
    is there a way to generate the aging report as required above?
    Regards,
    David

    Hi David,
    I am afraid you have to create your own version of the report for this specif requirement.  To match the system report values exactly would be a great challenge if you haven't create hundreds of query reports already.
    Thanks,
    Gordon

  • Vendor Age Analysis Report

    Dear All,
    I want to develope a Vendor age anaysis report and see the vendor due balances as per the GRN date.
    Is it possible to develop this report?
    Thanks

    Hi,
      Vendor open balance data you can get in table BSIK,  in this the field ZFBDT  is the baseline date from which the due date is calculate generally this date comes from the base line date which we have given in the invoice verification transaction MIRO  so while doing MIRO  you have to add GRN date in the baseline date  then that date will come in Table BSID-ZFBDT filed  then ref. to this make the report.
    regards,
    zafar

  • Accounts Receivable Report: Customer Wise Ageing Analysis report -FI module

    Hi Gurus,
                 Can anyone help me in providing standard report(source code) or already done sample report(source code) for Accounts Receivable Report: Customer Wise Ageing AnalysisThis is in FI Module. Though it is FI Module we need to fetch details related to Sales Module, and the days should be <0     30     60     90     120     180     365     >365     
    It is urgent I need to deliver this report by this week end.
    Please help me . Waiting for your reply.
    Points Rewarded for help rendered and I would personally send a good gift if you can help me
    Yours Truly,
    Rajiv Christopher.
    Edited by: Rajiv Christopher on Apr 2, 2008 11:33 AM

    Hi,
    i am attaching aging report.
    see if this is useful to you.
    REPORT ZFUS0102 MESSAGE-ID OA
                    LINE-SIZE 270.
    Title:      GR/IR AGING REPORT
    Date:       January 2001
    TABLES: DISVARIANT, EKPO.
    TYPE-POOLS: SLIS.
    Tables
    TABLES:
      BSIS,
      EKKO.
    working table
    DATA:  BEGIN OF RTAB OCCURS 0,
             HKONT   LIKE BSIS-HKONT,
             ZUONR   LIKE BSIS-ZUONR,
             BUDAT   LIKE BSIS-BUDAT,
             SHKZG   LIKE BSIS-SHKZG,
             DMBTR   LIKE BSIS-DMBTR,
             PRCTR   LIKE BSIS-PRCTR,
          END OF RTAB.
    DATA: BEGIN OF WTAB OCCURS 0,
             ZUONR(2) TYPE N,
             PRCTR   LIKE BSIS-PRCTR,
             DAYS(4)  TYPE P,
             DMBTR   LIKE BSIS-DMBTR,
          END OF WTAB.
    DATA: BEGIN OF PTAB OCCURS 0,
             ZUONR(2),
             PRCTR   LIKE BSIS-PRCTR,
             AMT30   LIKE BSIS-WRBTR,
             AMT60   LIKE BSIS-WRBTR,
             AMTPL   LIKE BSIS-WRBTR,
             TOTAL   LIKE BSIS-WRBTR,
          END OF PTAB.
    PARAMETERS:  COMPANY LIKE BSIS-BUKRS OBLIGATORY,
                 ACCT    LIKE BSIS-HKONT OBLIGATORY,
                 DATE    LIKE SY-DATUM OBLIGATORY.
    SELECT-OPTIONS: S_EKORG FOR EKKO-EKORG.
    PARAMETERS: P_VARI LIKE DISVARIANT-REPORT.
    DATA: WS-AMT30 LIKE BSIS-WRBTR.
    DATA: WS-AMT60 LIKE BSIS-WRBTR.
    DATA: WS-AMTPL LIKE BSIS-WRBTR.
    DATA: TITLE(21) VALUE 'GR/IR Aging Report'.
    DATA: LIN TYPE I.
    DATA: GX_VARIANT LIKE DISVARIANT,
          G_VARIANT LIKE DISVARIANT.
    DATA:  LAYOUT   TYPE SLIS_LAYOUT_ALV,
           L_F      TYPE SLIS_T_FIELDCAT_ALV   WITH HEADER LINE,
           GROUP    TYPE SLIS_T_SP_GROUP_ALV   WITH HEADER LINE,
           COLOR    TYPE SLIS_T_SPECIALCOL_ALV WITH HEADER LINE.
    DATA:  LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
           LS_LINE TYPE SLIS_LISTHEADER,
           T_EVENTS   TYPE SLIS_T_EVENT.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    INITIALIZATION.
      PERFORM EVENTTAB_AUFBAUEN USING T_EVENTS[].
      PERFORM VARIANT_INIT.
    Get default variant
      GX_VARIANT = G_VARIANT.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                I_SAVE     = 'A'
           CHANGING
                CS_VARIANT = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND  = 2.
      IF SY-SUBRC = 0.
        P_VARI = GX_VARIANT-VARIANT.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
      PERFORM VARIANT_INPUTHELP_F14.
    START-OF-SELECTION.
      LS_LINE-TYP  = 'S'.
      WRITE SY-DATUM TO LS_LINE-INFO DD/MM/YY.
      WRITE SY-UZEIT TO LS_LINE-INFO+10.
      WRITE SY-UNAME TO LS_LINE-INFO+20.
      WRITE TITLE    TO LS_LINE-INFO+30.
      APPEND LS_LINE TO LT_TOP_OF_PAGE.
      PERFORM FIELDS.
      IF NOT P_VARI IS INITIAL.
        PERFORM PAI_OF_SELECTION_SCREEN.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
             EXPORTING
                  I_DIALOG            = ' '
                  I_USER_SPECIFIC     = 'A'
                  I_DEFAULT           = ' '
            I_TABNAME_HEADER    =
            I_TABNAME_ITEM      =
                  IT_DEFAULT_FIELDCAT = L_F[]
                  I_LAYOUT            = LAYOUT
             IMPORTING
            E_EXIT              =
                  ET_FIELDCAT         = L_F[]
            ET_SORT             =
            ET_FILTER           =
             CHANGING
                  CS_VARIANT          = DISVARIANT
             EXCEPTIONS
                  WRONG_INPUT         = 1
                  FC_NOT_COMPLETE     = 2
                  NOT_FOUND           = 3
                  PROGRAM_ERROR       = 4
                  OTHERS              = 5.
      ENDIF.
    Decide which tables to access.
      PERFORM MAIN_SELECT.
      MOVE TITLE  TO LAYOUT-WINDOW_TITLEBAR.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM      = 'ZFUS0102'
                I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                IS_LAYOUT               = LAYOUT
                IT_FIELDCAT             = L_F[]
                IT_SPECIAL_GROUPS       = GROUP[]
                I_SAVE                  = 'A'
                IS_VARIANT              = G_VARIANT
                IT_EVENTS               = T_EVENTS
           TABLES
                T_OUTTAB                = PTAB
           EXCEPTIONS
                PROGRAM_ERROR           = 1
                OTHERS                  = 2.
          FORM FIELDS                                                   *
    FORM FIELDS.
      L_F-FIELDNAME     = 'ZUONR'.
      L_F-OUTPUTLEN     = 6.
      L_F-SELTEXT_L     = 'SERIES'.
      L_F-REPTEXT_DDIC  = 'SERIES'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'PRCTR'.
      L_F-OUTPUTLEN     = 10.
      L_F-SELTEXT_L     = 'PROFIT CTR.'.
      L_F-REPTEXT_DDIC  = 'PROFIT CTR.'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'AMT30'.
      L_F-SELTEXT_L     = '30 DAYS'.
      L_F-REPTEXT_DDIC  = '30 DAYS'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'AMT60'.
      L_F-SELTEXT_L     = '60 DAYS'.
      L_F-REPTEXT_DDIC  = '60 DAYS'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'AMTPL'.
      L_F-SELTEXT_L     = '60+ DAYS'.
      L_F-REPTEXT_DDIC  = '60+ DAYS'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
      L_F-FIELDNAME     = 'TOTAL'.
      L_F-SELTEXT_L     = 'TOTAL'.
      L_F-REPTEXT_DDIC  = 'TOTAL'.
      L_F-REF_TABNAME   = 'PTAB'.
      L_F-SP_GROUP      = 'A'.
      L_F-REF_TABNAME   = 'BSIS'.
      L_F-REF_FIELDNAME = 'WRBTR'.
      L_F-DO_SUM        = 'X'.
      APPEND L_F. CLEAR L_F.
    ENDFORM.
          FORM MAIN_SELECT                                              *
    FORM MAIN_SELECT.
      SELECT HKONT ZUONR BUDAT SHKZG DMBTR PRCTR
           INTO TABLE RTAB
           FROM BSIS
           WHERE BUKRS = COMPANY
           AND   HKONT = ACCT.
      IF SY-SUBRC = 0.
        SORT RTAB.
        PERFORM PROCESS_RTAB.
        PERFORM PROCESS_WTAB.
      ENDIF.
    ENDFORM.                    " MAIN SELECT
          FORM VARIANT_INPUTHELP_F14                                    *
    FORM VARIANT_INPUTHELP_F14.
      DATA:  G_EXIT(1) TYPE C.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                IS_VARIANT          = G_VARIANT
                I_SAVE              = 'A'  " g_save
              it_default_fieldcat =
           IMPORTING
                E_EXIT              = G_EXIT
                ES_VARIANT          = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND = 2.
      IF SY-SUBRC = 2.
        MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        IF G_EXIT = SPACE.
          P_VARI = GX_VARIANT-VARIANT.
        ENDIF.
      ENDIF.
    ENDFORM.
          FORM USER_COMMAND                                             *
    -->  UCOMM                                                         *
    -->  SELFIELD                                                      *
    FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM SELFIELD TYPE
    SLIS_SELFIELD.
      IF UCOMM EQ '&IC1'.
        IF SELFIELD-TABINDEX <= 0.
          MESSAGE S108.
          EXIT.
        ENDIF.
      IF SELFIELD-SEL_TAB_FIELD CS 'LIFNR'.
        SET PARAMETER ID 'LIF' FIELD SELFIELD-VALUE.
        CALL TRANSACTION 'XK02'.
      ELSE.
        IF SELFIELD-SEL_TAB_FIELD CS 'VEND'.
          SET PARAMETER ID 'LIF' FIELD SELFIELD-VALUE.
          CALL TRANSACTION 'FBL1'.
        ENDIF.
      ENDIF.
        CLEAR SY-UCOMM. CLEAR UCOMM.
      ENDIF.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = LT_TOP_OF_PAGE.
    ENDFORM.
          FORM EVENTTAB_AUFBAUEN                                        *
    -->  P_T_EVENTS                                                    *
    FORM EVENTTAB_AUFBAUEN USING P_T_EVENTS TYPE SLIS_T_EVENT.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = P_T_EVENTS.
      READ TABLE P_T_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                                                     INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO P_T_EVENTS.
      ENDIF.
    ENDFORM.                               " EVENTTAB_AUFBAUEN
          FORM PAI_OF_SELECTION_SCREEN                                  *
    FORM PAI_OF_SELECTION_SCREEN.
      IF NOT P_VARI IS INITIAL.
        MOVE G_VARIANT TO GX_VARIANT.
        MOVE P_VARI TO GX_VARIANT-VARIANT.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  I_SAVE     = 'A'  " g_save
             CHANGING
                  CS_VARIANT = GX_VARIANT.
        G_VARIANT = GX_VARIANT.
      ELSE.
        PERFORM VARIANT_INIT.
      ENDIF.
    ENDFORM.                               " PAI_OF_SELECTION_SCREEN
          FORM VARIANT_INIT                                             *
    FORM VARIANT_INIT.
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = 'ZFUS0102'.
    ENDFORM.                               " VARIANT_INIT
    *&      Form  PROCESS_RTAB
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_RTAB.
      DATA TLNS TYPE I.
      DESCRIBE TABLE S_EKORG LINES TLNS.
      LOOP AT RTAB.
        IF TLNS GT 0.
          SELECT SINGLE EKORG FROM EKKO INTO EKKO-EKORG
            WHERE EBELN = RTAB-ZUONR(10).
          CHECK EKKO-EKORG IN S_EKORG.
        ENDIF.
        IF NOT RTAB-BUDAT > DATE.
          MOVE RTAB-ZUONR(2) TO WTAB-ZUONR.
          COMPUTE WTAB-DAYS = DATE - RTAB-BUDAT.
          IF RTAB-SHKZG = 'H'.
            WTAB-DMBTR = RTAB-DMBTR * -1.
          ELSE.
            WTAB-DMBTR = RTAB-DMBTR * 1.
          ENDIF.
          MOVE RTAB-PRCTR TO WTAB-PRCTR.
          APPEND WTAB.
        ENDIF.
      ENDLOOP.
      FREE RTAB.
    ENDFORM.                    " PROCESS_RTAB
    *&      Form  PROCESS_WTAB
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_WTAB.
      SORT WTAB BY ZUONR PRCTR DAYS.
      LOOP AT WTAB.
        PTAB-ZUONR = WTAB-ZUONR.
        PTAB-PRCTR = WTAB-PRCTR.
        AT END OF DAYS.
          SUM.
          IF WTAB-DAYS > 60.
            WS-AMTPL = WS-AMTPL + WTAB-DMBTR.
          ELSE.
            IF WTAB-DAYS > 30.
              WS-AMT60 = WS-AMT60 + WTAB-DMBTR.
            ELSE.
              WS-AMT30 = WS-AMT30 + WTAB-DMBTR.
            ENDIF.
          ENDIF.
        ENDAT.
        AT END OF PRCTR.
          PTAB-AMTPL = WS-AMTPL.
          PTAB-AMT30 = WS-AMT30.
          PTAB-AMT60 = WS-AMT60.
          COMPUTE PTAB-TOTAL = PTAB-AMTPL + PTAB-AMT30 + PTAB-AMT60.
          APPEND PTAB.
          WS-AMTPL = 0.
          WS-AMT30 = 0.
          WS-AMT60 = 0.
        ENDAT.
      ENDLOOP.
      SORT PTAB BY ZUONR PRCTR.
    ENDFORM.                    " PROCESS_WTAB
    regards,
    Sindhu

  • Inventory age analysis report

    Dear All,
    I have closing stock on Say 31.03.2008 and need to bifercate on no. of days it is lying as dead stock.
    eg say closing stock = 100 Units
         Dead Stock 180 days = 20 units
         Dead Stock 270 days = 10 units
    Is there any standard report available for this..
    Regards,
    Rakesh

    Thanx for reply.
    But those reports doesn't solve my purpose.
    I think this report needs to be developed.
    Can someone give some logic to develop this

  • Age analysis for customers and vendors

    Hi All,
    i needs to create an age analysis report on customers and vendors (0FIAR_C03), analysis could be done on <30 days, >30 days,>60,>90,>120 days , i needs to calculate these based between netdue date for payments and system date. any one can give idea how to do this
    thanks in advance.
    regards
    raja

    Hi Raja
    http://help.sap.com/saphelp_nw04/helpdata/en/41/4b73415fb9157de10000000a155106/frameset.htm
    Try checking the above link. You can use RKF .... Use offsets --- for example <30 offset is -30 in varibles.....
    Standard reports should give some idea
    Regards
    Naga

Maybe you are looking for

  • Bought a new ipod, purchased music good for 1!!!

    I just got a newer version of Ipod for christmas, With no intention to keep using my older one... Now Itunes tells me I cant Import the purchased music that on my older Ipod to my newer one... I have probably $200 plus itunes bought music in my libra

  • Windows don't close after using flash

    When viewing certain flash videos I am unable to close down firefox or any of its windows. When trying to save an image and pressing the save button it doesn't save it or close the browse window that is open. Same when trying to clear the cache the w

  • Q: looking for a best practices on a reorg issue

    I am trying to figure out how to reorg our BW PSAPODSD and PSAPODSI tablespaces.  They both have partitions which seems to complicate the issue a tad.  What I am trying to do is move the data to new tablespaces (PSAPTESTD and PSAPTESTI, drop the old

  • MAPPING BASICS

    Dear experts I am very new to XI....Kindly let me know in detail... 1)About different mapping technincs available 2)Whether multiple mapping possible in Interface Mapping..?? 3)Is there any concept of nested mapping here in XI...?? Regards Arnab

  • Creating a 1/8 bleed?

    I am creating a document i pages (which I will export to a pdf) for printing and the printer has asked me to create a 1/8 bleed. Is this possible in pages? If so any pointer would be helpful.