Skip to end of metadata
Go to start of metadata

Author: Sujeet Mishra
Submitted: 14/08/2013
Related Links:

Description: Customer Ageing Report.

 Refer SAP Standard Report before creating any custom report:

S_ALR_87012085  Vendor Payment History with OI sorted Items.

S_ALR_87012178  Customer (AR) Aging report by Customer

S_ALR_87012168  Customer (AR) Aging report by Invoice

REPORT  zfi_customer_ageing.
TYPE-POOLS: slis.
TABLES: knb1,kna1,knvv,fagl_splinfo,bapi3007_2, tgsb.
DATA: i_data TYPE STANDARD TABLE OF bapi3007_2 WITH HEADER LINE.
DATA: lv_bukrs TYPE bapi3007_1-comp_code,
      lv_kunnr TYPE bapi3007_1-customer,
      lv_date  TYPE bapi3007-key_date.
DATA: lv_line  TYPE i.
DATA: lv_sum TYPE fagl_splinfo-pswbt.
DATA: lv_amtlc TYPE bsid-dmbtr.
DATA: lv_amtdc TYPE bsid-dmbtr.
DATA : lv_amtlcfix TYPE bsid-dmbtr.
DATA : lv_amtdcfix TYPE bsid-dmbtr.
DATA: lv_brtxt(20),
      lv_ktext(20),
      lv_gtext(30),
      lv_ltext(20).
DATA: lv_dudat TYPE d.
DATA: lv_ovdat TYPE d.
DATA: lv_day TYPE i.
DATA: lv_days(10).
DATA: gv_days(15).
DATA: lv_top(60).
DATA: lv_txt(10).
DATA: lv_pernr TYPE vbpa-pernr.
DATA: lv_invref_docdate TYPE bkpf-bldat.
DATA: ibkpf TYPE bkpf.
DATA: i_date TYPE STANDARD TABLE OF faede WITH HEADER LINE.
DATA: i_kna1 TYPE STANDARD TABLE OF kna1 WITH HEADER LINE.
DATA: i_knb1 TYPE STANDARD TABLE OF knb1 WITH HEADER LINE.
DATA: i_knvv TYPE STANDARD TABLE OF knvv WITH HEADER LINE.
DATA: it_t001 TYPE TABLE OF t001 WITH HEADER LINE.
DATA: i_splinfo TYPE STANDARD TABLE OF fagl_splinfo WITH HEADER LINE.
TYPES: BEGIN OF t_ageing,
bukrs TYPE knb1-bukrs,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
zregio TYPE kna1-regio,
konzs TYPE kna1-konzs,
currency(5),
prctr TYPE cepc-prctr,
ltext TYPE cepct-ltext,
gsber TYPE fagl_splinfo-gsber,
zzbdiv TYPE bseg-zzbdiv,
zztdiv TYPE bseg-zztdiv,
inv_year TYPE bseg-rebzj,
inv_ref TYPE bseg-rebzg,
inv_item TYPE bseg-rebzz,
sp_gl_ind(1),
brsch TYPE kna1-brsch,
brtxt TYPE t016t-brtxt,
vkorg TYPE knvv-vkorg,
vtweg TYPE knvv-vtweg,
spart TYPE knvv-spart,
kdgrp TYPE knvv-kdgrp,
ktext TYPE t151t-ktext,
bzirk TYPE knvv-bzirk,
vkbur TYPE knvv-vkbur,
vkgrp TYPE knvv-vkgrp,
busab TYPE knb1-busab,
niels TYPE kna1-niels,
kukla TYPE kna1-kukla,
bran1 TYPE kna1-bran1,
pernr TYPE vbpa-pernr,
pstng_date TYPE sy-datum,
usnam TYPE bkpf-usnam,
ppnam   TYPE bkpf-ppnam,
      cpudt TYPE bkpf-cpudt,
      cputm TYPE bkpf-cputm,
      doc_date TYPE sy-datum,
      doc_type TYPE bkpf-blart,
      bline_date TYPE sy-datum,
      adate TYPE sy-datum,
      lv_dudat TYPE sy-datum,
      pmnttrms(4),
      zlspr TYPE bsid-zlspr,
      bill_doc(10),
      ref_doc_no(16),
      alloc_nmbr(18),
      days(10),
      intrate TYPE zzroi,
      int TYPE bsid-dmbtr,
      doc_no(10),
      fisc_year(4),
      item_num(3),
      gtext TYPE tgsbt-gtext,
      spl_no TYPE fagl_splinfo-spl_no,
      lc_fixamt TYPE bsid-dmbtr,
      lc_amount TYPE bsid-dmbtr,
      lv_amt    TYPE bsid-dmbtr,
      lv_amt1   TYPE bsid-dmbtr,
      lv_amt2   TYPE bsid-dmbtr,
      lv_amt3   TYPE bsid-dmbtr,
      lv_amt4   TYPE bsid-dmbtr,
      lv_amt5   TYPE bsid-dmbtr,
      lv_amt6   TYPE bsid-dmbtr,
      lv_amt7   TYPE bsid-dmbtr,
      lv_amt8   TYPE bsid-dmbtr,
      lv_reval  TYPE bsid-dmbtr, 
      lv_exdif  TYPE bsid-dmbtr, 
      lv_exrate TYPE ukursp,     
      lv_sgtxt   TYPE bseg-sgtxt,
END OF t_ageing.
DATA: i_ageing  TYPE STANDARD TABLE OF t_ageing WITH HEADER LINE.
DATA: i_age     TYPE STANDARD TABLE OF t_ageing WITH HEADER LINE.
DATA: wa_ageing LIKE           LINE OF i_ageing.
\*&---------------------------------------------------------------------\*
\*& Internal Table Declaration For Field Catalog
\*&---------------------------------------------------------------------\*
DATA: fcat      TYPE slis_t_fieldcat_alv,
      ls_fact   TYPE slis_fieldcat_alv,
      ls_adjust TYPE slis_layout_alv.
DATA : gt_events   TYPE slis_t_event.
DATA:  gt_list_top_of_page TYPE slis_t_listheader.
DATA: i_sort TYPE slis_t_sortinfo_alv.
DATA: wa_sort TYPE slis_sortinfo_alv,
      color     TYPE slis_t_specialcol_alv,
      ls_color  TYPE slis_specialcol_alv.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
\*&---------------------------------------------------------------------\*
\*& Selection Screen
\*&---------------------------------------------------------------------\*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bukrs FOR knb1-bukrs OBLIGATORY,
s_busab FOR knb1-busab NO-DISPLAY,
s_vkorg FOR knvv-vkorg NO-DISPLAY,
 s_vtweg FOR knvv-vtweg NO-DISPLAY,
 s_spart FOR knvv-spart,
 s_kunnr FOR kna1-kunnr,
 s_vbund FOR kna1-vbund NO-DISPLAY,
 s_konzs FOR kna1-konzs.
PARAMETERS :    p_spart AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-007.
SELECT-OPTIONS: s_gsber FOR tgsb-gsber NO-DISPLAY,
 s_prctr FOR fagl_splinfo-prctr,
 s_zzbdiv FOR fagl_splinfo-zzbdiv,
 s_zztdiv FOR fagl_splinfo-zztdiv.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-006.
PARAMETERS: p_date LIKE rfpdo-allgstid OBLIGATORY.
PARAMETERS: p_ddate RADIOBUTTON GROUP  g1,
            p_pdate RADIOBUTTON GROUP  g1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(10) text-002 FOR FIELD p_0 .
PARAMETERS: p_0(3) TYPE n DEFAULT '0',
 p_a(3) TYPE n DEFAULT '045' OBLIGATORY,
 p_b(3) TYPE n DEFAULT '060' OBLIGATORY,
 p_c(3) TYPE n DEFAULT '090' OBLIGATORY,
 p_d(3) TYPE n DEFAULT '120' OBLIGATORY,
 p_e(3) TYPE n DEFAULT '180' OBLIGATORY,
 p_f(3) TYPE n DEFAULT '365' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b8 WITH FRAME TITLE text-012.
SELECT-OPTIONS: s_kdgrp FOR knvv-kdgrp  NO-DISPLAY,
 s_bzirk FOR knvv-bzirk  NO-DISPLAY,
s_vkbur FOR knvv-vkbur  NO-DISPLAY,
 s_vkgrp FOR knvv-vkgrp  NO-DISPLAY,
 s_niels FOR kna1-niels  NO-DISPLAY,
s_kukla FOR kna1-kukla  NO-DISPLAY,
 s_brsch FOR kna1-brsch  NO-DISPLAY,
 s_bran1 FOR kna1-bran1  NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b8.
SELECTION-SCREEN BEGIN OF BLOCK b7 WITH FRAME TITLE text-011.
PARAMETERS: p_lc  RADIOBUTTON GROUP g5,
 p_dc RADIOBUTTON GROUP g5 DEFAULT 'X',
 p_reval AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b7.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-009.
PARAMETERS: p_detail  RADIOBUTTON GROUP g3,
 p_accsum RADIOBUTTON GROUP g3 DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b5.
SELECTION-SCREEN BEGIN OF BLOCK b6 WITH FRAME TITLE text-010.
PARAMETERS: p_bdci RADIOBUTTON GROUP g4,
 p_di   RADIOBUTTON GROUP g4,
 p_ci   RADIOBUTTON GROUP g4,
 p_ch   AS CHECKBOX DEFAULT ' '.
SELECT-OPTIONS: s_sgli FOR bapi3007_2-sp_gl_ind.
SELECTION-SCREEN END OF BLOCK b6.
INITIALIZATION.
  PERFORM e03_eventtab_build USING gt_events\[\].
  CLEAR: p_a,
         p_b,
         p_c,
         p_d,
         p_e,
         p_f.
AT SELECTION-SCREEN.
  PERFORM checking.
  IF s_sgli\[\] IS INITIAL.
    s_sgli-sign = 'I'.
    s_sgli-option = 'EQ'.
    s_sgli-low = ' '.
    APPEND s_sgli.
  ENDIF.
  IF p_spart = ' ' AND s_spart\[\] IS INITIAL.
    MESSAGE e001(38) WITH 'Please select a Division'.
  ENDIF.
  IF p_spart = 'X' AND s_spart\[\] IS NOT INITIAL.
    MESSAGE e001(38) WITH 'Please do not select a Division'.
  ENDIF.
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'P_0'.
      screen-input = '0'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
START-OF-SELECTION.
  PERFORM selection.
  SORT i_knvv BY kunnr.
  LOOP AT i_knvv.
    DELETE ADJACENT DUPLICATES FROM i_knvv COMPARING kunnr.
  ENDLOOP.
  LOOP AT i_knb1.
    READ TABLE i_knvv WITH KEY kunnr = i_knb1-kunnr.
    READ TABLE i_kna1 WITH KEY kunnr = i_knb1-kunnr.
    SELECT SINGLE brtxt
      FROM t016t
      INTO lv_brtxt
     WHERE brsch = i_kna1-brsch
       AND spras = sy-langu.
    SELECT SINGLE ktext
     FROM t151t
     INTO lv_ktext
    WHERE kdgrp = i_knvv-kdgrp
      AND spras = sy-langu.
    lv_bukrs = i_knb1-bukrs.
    lv_kunnr = i_knb1-kunnr.
    lv_date  = p_date.
    CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
      EXPORTING
        companycode = lv_bukrs
        customer    = lv_kunnr
        keydate     = lv_date
      TABLES
        lineitems   = i_data.
    IF p_di EQ 'X'.
      p_ch = ' '.
      LOOP AT i_data WHERE db_cr_ind EQ 'S' AND sp_gl_ind IN s_sgli.
        PERFORM split_operation.
      ENDLOOP.
    ENDIF.
    IF p_ci EQ 'X'.
      p_ch = ' '.
      LOOP AT i_data WHERE db_cr_ind EQ 'H' AND sp_gl_ind IN s_sgli.
        i_data-lc_amount = \-1 * i_data-lc_amount.
        i_data-amt_doccur = \-1 * i_data-amt_doccur.
        PERFORM split_operation.
      ENDLOOP.
    ENDIF.
    IF p_bdci EQ 'X'.
      LOOP AT i_data WHERE sp_gl_ind IN s_sgli.
        IF i_data-db_cr_ind EQ 'H'.
          i_data-lc_amount = \-1 * i_data-lc_amount.
          i_data-amt_doccur = \-1 * i_data-amt_doccur.
        ENDIF.
        PERFORM split_operation.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  PERFORM fieldcatalog.
  PERFORM e04_comment_build  USING gt_list_top_of_page\[\].
  PERFORM alv_display.
\*&---------------------------------------------------------------------\*
\*&      Form  SELECTION
\*&---------------------------------------------------------------------\*
\*       text
\*----------------------------------------------------------------------\*
\*  -->  p1        text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM selection .
&nbsp; SELECT *
&nbsp; &nbsp;FROM knvv
&nbsp; &nbsp;INTO TABLE i_knvv
&nbsp; WHERE kunnr IN s_kunnr
&nbsp; &nbsp; AND vkorg IN s_vkorg
&nbsp; &nbsp; AND vtweg IN s_vtweg
&nbsp; &nbsp; AND spart IN s_spart
&nbsp; &nbsp; AND kdgrp IN s_kdgrp
&nbsp; &nbsp; AND bzirk IN s_bzirk
&nbsp; &nbsp; AND vkbur IN s_vkbur
&nbsp; &nbsp; AND vkgrp IN s_vkgrp.
&nbsp; IF p_spart = ' '.
&nbsp; &nbsp; SELECT *
&nbsp; &nbsp; &nbsp; &nbsp; FROM kna1
&nbsp; &nbsp; &nbsp; &nbsp; INTO TABLE i_kna1
&nbsp; &nbsp; &nbsp; &nbsp; FOR ALL ENTRIES IN i_knvv
&nbsp; &nbsp; &nbsp; &nbsp; WHERE kunnr EQ i_knvv-kunnr
&nbsp; &nbsp; &nbsp; &nbsp; AND &nbsp; niels IN s_niels
&nbsp; &nbsp; &nbsp; &nbsp; AND &nbsp; kukla IN s_kukla
&nbsp; &nbsp; &nbsp; &nbsp; AND &nbsp; brsch IN s_brsch
&nbsp; &nbsp; &nbsp; &nbsp; AND &nbsp; bran1 IN s_bran1
&nbsp; &nbsp; &nbsp; &nbsp; AND &nbsp; vbund IN s_vbund
&nbsp; &nbsp; &nbsp; &nbsp; AND &nbsp; konzs IN s_konzs.
&nbsp; &nbsp; SELECT *
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FROM knb1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;INTO TABLE i_knb1 FOR ALL ENTRIES IN i_kna1
&nbsp; &nbsp; &nbsp; &nbsp; WHERE kunnr = i_kna1-kunnr
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND bukrs IN s_bukrs
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND busab IN s_busab.
&nbsp; ELSE.
&nbsp; &nbsp; SELECT *
&nbsp; &nbsp; &nbsp; FROM kna1
&nbsp; &nbsp; &nbsp; INTO TABLE i_kna1
&nbsp; &nbsp; &nbsp; WHERE kunnr IN s_kunnr
&nbsp; &nbsp; &nbsp; AND &nbsp; niels IN s_niels
&nbsp; &nbsp; &nbsp; AND &nbsp; kukla IN s_kukla
&nbsp; &nbsp; &nbsp; AND &nbsp; brsch IN s_brsch
&nbsp; &nbsp; &nbsp; AND &nbsp; bran1 IN s_bran1
&nbsp; &nbsp; &nbsp; AND &nbsp; vbund IN s_vbund
&nbsp; &nbsp; &nbsp; AND &nbsp; konzs IN s_konzs.
&nbsp; &nbsp; SELECT *
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FROM knb1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;INTO TABLE i_knb1 FOR ALL ENTRIES IN i_kna1
&nbsp; &nbsp; &nbsp; &nbsp; WHERE kunnr = i_kna1-kunnr
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND bukrs IN s_bukrs
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND busab IN s_busab.
&nbsp; ENDIF.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" SELECTION
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;DATA_ENTRY
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM data_entry .
\*&---------------------------------------------------------------------\*
\*& Selecting Text For Businees Area
\*&---------------------------------------------------------------------\*
&nbsp; IF i_data-inv_ref EQ ' '.
&nbsp; &nbsp; i_data-inv_ref &nbsp; &nbsp;= i_data-doc_no.
&nbsp; &nbsp; i_data-inv_year &nbsp; = i_data-fisc_year.
&nbsp; &nbsp; i_data-inv_item &nbsp; = i_data-item_num.
&nbsp; ENDIF.
\* Document for Invoice reference stored in Variable.
&nbsp; CLEAR: lv_invref_docdate.
&nbsp; SELECT SINGLE bldat
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM bkpf
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INTO lv_invref_docdate
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE bukrs = i_data-comp_code AND
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; belnr = i_data-inv_ref &nbsp; AND
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gjahr = i_data-inv_year.
&nbsp; SELECT SINGLE gtext
&nbsp; &nbsp; &nbsp;FROM tgsbt
&nbsp; &nbsp; &nbsp;INTO lv_gtext
&nbsp; &nbsp; WHERE gsber = i_splinfo-gsber
&nbsp; &nbsp; &nbsp; AND spras = sy-langu.
&nbsp; SELECT SINGLE ktext
&nbsp; &nbsp;FROM cepct
&nbsp; &nbsp;INTO lv_ltext
&nbsp; WHERE prctr = i_splinfo-prctr
&nbsp; &nbsp; AND spras = sy-langu.
&nbsp; CLEAR : lv_pernr.
&nbsp; IF i_data-bill_doc NE ' '.
&nbsp; &nbsp; SELECT SINGLE pernr FROM vbpa INTO lv_pernr
&nbsp; &nbsp; WHERE vbeln = i_data-bill_doc
&nbsp; &nbsp; AND parvw = 'ZA'.
&nbsp; ENDIF.
&nbsp; DATA: lv_vbelv TYPE vbfa-vbelv,
&nbsp; &nbsp; &nbsp; &nbsp; lv_intrate TYPE vbak-zzroi.
&nbsp; CLEAR: lv_vbelv, lv_intrate.
&nbsp; SELECT SINGLE vbelv FROM vbfa INTO lv_vbelv
&nbsp; &nbsp; WHERE vbeln = i_data-ref_doc_no
&nbsp; &nbsp; &nbsp; AND vbtyp_v = 'C'.
&nbsp; IF sy-subrc = 0.
&nbsp; &nbsp; SELECT SINGLE zzroi FROM vbak INTO lv_intrate
&nbsp; &nbsp; &nbsp; WHERE vbeln = lv_vbelv.
&nbsp; ENDIF.
&nbsp; PERFORM date_calculation.
&nbsp; CLEAR : i_ageing, it_t001.
&nbsp; READ TABLE it_t001 WITH KEY bukrs = i_knb1-bukrs.
&nbsp; i_ageing-bukrs &nbsp; &nbsp; &nbsp;= i_knb1-bukrs.
&nbsp; i_ageing-kunnr &nbsp; &nbsp; &nbsp;= i_knb1-kunnr.
&nbsp; i_ageing-name1 &nbsp; &nbsp; &nbsp;= i_kna1-name1.
&nbsp; i_ageing-ort01 &nbsp; &nbsp; &nbsp;= i_kna1-ort01.
&nbsp; i_ageing-regio &nbsp; &nbsp; &nbsp;= i_kna1-regio.
&nbsp; i_ageing-brsch &nbsp; &nbsp; &nbsp;= i_kna1-brsch.
&nbsp; i_ageing-brtxt &nbsp; &nbsp; &nbsp;= lv_brtxt.
&nbsp; i_ageing-konzs &nbsp; &nbsp; &nbsp;= i_kna1-konzs.
&nbsp; i_ageing-vkorg &nbsp; &nbsp; &nbsp;= i_knvv-vkorg.
&nbsp; i_ageing-vtweg &nbsp; &nbsp; &nbsp;= i_knvv-vtweg.
&nbsp; i_ageing-spart &nbsp; &nbsp; &nbsp;= i_knvv-spart.
&nbsp; i_ageing-kdgrp &nbsp; &nbsp; &nbsp;= i_knvv-kdgrp.
&nbsp; i_ageing-ktext &nbsp; &nbsp; &nbsp;= lv_ktext.
&nbsp; i_ageing-bzirk &nbsp; &nbsp; &nbsp;= i_knvv-bzirk.
&nbsp; i_ageing-vkbur &nbsp; &nbsp; &nbsp;= i_knvv-vkbur.
&nbsp; i_ageing-vkgrp &nbsp; &nbsp; &nbsp;= i_knvv-vkgrp.
&nbsp; i_ageing-pernr &nbsp; &nbsp; &nbsp;= lv_pernr.
&nbsp; i_ageing-busab &nbsp; &nbsp; &nbsp;= i_knb1-busab.
&nbsp; i_ageing-gsber &nbsp; &nbsp; &nbsp;= i_splinfo-gsber.
&nbsp; i_ageing-spl_no &nbsp; &nbsp; = i_splinfo-spl_no.
&nbsp; i_ageing-gtext &nbsp; &nbsp; &nbsp;= lv_gtext.
&nbsp; i_ageing-prctr &nbsp; &nbsp; &nbsp;= i_splinfo-prctr.
&nbsp; &nbsp;i_ageing-ltext &nbsp; &nbsp; &nbsp;= lv_ltext.
&nbsp; i_ageing-doc_no &nbsp; &nbsp; = i_data-doc_no.
&nbsp; i_ageing-fisc_year &nbsp;= i_data-fisc_year.
&nbsp; i_ageing-item_num &nbsp; = i_data-item_num.
&nbsp; i_ageing-pstng_date = i_data-pstng_date.
&nbsp; i_ageing-doc_date &nbsp; = i_data-doc_date.
&nbsp; i_ageing-usnam &nbsp; &nbsp; &nbsp;= ibkpf-usnam.
&nbsp; i_ageing-ppnam &nbsp; &nbsp; &nbsp;= ibkpf-ppnam.
&nbsp; i_ageing-cpudt &nbsp; &nbsp; &nbsp;= ibkpf-cpudt.
&nbsp; i_ageing-cputm &nbsp; &nbsp; &nbsp;= ibkpf-cputm.
&nbsp; i_ageing-doc_type &nbsp; = i_data-doc_type.
&nbsp; i_ageing-currency &nbsp; = i_data-currency.
&nbsp; i_ageing-bline_date = i_data-bline_date.
&nbsp; i_ageing-adate &nbsp; &nbsp; &nbsp;= p_date.
&nbsp; i_ageing-lv_dudat &nbsp; = lv_dudat.
&nbsp; i_ageing-pmnttrms &nbsp; = i_data-pmnttrms.
&nbsp; i_ageing-zlspr &nbsp; &nbsp; &nbsp;= i_data-pmnt_block.
&nbsp; i_ageing-bill_doc &nbsp; = i_data-bill_doc.
&nbsp; i_ageing-ref_doc_no = i_data-ref_doc_no.
&nbsp; i_ageing-alloc_nmbr = i_data-alloc_nmbr.
&nbsp; i_ageing-lv_sgtxt &nbsp; = i_data-item_text.
&nbsp; i_ageing-inv_ref &nbsp; &nbsp;= i_data-inv_ref.
&nbsp; i_ageing-inv_year &nbsp; = i_data-inv_year.
&nbsp; i_ageing-inv_item &nbsp; = i_data-inv_item.
&nbsp; i_ageing-sp_gl_ind &nbsp;= i_data-sp_gl_ind.
&nbsp; i_ageing-lc_amount &nbsp;= lv_amtlc.
&nbsp; IF p_dc = 'X'.
&nbsp; &nbsp; i_ageing-lc_fixamt &nbsp;= lv_amtlcfix.
&nbsp; ELSE.
&nbsp; &nbsp; i_ageing-lc_fixamt &nbsp;= lv_amtdcfix.
&nbsp; ENDIF.
&nbsp; i_ageing-days &nbsp; &nbsp; &nbsp; = lv_days.
&nbsp; i_ageing-intrate &nbsp; &nbsp;= lv_intrate.
&nbsp; i_ageing-int &nbsp; &nbsp; &nbsp; &nbsp;= i_ageing-lc_amount * lv_intrate / 365.
&nbsp; IF p_ch = ' '.
&nbsp; &nbsp; IF lv_days LT p_0. "AND lv_amtlc GE 0.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_0 AND lv_days LE p_a AND p_a IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt1 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_a AND lv_days LE p_b AND p_b IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt2 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_b AND lv_days LE p_c AND p_c IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt3 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_c AND lv_days LE p_d AND p_d IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt4 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_d AND lv_days LE p_e AND p_e IS NOT INITIAL .
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt5 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_e AND lv_days LE p_f AND p_f IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt6 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_f AND p_f IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt7 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_f AND p_f IS INITIAL.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt7 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; ENDIF.
&nbsp; IF p_ch = 'X'.
&nbsp; &nbsp; IF lv_days LT p_0 AND &nbsp;i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_0 AND lv_days LE p_a AND p_a IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt1 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_a AND lv_days LE p_b AND p_b IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt2 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_b AND lv_days LE p_c AND p_c IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt3 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_c AND lv_days LE p_d AND p_d IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt4 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_d AND lv_days LE p_e AND p_e IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt5 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_e AND lv_days LE p_f AND p_f IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt6 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_f AND p_f IS NOT INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt7 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF lv_days GT p_f AND p_f IS INITIAL
&nbsp; &nbsp; &nbsp; AND i_data-sp_gl_ind EQ ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt7 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF i_data-sp_gl_ind NE ' '.
&nbsp; &nbsp; &nbsp; i_ageing-lv_amt8 = lv_amtlc.
&nbsp; &nbsp; ENDIF.
&nbsp; ENDIF.
&nbsp; IF p_reval = 'X'.
&nbsp; &nbsp; PERFORM forex_reval.
&nbsp; ENDIF.
&nbsp; IF &nbsp; &nbsp;i_ageing-prctr IN s_prctr
&nbsp; &nbsp; &nbsp; APPEND i_ageing.
&nbsp; ENDIF.
&nbsp; CLEAR i_ageing.
&nbsp; CLEAR: lv_amtlc, lv_amtlcfix, lv_amtdcfix.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" DATA_ENTRY
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;FIELDCATALOG
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM fieldcatalog .
&nbsp; ls_fact-fieldname = 'BUKRS'.
&nbsp; ls_fact-seltext_m = 'Company Code'.
&nbsp; ls_fact-no_out = 'X'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'KUNNR'.
&nbsp; ls_fact-seltext_m = 'Customer Code'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'NAME1'.
&nbsp; ls_fact-seltext_m = 'Customer Name'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'ORT01'.
&nbsp; ls_fact-seltext_m = 'Customer City'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'KONZS'.
&nbsp; ls_fact-seltext_m = 'Group Key'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'PRCTR'.
&nbsp; ls_fact-seltext_m = 'Profit Center'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LTEXT'.
&nbsp; ls_fact-seltext_m = 'PC Description'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; IF p_accsum <> 'X'.
&nbsp; &nbsp; ls_fact-fieldname = 'INV_REF'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Invoice Reference'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'INV_YEAR'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Invoice Ref Year'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'INV_ITEM'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Invoice Ref Item'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'BILL_DOC'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Billing Doc-Internal'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'ALLOC_NMBR'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Billing Doc-External'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ENDIF.
&nbsp; IF p_dc = 'X'.
&nbsp; &nbsp; ls_fact-fieldname = 'LC_FIXAMT'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Amt in Local Curr'.
&nbsp; &nbsp; ls_fact-emphasize = 'C400'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ELSE.
&nbsp; &nbsp; ls_fact-fieldname = 'LC_FIXAMT'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Amt in Doc Curr'.
&nbsp; &nbsp; ls_fact-emphasize = 'C400'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ENDIF.
&nbsp; ls_fact-fieldname = 'CURRENCY'.
&nbsp; ls_fact-seltext_m = 'Currency'.
&nbsp; ls_fact-emphasize = 'C400'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LC_AMOUNT'.
&nbsp; ls_fact-seltext_m = 'Amount'.
&nbsp; ls_fact-emphasize = 'C400'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT'.
&nbsp; CONCATENATE 'Less Than' p_0 INTO gv_days.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT1'.
&nbsp; PERFORM days_concatenation USING p_0 p_a.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT2'.
&nbsp; PERFORM days_concatenation USING p_a p_b.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT3'.
&nbsp; PERFORM days_concatenation USING p_b p_c.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT4'.
&nbsp; PERFORM days_concatenation USING p_c p_d.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT5'.
&nbsp; PERFORM days_concatenation USING p_d p_e.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT6'.
&nbsp; PERFORM days_concatenation USING p_e p_f.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; ls_fact-fieldname = 'LV_AMT7'.
&nbsp; CONCATENATE 'Greater Than' p_f INTO gv_days.
&nbsp; ls_fact-seltext_m = gv_days.
&nbsp; ls_fact-emphasize = 'C500'.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; ENDIF.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; IF p_ch = 'X'.
&nbsp; &nbsp; ls_fact-fieldname = 'LV_AMT8'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Special GL Amount'.
&nbsp; &nbsp; ls_fact-emphasize = 'C600'.
&nbsp; &nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; &nbsp; ls_fact-do_sum = 'X'.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ENDIF.
&nbsp; IF p_accsum <> 'X'.
&nbsp; &nbsp; ls_fact-fieldname = 'PSTNG_DATE'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Posting Date'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'DOC_DATE'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Document Date'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'DOC_TYPE'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Document Type'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'ADATE'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Analysis Date'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'BLINE_DATE'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Baseline Date'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'PMNTTRMS'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Payment Terms'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'LV_DUDAT'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Due Date'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'DAYS'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Overdue Days'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ENDIF.
&nbsp; IF p_reval = 'X'.
&nbsp; &nbsp; IF p_accsum <> 'X'.
&nbsp; &nbsp; &nbsp; ls_fact-fieldname = 'LV_EXRATE'.
&nbsp; &nbsp; &nbsp; ls_fact-seltext_m = 'Revaluation Ex. Rate'.
&nbsp; &nbsp; &nbsp; ls_fact-emphasize = 'C700'.
&nbsp; &nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; ls_fact-fieldname = 'LV_REVAL'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Revaluated LC Amount'.
&nbsp; &nbsp; ls_fact-emphasize = 'C700'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'LV_EXDIF'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Revaluation Difference'.
&nbsp; &nbsp; ls_fact-emphasize = 'C700'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ENDIF.
&nbsp; ls_fact-fieldname = 'INT'.
&nbsp; ls_fact-seltext_m = 'Overdue Interest'.
&nbsp; ls_fact-emphasize = 'C100'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; CLEAR ls_fact.
&nbsp; IF p_accsum <> 'X'.
&nbsp; &nbsp; ls_fact-fieldname = 'INTRATE'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Int Rate p.a'.
&nbsp; &nbsp; ls_fact-emphasize = 'C100'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'SP_GL_IND'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Special GL Indicator'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'LV_SGTXT'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Line Item Text'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'DOC_NO'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Accounting Doccument Number'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'FISC_YEAR'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Document Year'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'ITEM_NUM'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Line Item'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'ZLSPR'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Payment Block'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'USNAM'.
&nbsp; &nbsp; ls_fact-seltext_m = 'User ID'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'PPNAM'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Parking User ID'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'CPUDT'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Entry Date'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; &nbsp; ls_fact-fieldname = 'CPUTM'.
&nbsp; &nbsp; ls_fact-seltext_m = 'Entry Time'.
&nbsp; &nbsp; ls_fact-no_out = 'X'.
&nbsp; &nbsp; APPEND ls_fact TO fcat.
&nbsp; &nbsp; CLEAR ls_fact.
&nbsp; ENDIF.
&nbsp; ls_fact-fieldname = 'REGIO'.
&nbsp; ls_fact-seltext_m = 'Customer State'.
&nbsp; ls_fact-no_out = 'X'.
&nbsp; APPEND ls_fact TO fcat.
&nbsp; wa_sort-spos = '02'.
&nbsp; wa_sort-fieldname = 'KUNNR'.
&nbsp; wa_sort-up = 'X'.
&nbsp; wa_sort-group = '*'.
&nbsp; wa_sort-subtot = 'X'.
&nbsp; APPEND wa_sort TO i_sort.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" FIELDCATALOG
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;ALV_DISPLAY
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM alv_display .
&nbsp; SORT i_ageing BY bukrs kunnr currency prctr gsber zzbdiv zztdiv inv_year inv_ref inv_item &nbsp;sp_gl_ind.
&nbsp; IF p_detail = 'X'.
&nbsp; &nbsp; LOOP AT i_ageing INTO wa_ageing.
&nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-kunnr.
&nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-prctr.
&nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-doc_no.
&nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-bill_doc.
&nbsp; &nbsp; &nbsp; APPEND wa_ageing TO i_age.
&nbsp; &nbsp; &nbsp; CLEAR i_age.
&nbsp; &nbsp; ENDLOOP.
&nbsp; ENDIF.
&nbsp; IF p_accsum = 'X'.
&nbsp; &nbsp; LOOP AT i_ageing INTO wa_ageing.
&nbsp; &nbsp; &nbsp; AT END OF ltext.
&nbsp; &nbsp; &nbsp; &nbsp; SUM.
&nbsp; &nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-kunnr.
&nbsp; &nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-prctr.
&nbsp; &nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-doc_no.
&nbsp; &nbsp; &nbsp; &nbsp; PERFORM data_condense USING wa_ageing-bill_doc.
&nbsp; &nbsp; &nbsp; &nbsp; APPEND wa_ageing TO i_age.
&nbsp; &nbsp; &nbsp; &nbsp; CLEAR i_age.
&nbsp; &nbsp; &nbsp; ENDAT.
&nbsp; &nbsp; ENDLOOP.
&nbsp; ENDIF.
&nbsp; ls_adjust-colwidth_optimize = 'X'.
&nbsp; CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
&nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; i_buffer_active &nbsp; &nbsp;= space
&nbsp; &nbsp; &nbsp; i_default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'X'
&nbsp; &nbsp; &nbsp; i_save &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 'A'
&nbsp; &nbsp; &nbsp; i_callback_program = sy-repid
&nbsp; &nbsp; &nbsp; it_fieldcat &nbsp; &nbsp; &nbsp; &nbsp;= fcat
&nbsp; &nbsp; &nbsp; it_sort &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= i_sort
&nbsp; &nbsp; &nbsp; is_layout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= ls_adjust
&nbsp; &nbsp; &nbsp; it_events &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= gt_events\[\]
&nbsp; &nbsp; TABLES
&nbsp; &nbsp; &nbsp; t_outtab &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = i_age.
&nbsp; IF sy-subrc <> 0.
\* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
\* &nbsp; &nbsp; &nbsp; &nbsp; WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
&nbsp; ENDIF.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" ALV_DISPLAY
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;SPLIT_OPERATION
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM split_operation .
&nbsp; SELECT *
&nbsp; &nbsp; FROM fagl_splinfo
&nbsp; &nbsp; INTO TABLE i_splinfo
&nbsp; &nbsp;WHERE belnr = i_data-doc_no
&nbsp; &nbsp; &nbsp;AND gjahr = i_data-fisc_year
&nbsp; &nbsp; &nbsp;AND bukrs = i_data-comp_code
&nbsp; &nbsp; &nbsp;AND buzei = i_data-item_num.
&nbsp; CLEAR ibkpf.
&nbsp; SELECT SINGLE * FROM bkpf INTO ibkpf
&nbsp; &nbsp; &nbsp; WHERE bukrs = i_data-comp_code AND
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; belnr = i_data-doc_no &nbsp; &nbsp;AND
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gjahr = i_data-fisc_year.
&nbsp; DESCRIBE TABLE i_splinfo LINES lv_line.
&nbsp; IF lv_line = 1.
&nbsp; &nbsp; READ TABLE i_splinfo WITH KEY belnr = i_data-doc_no.
&nbsp; &nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; &nbsp; lv_amtlc = i_data-lc_amount.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; IF p_dc = 'X'.
&nbsp; &nbsp; &nbsp; lv_amtlc = i_data-amt_doccur .
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; lv_amtlcfix = i_data-lc_amount.
&nbsp; &nbsp; lv_amtdcfix = i_data-amt_doccur.
&nbsp; &nbsp; PERFORM data_entry.
&nbsp; ENDIF.
&nbsp; IF lv_line GT 1.
&nbsp; &nbsp; LOOP AT i_splinfo
&nbsp; &nbsp; &nbsp; WHERE belnr = i_data-doc_no
&nbsp; &nbsp; &nbsp; &nbsp; AND gjahr = i_data-fisc_year
&nbsp; &nbsp; &nbsp; &nbsp; AND bukrs = i_data-comp_code
&nbsp; &nbsp; &nbsp; &nbsp; AND buzei = i_data-item_num.
&nbsp; &nbsp; &nbsp; lv_sum = lv_sum + i_splinfo-pswbt.
&nbsp; &nbsp; ENDLOOP.
&nbsp; &nbsp; LOOP AT i_splinfo
&nbsp; &nbsp; &nbsp; WHERE belnr = i_data-doc_no
&nbsp; &nbsp; &nbsp; &nbsp; AND gjahr = i_data-fisc_year
&nbsp; &nbsp; &nbsp; &nbsp; AND bukrs = i_data-comp_code
&nbsp; &nbsp; &nbsp; &nbsp; AND buzei = i_data-item_num.
&nbsp; &nbsp; &nbsp; CLEAR: lv_amtlc, lv_amtdc.
&nbsp; &nbsp; &nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; &nbsp; &nbsp; lv_amtlc = ( i_data-lc_amount * i_splinfo-pswbt ) / lv_sum.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; IF p_dc = 'X'.
&nbsp; &nbsp; &nbsp; &nbsp; lv_amtlc = ( i_data-amt_doccur * i_splinfo-pswbt ) / lv_sum.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; lv_amtlcfix = ( i_data-lc_amount * i_splinfo-pswbt ) / lv_sum.
&nbsp; &nbsp; &nbsp; lv_amtdcfix = ( i_data-amt_doccur * i_splinfo-pswbt ) / lv_sum.
&nbsp; &nbsp; &nbsp; PERFORM data_entry.
&nbsp; &nbsp; ENDLOOP.
&nbsp; &nbsp; CLEAR lv_sum.
&nbsp; ENDIF.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" SPLIT_OPERATION
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;DATE_CALCULATION
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM date_calculation .
&nbsp; IF p_pdate = 'X'.
&nbsp; &nbsp; lv_dudat = lv_invref_docdate.
&nbsp; ENDIF.
&nbsp; IF p_ddate = 'X'.
&nbsp; &nbsp; IF i_data-bline_date IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; i_date-shkzg = i_data-db_cr_ind.
&nbsp; &nbsp; &nbsp; i_date-koart = 'D'.
&nbsp; &nbsp; &nbsp; i_date-zfbdt = i_data-bline_date.
&nbsp; &nbsp; &nbsp; i_date-zbd1t = i_data-dsct_days1.
&nbsp; &nbsp; &nbsp; i_date-zbd2t = i_data-dsct_days2.
&nbsp; &nbsp; &nbsp; i_date-zbd3t = i_data-netterms.
&nbsp; &nbsp; &nbsp; i_date-rebzg = i_data-inv_ref.
&nbsp; &nbsp; &nbsp; APPEND i_date.
&nbsp; &nbsp; ELSE.
&nbsp; &nbsp; &nbsp; i_date-shkzg = i_data-db_cr_ind.
&nbsp; &nbsp; &nbsp; i_date-koart = 'D'.
&nbsp; &nbsp; &nbsp; i_date-zfbdt = i_data-pstng_date.
&nbsp; &nbsp; &nbsp; i_date-zbd1t = i_data-dsct_days1.
&nbsp; &nbsp; &nbsp; i_date-zbd2t = i_data-dsct_days2.
&nbsp; &nbsp; &nbsp; i_date-zbd3t = i_data-netterms.
&nbsp; &nbsp; &nbsp; i_date-rebzg = i_data-inv_ref.
&nbsp; &nbsp; &nbsp; APPEND i_date.
&nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; CALL FUNCTION 'DETERMINE_DUE_DATE'
&nbsp; &nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; &nbsp; i_faede = i_date
&nbsp; &nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; &nbsp; e_faede = i_date.
&nbsp; &nbsp; lv_dudat = i_date-netdt.
&nbsp; ENDIF.
&nbsp; lv_ovdat = p_date.
&nbsp; CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
&nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; beg_da &nbsp; &nbsp; = lv_dudat
&nbsp; &nbsp; &nbsp; end_da &nbsp; &nbsp; = lv_ovdat
&nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; no_cal_day = lv_day.
&nbsp; lv_days = lv_day.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" DATE_CALCULATION
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;DAYS_CONCATENATION
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp;-->P_P_0 &nbsp;text
\* &nbsp; &nbsp; &nbsp;-->P_P_A &nbsp;text
\*----------------------------------------------------------------------\*
FORM days_concatenation &nbsp;USING &nbsp; &nbsp;p_p_0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p_p_a.
&nbsp; IF p_p_0 <> 0.
&nbsp; &nbsp; p_p_0 = p_p_0 + 1.
&nbsp; ENDIF.
&nbsp; CONCATENATE p_p_0 '-' p_p_a INTO gv_days.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" DAYS_CONCATENATION
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;CHECKING
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM checking .
&nbsp; SELECT * FROM t001 INTO TABLE it_t001
&nbsp; &nbsp; WHERE bukrs IN s_bukrs.
&nbsp; LOOP AT it_t001.
&nbsp; &nbsp; AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ID 'BUKRS' FIELD it_t001-bukrs
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ID 'ACTVT' FIELD '03'.
&nbsp; &nbsp; IF sy-subrc <> 0.
&nbsp; &nbsp; &nbsp; MESSAGE
&nbsp; &nbsp; &nbsp; 'You do not have display authorisation for this company code'
&nbsp; &nbsp; &nbsp; TYPE 'E' .
&nbsp; &nbsp; ENDIF.
&nbsp; ENDLOOP.
&nbsp; IF p_a LE p_0 AND p_a IS NOT INITIAL.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Please Check The Entry - Age Block 1-2'.
&nbsp; ENDIF.
&nbsp; IF p_b LE p_a AND p_b IS NOT INITIAL.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Please Check The Entry - Age Block 2-3'.
&nbsp; ENDIF.
&nbsp; IF p_c LE p_b AND p_c IS NOT INITIAL.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Please Check The Entry - Age Block 3-4'.
&nbsp; ENDIF.
&nbsp; IF p_d LE p_c AND p_d IS NOT INITIAL.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Please Check The Entry - Age Block 4-5'.
&nbsp; ENDIF.
&nbsp; IF p_e LE p_d AND p_e IS NOT INITIAL.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Please Check The Entry - Age Block 5-6'.
&nbsp; ENDIF.
&nbsp; IF p_f LE p_e AND p_f IS NOT INITIAL.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Please Check The Entry - Age Block 6-7'.
&nbsp; ENDIF.
&nbsp; IF p_bdci = ' '.
&nbsp; &nbsp; p_ch = ' '.
&nbsp; ENDIF.
&nbsp; IF p_dc = ' ' AND p_reval <> ' '.
&nbsp; &nbsp; MESSAGE e001(38) WITH 'Revaluation only possible when' 'display is in Document Currency'.
&nbsp; ENDIF.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" CHECKING
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;E03_EVENTTAB_BUILD
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp;-->P_GT_EVENTS\[\] &nbsp;text
\*----------------------------------------------------------------------\*
FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
&nbsp; DATA: ls_event TYPE slis_alv_event.
\*
&nbsp; CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
&nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; i_list_type = 0
&nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; et_events &nbsp; = e03_lt_events.
&nbsp; READ TABLE e03_lt_events WITH KEY name = &nbsp;slis_ev_top_of_page
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;INTO ls_event.
&nbsp; IF sy-subrc = 0.
&nbsp; &nbsp; MOVE gc_formname_top_of_page TO ls_event-form.
&nbsp; &nbsp; APPEND ls_event TO e03_lt_events.
&nbsp; ENDIF.
&nbsp; ls_event-name = 'USER_COMMAND'.
&nbsp; ls_event-form = 'VAL'.
&nbsp; APPEND ls_event TO gt_events.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" E03_EVENTTAB_BUILD
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;E04_COMMENT_BUILD
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp;-->P_GT_LIST_TOP_OF_PAGE\[\] &nbsp;text
\*----------------------------------------------------------------------\*
FORM e04_comment_build &nbsp;USING e04_lt_top_of_page TYPE slis_t_listheader.
&nbsp; DATA: ls_line TYPE slis_listheader.
&nbsp; CLEAR ls_line.
&nbsp; ls_line-typ &nbsp;= 'H'.
&nbsp; ls_line-info = 'Customer Ageing Analysis'.
&nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; CLEAR ls_line.
&nbsp; IF s_bukrs\[\] IS NOT INITIAL.
&nbsp; &nbsp; ls_line-typ &nbsp;= 'S'.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; LOOP AT s_bukrs.
&nbsp; &nbsp; &nbsp; CONCATENATE 'Company Code: ' s_bukrs-low
&nbsp; &nbsp; &nbsp; &nbsp; INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; &nbsp; IF s_bukrs-high IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' to ' s_bukrs-high INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; IF s_bukrs-sign = 'E'.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' (Excluded) ' INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; ENDLOOP.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_busab IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Accounting Clerk: ' s_busab-low ' to '
&nbsp; &nbsp; s_busab-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_vbund IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Trading Partner: ' s_vbund-low ' to ' s_vbund-high
&nbsp; &nbsp; &nbsp; INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_kdgrp IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Customer Group: ' s_kdgrp-low ' to '
&nbsp; &nbsp; s_kdgrp-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_vkorg IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Sales Organisation: ' s_vkorg-low ' to '
&nbsp; &nbsp; s_vkorg-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_vtweg IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Distribution Channel: ' s_vtweg-low ' to '
&nbsp; &nbsp; s_vtweg-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_spart IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Division: ' s_spart-low ' to '
&nbsp; &nbsp; s_spart-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_bzirk IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Sales District: ' s_bzirk-low ' to '
&nbsp; &nbsp; s_bzirk-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_kunnr IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
&nbsp; &nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; &nbsp; input &nbsp;= s_kunnr-low
&nbsp; &nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; &nbsp; output = s_kunnr-low.
&nbsp; &nbsp; CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
&nbsp; &nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; &nbsp; input &nbsp;= s_kunnr-high
&nbsp; &nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; &nbsp; output = s_kunnr-high.
&nbsp; &nbsp; CONCATENATE 'Customer: &nbsp; ' s_kunnr-low ' &nbsp;to '
&nbsp; &nbsp; s_kunnr-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF p_lc = 'X'.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; lv_top = 'Display in Local Currency'.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF p_dc = 'X'.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; lv_top = 'Display in Document Currency'.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_gsber IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CONCATENATE 'Business Area: ' s_gsber-low ' to '
&nbsp; &nbsp; s_gsber-high INTO lv_top SEPARATED BY space.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_prctr IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; LOOP AT s_prctr.
&nbsp; &nbsp; &nbsp; CONCATENATE 'Profit center: ' s_prctr-low INTO lv_top
&nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; IF s_prctr-high IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' to ' s_prctr-high INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; IF s_prctr-sign = 'E'.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' (Excluded)' INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; ENDLOOP.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_zzbdiv IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; LOOP AT s_zzbdiv.
&nbsp; &nbsp; &nbsp; CONCATENATE 'Business Division: ' s_zzbdiv-low INTO lv_top
&nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; IF s_zzbdiv-high IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' to ' s_zzbdiv-high INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; IF s_zzbdiv-sign = 'E'.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' (Excluded)' INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; ENDLOOP.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF s_zztdiv IS NOT INITIAL.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; LOOP AT s_zztdiv.
&nbsp; &nbsp; &nbsp; CONCATENATE 'Tax Division: ' s_zztdiv-low INTO lv_top
&nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; IF s_zztdiv-high IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' to ' s_zztdiv-high INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; IF s_zztdiv-sign = 'E'.
&nbsp; &nbsp; &nbsp; &nbsp; CONCATENATE lv_top ' (Excluded)' INTO lv_top
&nbsp; &nbsp; &nbsp; &nbsp; SEPARATED BY space.
&nbsp; &nbsp; &nbsp; ENDIF.
&nbsp; &nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; &nbsp; ENDLOOP.
&nbsp; &nbsp; CLEAR lv_top.
&nbsp; ENDIF.
&nbsp; IF p_date IS NOT INITIAL.
&nbsp; &nbsp; ls_line-typ &nbsp;= 'A'.
&nbsp; &nbsp; ls_line-key &nbsp;= ' '.
&nbsp; &nbsp; CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
&nbsp; &nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; &nbsp; input &nbsp;= p_date
&nbsp; &nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; &nbsp; output = lv_txt.
&nbsp; &nbsp; CONCATENATE 'Analysis Date: ' lv_txt INTO lv_top.
&nbsp; &nbsp; ls_line-info = lv_top.
&nbsp; &nbsp; APPEND ls_line TO e04_lt_top_of_page.
&nbsp; ENDIF.
&nbsp; CLEAR ls_line.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" E04_COMMENT_BUILD
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;top_of_page
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
FORM top_of_page.
&nbsp; CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
&nbsp; &nbsp; &nbsp; &nbsp;EXPORTING
\* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i_logo &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 'HTMLCNTL_TESTHTM2_SAPLOGO'
\* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i_logo &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 'ENJOYSAP_LOGO'
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; it_list_commentary = gt_list_top_of_page.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"TOP_OF_PAGE
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;VAL
\*&---------------------------------------------------------------------\*
FORM val USING user_command LIKE sy-ucomm sel TYPE slis_selfield.
&nbsp; DATA: lv_docno(10).
&nbsp; IF p_detail = 'X'.
&nbsp; &nbsp; READ TABLE i_age INDEX sel-tabindex.
&nbsp; &nbsp; SET PARAMETER ID 'BLN' FIELD i_age-doc_no.
&nbsp; &nbsp; SET PARAMETER ID 'BUK' FIELD i_age-bukrs.
&nbsp; &nbsp; SET PARAMETER ID 'GJR' FIELD i_age-fisc_year.
&nbsp; &nbsp; CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
&nbsp; ENDIF.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "val
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;DATA_CONDENSE
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp;-->P_WA_AGEING_KUNNR &nbsp;text
\*----------------------------------------------------------------------\*
FORM data_condense &nbsp;USING &nbsp; &nbsp;p_data.
&nbsp; CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
&nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; input &nbsp;= p_data
&nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; output = p_data.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" DATA_CONDENSE
\*&---------------------------------------------------------------------\*
\*& &nbsp; &nbsp; &nbsp;Form &nbsp;FOREX_REVAL
\*&---------------------------------------------------------------------\*
\* &nbsp; &nbsp; &nbsp; text
\*----------------------------------------------------------------------\*
\* &nbsp;--> &nbsp;p1 &nbsp; &nbsp; &nbsp; &nbsp;text
\* &nbsp;<-\- &nbsp;p2 &nbsp; &nbsp; &nbsp; &nbsp;text
\*----------------------------------------------------------------------\*
FORM forex_reval .
&nbsp; DATA: wa_rate TYPE bapi1093_0,
&nbsp; &nbsp; &nbsp; &nbsp; wa_ret TYPE bapiret1.
&nbsp; IF i_ageing-currency <> it_t001-waers.
&nbsp; &nbsp; CALL FUNCTION 'BAPI_EXCHANGERATE_GETDETAIL'
&nbsp; &nbsp; &nbsp; EXPORTING
&nbsp; &nbsp; &nbsp; &nbsp; rate_type &nbsp;= 'C'
&nbsp; &nbsp; &nbsp; &nbsp; from_curr &nbsp;= i_ageing-currency
&nbsp; &nbsp; &nbsp; &nbsp; to_currncy = it_t001-waers
&nbsp; &nbsp; &nbsp; &nbsp; date &nbsp; &nbsp; &nbsp; = p_date
&nbsp; &nbsp; &nbsp; IMPORTING
&nbsp; &nbsp; &nbsp; &nbsp; exch_rate &nbsp;= wa_rate
&nbsp; &nbsp; &nbsp; &nbsp; return &nbsp; &nbsp; = wa_ret.
&nbsp; &nbsp; IF wa_ret IS NOT INITIAL.
&nbsp; &nbsp; &nbsp; MESSAGE e000(38) WITH wa_ret-message.
&nbsp; &nbsp; ELSE.
&nbsp; &nbsp; &nbsp; i_ageing-lv_reval = ( i_ageing-lc_amount / wa_rate-from_factor * wa_rate-to_factor ) * wa_rate-exch_rate.
&nbsp; &nbsp; &nbsp; i_ageing-lv_exrate = wa_rate-exch_rate.
&nbsp; &nbsp; ENDIF.
&nbsp; ELSE.
&nbsp; &nbsp; i_ageing-lv_reval = i_ageing-lc_amount.
&nbsp; &nbsp; i_ageing-lv_exrate = '1'.
&nbsp; ENDIF.
&nbsp; i_ageing-lv_exdif = i_ageing-lv_reval - i_ageing-lc_fixamt.
ENDFORM. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" FOREX_REVAL
  • No labels