SAP ABAP应收账款账龄分析表
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
INTO CORRESPONDING FIELDS OF TABLE lt_cust
FROM knc1 AS a
INNER JOIN kna1 AS b ON b~kunnr = a~kunnr
INNER JOIN knb1 AS c ON c~kunnr = a~kunnr AND c~bukrs = a~bukrs
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
gjahr LIKE bsid-gjahr,
monat LIKE bsid-monat,
waers LIKE fdbl_header-waers,
bgber LIKE fdbl_balance_line-balance, "期初余额
SELECTION-SCREEN END OF BLOCK b1.
*---------------------------------------------------------------------*
* INITIALIZATION *
* lt_cust-monat = p_monat.
bera3 LIKE fdbl_balance_line-balance, "账龄61~90天
bera4 LIKE fdbl_balance_line-balance, "账龄91~120天
bera5 LIKE fdbl_balance_line-balance, "账龄121~180天
bukrs LIKE bsid-bukrs,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
gjahr LIKE bsid-gjahr,
monat LIKE id-monat,
waers LIKE fdbl_header-waers,
bgber LIKE fdbl_balance_line-balance, "期初余额
SELECT-OPTIONS: s_bukrs FOR bsid-bukrs NO INTERVALS OBLIGATORY,
s_kunnr FOR bsid-kunnr,
s_ktokd FOR kna1-
ktokd,
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
REPORT zrp_fi_008 LINE-SIZE 800 NO STANDARD PAGE HEADING.
TABLES: kna1, bsid, knb1.
* Global data declaration
TYPE-POOLS: slis.
TYPES:BEGIN OF gt_cust,
s_bukrs-sign = 'I'.
s_bukrs-option = 'EQ'.
s_bukrs-low = '1000'.
APPEND s_bukrs.
p_gjahr = sy-datum+0(4).
p_monat = sy-datum+4(2).
s_akont FOR knb1-akont.
PARAMETERS: p_gjahr LIKE bsid-gjahr,
p_monat LIKE bsid-monat.
SELECTION-SCREEN SKIP.
PARAMETERS: cb_zero AS CHECKBOX DEFAULT 'X'.
AT SELECTION-SCREEN.
*---------------------------------------------------------------------*
* START-OF-SELECTION *
*&---------------------------------------------------------------------*
*& Report ZRP_FI_008
DATA: lt_cust TYPE gt_cust OCCURS 0 WITH HEADER LINE.
DATA: lt_bsid TYPE gt_bsid OCCURS 0 WITH HEADER LINE.
*---------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data .
DATA: lt_bala LIKE bapi3007_7 OCCURS 0 WITH HEADER LINE,
*---------------------------------------------------------------------*
* Initialization fieldcatalog
INITIALIZATION.
v_gt_repid = sy-repid.
REFRESH: s_bukrs.
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
lt_spec LIKE bapi3007_a OCCURS 0 WITH HEADER LINE.
DATA: lv_days LIKE sy-index.
DATA: lv_budat LIKE sy-datum.
REFRESH: lt_cust.
SELECT a~bukrs a~kunnr a~gjahr b~name1
*---------------------------------------------------------------------*
* Start of Selection
START-OF-SELECTION.
PERFORM get_data.
*---------------------------------------------------------------------*
DATA: v_gt_repid LIKE sy-repid.
DATA: i_gt_events TYPE slis_t_event.
DATA: v_gt_variant LIKE disvariant.
DATA: i_gs_layout TYPE slis_layout_alv.
WHERE a~kunnr IN s_kunnr
AND a~bukrs IN s_bukrs
AND a~gjahr EQ p_gjahr
AND b~ktokd IN s_ktokd
AND c~akont IN s_akont.
LOOP AT lt_cust.
REFRESH: lt_bala, lt_spec.
arber LIKE fdbl_balance_line-balance, "本期销售
pyber LIKE fdbl_balance_line-balance, "本期收款
blber LIKE fdbl_balance_line-balance, "本期余额
* Data variable for use of ALV
DATA: i_gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: i_gt_outtab TYPE t_outtab OCCURS 0 WITH HEADER LINE.
DATA: i_gt_excluding TYPE slis_t_extab.
PERFORM fieldcat_init.
PERFORM eventtab_build.
PERFORM call_alv.
*&---------------------------------------------------------------------*
*& Form GET_DATA
bera6 LIKE fdbl_balance_line-balance, "账龄181~360天
bera7 LIKE fdbl_balance_line-balance, "账龄>360天
END OF t_outtab.
END OF gt_cust.
TYPES:BEGIN OF gt_bsid.
INCLUDE STRUCTURE bsid.
TYPES:END OF gt_bsid.
* GLOBAL STRUCTURE OF LIST
TYPES:BEGIN OF t_outtab,
bukrs LIKE bsid-bukrs,
arber LIKE fdbl_balance_line-balance, "本期销售
pyber LIKE fdbl_balance_line-balance, "本期收款
blber LIKE fdbl_balance_line-balance, "本期余额
* END-OF-SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
* SELECTION SCREEN *
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
bera0 LIKE fdbl_balance_line-balance, "账龄<0天
bera1 LIKE fdbl_balance_line-balance, "账龄0~30天
bera2 LIKE fdbl_balance_line-balance, "账龄31~60天
FROM knc1 AS a
INNER JOIN kna1 AS b ON b~kunnr = a~kunnr
INNER JOIN knb1 AS c ON c~kunnr = a~kunnr AND c~bukrs = a~bukrs
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
gjahr LIKE bsid-gjahr,
monat LIKE bsid-monat,
waers LIKE fdbl_header-waers,
bgber LIKE fdbl_balance_line-balance, "期初余额
SELECTION-SCREEN END OF BLOCK b1.
*---------------------------------------------------------------------*
* INITIALIZATION *
* lt_cust-monat = p_monat.
bera3 LIKE fdbl_balance_line-balance, "账龄61~90天
bera4 LIKE fdbl_balance_line-balance, "账龄91~120天
bera5 LIKE fdbl_balance_line-balance, "账龄121~180天
bukrs LIKE bsid-bukrs,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
gjahr LIKE bsid-gjahr,
monat LIKE id-monat,
waers LIKE fdbl_header-waers,
bgber LIKE fdbl_balance_line-balance, "期初余额
SELECT-OPTIONS: s_bukrs FOR bsid-bukrs NO INTERVALS OBLIGATORY,
s_kunnr FOR bsid-kunnr,
s_ktokd FOR kna1-
ktokd,
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
REPORT zrp_fi_008 LINE-SIZE 800 NO STANDARD PAGE HEADING.
TABLES: kna1, bsid, knb1.
* Global data declaration
TYPE-POOLS: slis.
TYPES:BEGIN OF gt_cust,
s_bukrs-sign = 'I'.
s_bukrs-option = 'EQ'.
s_bukrs-low = '1000'.
APPEND s_bukrs.
p_gjahr = sy-datum+0(4).
p_monat = sy-datum+4(2).
s_akont FOR knb1-akont.
PARAMETERS: p_gjahr LIKE bsid-gjahr,
p_monat LIKE bsid-monat.
SELECTION-SCREEN SKIP.
PARAMETERS: cb_zero AS CHECKBOX DEFAULT 'X'.
AT SELECTION-SCREEN.
*---------------------------------------------------------------------*
* START-OF-SELECTION *
*&---------------------------------------------------------------------*
*& Report ZRP_FI_008
DATA: lt_cust TYPE gt_cust OCCURS 0 WITH HEADER LINE.
DATA: lt_bsid TYPE gt_bsid OCCURS 0 WITH HEADER LINE.
*---------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data .
DATA: lt_bala LIKE bapi3007_7 OCCURS 0 WITH HEADER LINE,
*---------------------------------------------------------------------*
* Initialization fieldcatalog
INITIALIZATION.
v_gt_repid = sy-repid.
REFRESH: s_bukrs.
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
lt_spec LIKE bapi3007_a OCCURS 0 WITH HEADER LINE.
DATA: lv_days LIKE sy-index.
DATA: lv_budat LIKE sy-datum.
REFRESH: lt_cust.
SELECT a~bukrs a~kunnr a~gjahr b~name1
*---------------------------------------------------------------------*
* Start of Selection
START-OF-SELECTION.
PERFORM get_data.
*---------------------------------------------------------------------*
DATA: v_gt_repid LIKE sy-repid.
DATA: i_gt_events TYPE slis_t_event.
DATA: v_gt_variant LIKE disvariant.
DATA: i_gs_layout TYPE slis_layout_alv.
WHERE a~kunnr IN s_kunnr
AND a~bukrs IN s_bukrs
AND a~gjahr EQ p_gjahr
AND b~ktokd IN s_ktokd
AND c~akont IN s_akont.
LOOP AT lt_cust.
REFRESH: lt_bala, lt_spec.
arber LIKE fdbl_balance_line-balance, "本期销售
pyber LIKE fdbl_balance_line-balance, "本期收款
blber LIKE fdbl_balance_line-balance, "本期余额
* Data variable for use of ALV
DATA: i_gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: i_gt_outtab TYPE t_outtab OCCURS 0 WITH HEADER LINE.
DATA: i_gt_excluding TYPE slis_t_extab.
PERFORM fieldcat_init.
PERFORM eventtab_build.
PERFORM call_alv.
*&---------------------------------------------------------------------*
*& Form GET_DATA
bera6 LIKE fdbl_balance_line-balance, "账龄181~360天
bera7 LIKE fdbl_balance_line-balance, "账龄>360天
END OF t_outtab.
END OF gt_cust.
TYPES:BEGIN OF gt_bsid.
INCLUDE STRUCTURE bsid.
TYPES:END OF gt_bsid.
* GLOBAL STRUCTURE OF LIST
TYPES:BEGIN OF t_outtab,
bukrs LIKE bsid-bukrs,
arber LIKE fdbl_balance_line-balance, "本期销售
pyber LIKE fdbl_balance_line-balance, "本期收款
blber LIKE fdbl_balance_line-balance, "本期余额
* END-OF-SELECTION *
*---------------------------------------------------------------------*
END-OF-SELECTION.
* SELECTION SCREEN *
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
bera0 LIKE fdbl_balance_line-balance, "账龄<0天
bera1 LIKE fdbl_balance_line-balance, "账龄0~30天
bera2 LIKE fdbl_balance_line-balance, "账龄31~60天