二维码

abap实现本地化的资产负债表和损益表

Twilight发表于 2014-03-16 21:37Kd330 最后回复于 2018-03-30 08:35 [复制链接] 10114 5

1.设计思路:
SAP没有提供标准的符合中国标准的资产负债表和损益表,需要我们在系统中自定义开发,我们在配置报表版本时都指定了一个项目的编号,一个版本下面都有期其统驭的科目范围,我们可以根据这个项目编号找到相应的科目范围,然后根据科目范围获取科目借贷汇总的值。

SAP中资产负债表的配置图示:
SAP中资产负债表的配置图.jpg

我们传统的资产负债表如下格式:
传统的资产负债表.jpg

我们可以在程序中用项目编号找到其下面的科目范围,然后取科目汇总值,因为资产负债表是固定的,所以我们要建立一个CBO表来存放各个具体的项目和在SAP中对应的项目编号。
最后要强调的是在资产负债表中未分配利润的计算:
未分配利润的期末余额=年初结转额(留存收益的上年余额)+今年截至到本月的盈利额(利润表中有体现)
利润表的思路和资产负债表是一样的。
未分配利润的期末余额.jpg

2.主程序代码:
  1. *&---------------------------------------------------------------------*
  2. *& Report  ZDEMON_032
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*

  8. REPORT  zdemon_032.
  9. INCLUDE zfir00026_top.
  10. INCLUDE zfir00026_cls.
  11. INCLUDE zfir00026_f01.
  12. INCLUDE zfir00026_o01.
  13. INCLUDE zfir00026_i01.
  14. INCLUDE <icon>.

  15. INITIALIZATION.
  16.   p_y = sy-datum+0(4).
  17.   p_m = sy-datum+4(2).

  18. AT SELECTION-SCREEN OUTPUT.
  19.   PERFORM setdis USING p_rpv.
  20.   IF c IS INITIAL.
  21.     PERFORM setlist.
  22.     gv_name = '爱思开实业(上海)商贸有限公司合并财务报表版本'.
  23.     c = 'x'.
  24.     gv_rp = '资产负债表'.
  25.   ELSE.
  26.     PERFORM setpcg USING p_rpv.
  27.     CASE p_rpv.
  28.       WHEN '2070'.
  29.         gv_name = '爱思开实业(上海)商贸有限公司合并财务报表版本'.
  30.       WHEN '2071'.
  31.         gv_name = '爱思开实业(上海)商贸有限公总部财务报表版本'.
  32.       WHEN '2072'.
  33.         gv_name = '爱思开实业(上海)商贸有限公司直营店财务报表版本'.
  34.       WHEN '2073'.
  35.         gv_name = ".
  36.     ENDCASE.
  37.     IF p_rp = 'bs'.
  38.       gv_rp = '资产负债表'.
  39.     ELSE.
  40.       gv_rp = '利润表'.
  41.     ENDIF.
  42.   ENDIF.

  43. START-OF-SELECTION.
  44.   PERFORM synchrodata.
  45.   PERFORM get_data1.
  46. *&———————————————————————*
  47. *&  Include           ZFIR00026_TOP
  48. *&———————————————————————*
  49. *Data definition
  50.   TYPE-POOLS vrm.
  51.   TABLES:faglflexa.
  52.   "同步数据用的凭证抬头表
  53.   DATA:BEGIN OF gt_bkpfsyn OCCURS 0,
  54.   gjahr LIKE bkpf-gjahr,
  55.   bukrs LIKE bkpf-bukrs,
  56.   belnr LIKE bkpf-belnr,
  57.   END OF gt_bkpfsyn.
  58.   DATA ly(4) TYPE n.
  59.   "同步数据用的凭证行项目表(bseg)
  60.   DATA:BEGIN OF gt_bsegsyn OCCURS 0,
  61.   gjahr LIKE bseg-gjahr,
  62.   bukrs LIKE bseg-bukrs,
  63.   belnr LIKE bseg-belnr,
  64.   prctr LIKE bseg-prctr,
  65.   pprct LIKE bseg-pprct,
  66.   buzei LIKE bseg-buzei,
  67.   END OF gt_bsegsyn.
  68.   DATA:BEGIN OF gt_fagasyn OCCURS 0.
  69.           INCLUDE STRUCTURE faglflexa.
  70.   DATA:END OF gt_fagasyn.
  71.   TYPES: ch(3) TYPE c,
  72.   cf(4) TYPE c,
  73.   cgcp(12) TYPE c,
  74.   ok_code LIKE sy-ucomm.
  75.   DATA:c,d,
  76.        gv_bs TYPE ukurs_curr VALUE 1,"倍数
  77.        gv_iden(2).
  78.   "要显示的资产负债表
  79.   DATA:BEGIN OF gt_ALV_bs0 OCCURS 0,
  80.   lct1 TYPE int1,
  81.   item1 TYPE zitem,
  82.   yamt1 TYPE hslvt12,
  83.   ysamt1 TYPE hslvt12,
  84.   lct2 TYPE int1,
  85.   item2 TYPE zitem,
  86.   yamt2 TYPE hslvt12,
  87.   ysamt2 TYPE hslvt12,
  88.   waers LIKE t001-waers,
  89.   END OF  gt_alv_bs0.
  90.   DATA:BEGIN OF gt_bs OCCURS 0,
  91.   ukurs TYPE ukurs_curr,
  92.   gdatu TYPE gdatu_inv,
  93.   END OF gt_bs.
  94.   DATA:gv_mf(5)."the month field
  95. *The report version account information.
  96.   "要显示的利润表
  97.   data:begin of gt_alv_is0 occurs 0,
  98.   lct type int1,
  99.   item type zitem,
  100.   yamt like faglflext-hslvt,"本年累计数
  101.   mamt like faglflext-hslvt,"本月累计数
  102.   waers like t001-waers,
  103.   end of gt_alv_is0.
  104.   "下载数据的内表
  105.   DATA:BEGIN OF gt_alv_is01 OCCURS 0,
  106.           lct TYPE int1,
  107.           item TYPE zitem,
  108.           yamt LIKE faglflext-hslvt,"本年累计数
  109.           mamt LIKE faglflext-hslvt,"本月累计数
  110.        END OF gt_alv_is01.
  111. *利润表下钻数据内表
  112. * –>2012.01.16 CCYU START
  113.   DATA:BEGIN OF gt_skat OCCURS 0,
  114.   saknr LIKE skat-saknr,
  115.   txt50 LIKE skat-txt50,
  116.   END OF gt_skat.
  117. * <–2012.01.16 CCYU END.
  118.   DATA:BEGIN OF gt_alv_is_dp1  OCCURS 0,
  119.   racct LIKE faglflexa-racct,
  120. * –>2012.01.16 CCYU START
  121.   txt50 LIKE skat-txt50,
  122. * <–2012.01.16 CCYU END.
  123.   hsl LIKE faglflexa-hsl,
  124.   END OF gt_alv_is_dp1.
  125. *利润表下钻数据内表
  126.   DATA:BEGIN OF gt_alv_bs_dp1  OCCURS 0,
  127.   racct LIKE faglflexa-racct,
  128. * –>2012.01.16 CCYU START
  129.   txt50 LIKE skat-txt50,
  130. * <–2012.01.16 CCYU END.
  131.   hsl LIKE faglflexa-hsl,
  132.   END OF gt_alv_bs_dp1.
  133.   DATA:BEGIN OF gt_alv_bs_dp2  OCCURS 0,
  134.   racct LIKE faglflexa-racct,
  135. * –>2012.01.16 CCYU START
  136.   txt50 LIKE skat-txt50,
  137. * <–2012.01.16 CCYU END.
  138.   hsl LIKE faglflexa-hsl,
  139.   END OF gt_alv_bs_dp2.
  140.   TYPES:BEGIN OF gs_alv_bs_dp_obj ,
  141.   racct LIKE faglflexa-racct,
  142. * –>2012.01.16 CCYU START
  143.   txt50 LIKE skat-txt50,
  144. * <–2012.01.16 CCYU END.
  145.   hsl LIKE faglflexa-hsl,
  146.   END OF gs_alv_bs_dp_obj.
  147.   DATA:gs_alv_bs_dp_obj1 TYPE gs_alv_bs_dp_obj.
  148.   TYPES:gt_alv_bs_dp TYPE STANDARD TABLE OF gs_alv_bs_dp_obj.
  149. *利润表下钻临时数据内表
  150.   DATA:BEGIN OF gt_alv_is_dp2 OCCURS 0,
  151.   racct LIKE faglflexa-racct,
  152. * –>2012.01.16 CCYU START
  153.   txt50 LIKE skat-txt50,
  154. * <–2012.01.16 CCYU END.
  155.   hsl LIKE faglflexa-hsl,
  156.   END OF gt_alv_is_dp2.
  157.   DATA:BEGIN OF gt_fagl_011zc OCCURS 0,
  158.   versn LIKE fagl_011zc-versn,
  159.   ergsl  LIKE fagl_011zc-ergsl,
  160.   txt45 LIKE fagl_011qt-txt45,
  161.   vonkt LIKE fagl_011zc-vonkt,
  162.   biskt LIKE fagl_011zc-biskt,
  163.   END OF gt_fagl_011zc.
  164.   DATA:BEGIN OF gt_fagl_011qt OCCURS 0,
  165.   ergsl  LIKE fagl_011qt-ergsl,
  166.   txt45 LIKE fagl_011qt-txt45,
  167.   END OF gt_fagl_011qt.
  168.   DATA:BEGIN OF gt_mamt_is OCCURS 0,
  169.   amt LIKE faglflext-hslvt,
  170.   END OF gt_mamt_is.
  171.   RANGES gr_act FOR faglflext-racct.
  172.   DATA:BEGIN OF gt_monv OCCURS 0,
  173.   month(2) TYPE n,
  174.   value LIKE faglflext-hslvt,
  175.   END OF gt_monv.
  176.   DATA:BEGIN OF gs_hsl,
  177.   hsl01 LIKE faglflext-hslvt,
  178.   hsl02 LIKE faglflext-hslvt,
  179.   hsl03 LIKE faglflext-hslvt,
  180.   hsl04 LIKE faglflext-hslvt,
  181.   hsl05 LIKE faglflext-hslvt,
  182.   hsl06 LIKE faglflext-hslvt,
  183.   hsl07 LIKE faglflext-hslvt,
  184.   hsl08 LIKE faglflext-hslvt,
  185.   hsl09 LIKE faglflext-hslvt,
  186.   hsl10 LIKE faglflext-hslvt,
  187.   hsl11 LIKE faglflext-hslvt,
  188.   hsl12 LIKE faglflext-hslvt,
  189.   END OF gs_hsl.
  190.   DATA:BEGIN OF gs_hsl1,
  191.   hsl01 LIKE faglflext-hslvt,
  192.   hsl02 LIKE faglflext-hslvt,
  193.   hsl03 LIKE faglflext-hslvt,
  194.   hsl04 LIKE faglflext-hslvt,
  195.   hsl05 LIKE faglflext-hslvt,
  196.   hsl06 LIKE faglflext-hslvt,
  197.   hsl07 LIKE faglflext-hslvt,
  198.   hsl08 LIKE faglflext-hslvt,
  199.   hsl09 LIKE faglflext-hslvt,
  200.   hsl10 LIKE faglflext-hslvt,
  201.   hsl11 LIKE faglflext-hslvt,
  202.   hsl12 LIKE faglflext-hslvt,
  203.   hslvt LIKE faglflext-hslvt,
  204.   END OF gs_hsl1.
  205.   DATA:gs_alv_is TYPE REF TO cl_gui_alv_grid,"the alv OBJECT FOR IS REPORT
  206.   gs_alv_bs TYPE REF TO cl_gui_alv_grid,"the alv OBJECT FOR bs REPORT
  207.   gs_alv_is_dp1 TYPE REF TO cl_gui_alv_grid,"the alv OBJECT FOR bs REPORT
  208.   gs_alv_bs_dp1 TYPE REF TO cl_gui_alv_grid,"the alv OBJECT FOR bs REPORT
  209.   gs_con TYPE REF TO cl_gui_custom_container,"the contianer OBJECT
  210.   gs_con1 TYPE ref TO cl_gui_custom_container,"the contianer OBJECT
  211.   gs_layout   TYPE lvc_s_layo,"set the LAYOUT OF the alv
  212.   gt_fieldcat TYPE lvc_t_fcat,"the FIELD catelog TABLE
  213.   gs_fieldcat TYPE lvc_s_fcat,"the FIELD catelog WORK AREA
  214.   g_toolbar   TYPE ui_functions,"the toolbar OF the alv
  215.   g_toolbar1   TYPE ui_functions,"the toolbar OF the alv
  216.   gt_sort     TYPE lvc_t_sort,"control the SORT of the alv
  217.   gs_sort     TYPE lvc_s_sort.
  218.   "the work area of the gt_sort
  219. data:gs_dyndoc_id type ref to cl_dd_document ,
  220. gs_dyndoc_id1 type ref to cl_dd_document ,
  221. gs_splitter type ref to cl_gui_splitter_container ,
  222. gs_parent_html type ref to cl_gui_container ,
  223. gs_parent_grid type ref to cl_gui_container ,
  224. gs_splitter1 type ref to cl_gui_splitter_container ,
  225. gs_parent_html1 type ref to cl_gui_container ,
  226. gs_parent_grid1 type ref to cl_gui_container ,
  227. gs_html_cntrl type ref to cl_gui_html_viewer .
  228. *SCREEN DEFINE
  229.   DATA  ok_code.
  230. * –>2012.01.17 CCYU START
  231.   DATA:BEGIN OF gt_head1  OCCURS 0,
  232.   t1(6),
  233.   t2(20),
  234.   t3(20),
  235.   t4(20),
  236.   t5(6),
  237.   t6(20),
  238.   t7(20),
  239.   t8(20),
  240.   END OF gt_head1.
  241.   DATA:BEGIN OF gt_head2  OCCURS 0,
  242.   t1(6),
  243.   t2(20),
  244.   t3(20),
  245.   t4(20),
  246.   END OF gt_head2.
  247.   DATA:BEGIN OF gt_alv_bs01 OCCURS 0,
  248.   lct1 TYPE int1,
  249.   item1 TYPE zitem,
  250.   yamt1 TYPE hslvt12,
  251.   ysamt1 TYPE hslvt12,
  252.   lct2 TYPE int1,
  253.   item2 TYPE zitem,
  254.   yamt2 TYPE hslvt12,
  255.   ysamt2 TYPE hslvt12,
  256.   END OF  gt_alv_bs01.
  257. * <–2012.01.17 CCYU END.
  258.   SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
  259.   "公司代码
  260.   SELECTION-SCREEN BEGIN OF LINE.
  261.   SELECTION-SCREEN POSITION 1.
  262.   SELECTION-SCREEN COMMENT (79) text-002.
  263.   SELECTION-SCREEN END OF LINE.
  264.   "Currency
  265.   SELECTION-SCREEN BEGIN OF LINE.
  266.   SELECTION-SCREEN POSITION 1.                               "从位置1开始输出
  267.   SELECTION-SCREEN COMMENT (7) text-003 FOR FIELD p_curr.
  268.   SELECTION-SCREEN POSITION 15.
  269.   PARAMETERS p_curr TYPE ch AS LISTBOX  VISIBLE LENGTH 12  OBLIGATORY DEFAULT 'cny' .
  270.   SELECTION-SCREEN END OF LINE.
  271.   "report version
  272.   SELECTION-SCREEN BEGIN OF LINE.
  273.   SELECTION-SCREEN POSITION 1.
  274.   SELECTION-SCREEN COMMENT (9) text-004 FOR FIELD p_rpv.
  275.   SELECTION-SCREEN POSITION 15.
  276.   PARAMETERS p_rpv TYPE cf AS LISTBOX VISIBLE LENGTH 12 USER-COMMAND dp OBLIGATORY DEFAULT '2070'.
  277.   SELECTION-SCREEN POSITION 28.
  278.   SELECTION-SCREEN COMMENT (60) gv_name.
  279.   SELECTION-SCREEN END OF LINE.
  280.   "profit center group
  281.   SELECTION-SCREEN BEGIN OF LINE.
  282.   SELECTION-SCREEN POSITION 1.
  283.   SELECTION-SCREEN COMMENT (12) text-005 FOR FIELD p_pcg.
  284.   SELECTION-SCREEN POSITION 15.
  285.   PARAMETERS p_pcg TYPE cgcp AS LISTBOX VISIBLE LENGTH 12 USER-COMMAND dp1 OBLIGATORY.
  286.   SELECTION-SCREEN END OF LINE.
  287.   "profit center
  288.   SELECTION-SCREEN BEGIN OF LINE.
  289.   SELECTION-SCREEN POSITION 1.
  290.   SELECTION-SCREEN COMMENT (12) text-006 FOR FIELD p_pc.
  291.   SELECTION-SCREEN POSITION 15.
  292.   PARAMETERS p_pc TYPE cgcp AS LISTBOX VISIBLE LENGTH 12 MODIF ID pc.
  293.   SELECTION-SCREEN END OF LINE.
  294.   "REPROT
  295.   SELECTION-SCREEN BEGIN OF LINE.
  296.   SELECTION-SCREEN POSITION 1.
  297.   SELECTION-SCREEN COMMENT (12) text-007 FOR FIELD p_rp.
  298.   SELECTION-SCREEN POSITION 15.
  299.   PARAMETERS p_rp TYPE cgcp AS LISTBOX VISIBLE LENGTH 12 USER-COMMAND rp OBLIGATORY DEFAULT 'bs'.
  300.   SELECTION-SCREEN COMMENT (12) gv_rp.
  301.   SELECTION-SCREEN END OF LINE.
  302.   "YEAR
  303.   SELECTION-SCREEN BEGIN OF LINE.
  304.   SELECTION-SCREEN POSITION 1.
  305.   SELECTION-SCREEN COMMENT (12) text-008 FOR FIELD p_y.
  306.   SELECTION-SCREEN POSITION 15.
  307.   PARAMETERS p_y(4) TYPE n OBLIGATORY.
  308.   SELECTION-SCREEN END OF LINE.
  309.   "MONTH
  310.   SELECTION-SCREEN BEGIN OF LINE.
  311.   SELECTION-SCREEN POSITION 1.
  312.   SELECTION-SCREEN COMMENT (12) text-009 FOR FIELD p_m.
  313.   SELECTION-SCREEN POSITION 15.
  314. * PARAMETERS P_M(2) TYPE N OBLIGATORY.
  315. * –>2012.01.11 ccyu START
  316.   PARAMETERS p_m(3) TYPE n AS LISTBOX  VISIBLE LENGTH 4 OBLIGATORY.
  317. * <–2012.01.11 ccyu END.
  318.   SELECTION-SCREEN END OF LINE.
  319.   SELECTION-SCREEN END OF BLOCK blk.
  320. *&———————————————————————*
  321. *&———————————————————————*
  322. *&       Class LCL_APP_COMPT
  323. *&———————————————————————*
  324. *        the event handler class for alv
  325. *———————————————————————-*
  326. CLASS lcl_app_compt DEFINITION.
  327.   PUBLIC SECTION .
  328. *the function handle_toolbar which handle the toolbar event of the alv
  329.     METHODS : handle_toolbar FOR EVENT toolbar
  330.     OF cl_gui_alv_grid
  331.     IMPORTING e_object
  332.     e_interactive .
  333. *the function handle_user_command which handle the user_command
  334. *event of the alv
  335.     METHODS: handle_user_command FOR EVENT user_command
  336.     OF cl_gui_alv_grid
  337.     IMPORTING e_ucomm .
  338. *the function handle_topofpage which handle the top of page
  339.     METHODS:handle_topofpage FOR EVENT top_of_page
  340.     OF cl_gui_alv_grid
  341.     IMPORTING e_dyndoc_id .
  342. *handle the hotspot_click事件
  343.     METHODS:handle_hotspot_click FOR EVENT hotspot_click
  344.     OF cl_gui_alv_grid
  345.     IMPORTING e_row_id e_column_id es_row_no.
  346. ENDCLASS.               "LCL_APP_COMPT
  347. *&  Include           ZOOALV_CLS                                       *
  348. *&———————————————————————*
  349. *&———————————————————————*
  350. *&       Class (Implementation)  lcl_app_compt
  351. *&———————————————————————*
  352. *        implementation:for alv
  353. *———————————————————————-*
  354. CLASS lcl_app_compt IMPLEMENTATION.
  355.   METHOD : handle_toolbar .
  356.     PERFORM modify_toolbar USING e_object " .
  357.   ENDMETHOD .                    ":
  358.   ":
  359. method: handle_user_command .
  360.   PERFORM fm_user_command USING e_ucomm .
  361. ENDMETHOD .                    ":
  362. "handle_user_command
  363. *TOP OF PAGE
  364. method: handle_topofpage .
  365. PERFORM fm_add_topofpage USING e_dyndoc_id .
  366. ENDMETHOD .                    ":
  367. "handle_topofpage
  368. method:handle_hotspot_click.
  369. PERFORM drilldownis1 USING e_row_id e_column_id es_row_no.
  370. ENDMETHOD.                    ":
  371. "handle_hotspot_click
  372. endclass.               "lcl_app_compt
  373. *&———————————————————————*
  374. *&  Include           ZFIR00026_F01
  375. *&———————————————————————*
  376. *&———————————————————————*
  377. *&      Form  SETLIST
  378. *&———————————————————————*
  379. *       text
  380. *———————————————————————-*
  381. *  –>  p1        text
  382. *  <–  p2        text
  383. *———————————————————————-*
  384. FORM setlist .
  385.   DATA: itab TYPE STANDARD TABLE OF vrm_value,
  386.   line TYPE vrm_value.
  387.   CLEAR itab[].
  388.   line-key = 'cny'.
  389.   line-text = 'cny'.
  390.   APPEND line TO itab.
  391.   line-key = 'krw'.
  392.   line-text = 'krw'.
  393.   APPEND line TO itab.
  394.   CALL FUNCTION 'vrm_set_values'
  395.     EXPORTING
  396.       id     = 'p_curr'
  397.       values = itab[].
  398.   CLEAR itab[].
  399.   CLEAR line.
  400.   line-key = '2070'.
  401.   line-text = '2070'.
  402.   APPEND line TO itab.
  403.   line-key = '2071'.
  404.   line-text = '2071'.
  405.   APPEND line TO itab.
  406.   line-key = '2072'.
  407.   line-text = '2072'.
  408.   APPEND line TO itab.
  409.   line-key = '2073'.
  410.   line-text = '2073'.
  411.   APPEND line TO itab.
  412.   CALL FUNCTION 'vrm_set_values'
  413.     EXPORTING
  414.       id     = 'p_rpv'
  415.       values = itab[].
  416.   IF p_pcg IS INITIAL.
  417.     CLEAR itab[].
  418.     CLEAR line.
  419.     line-key = 'n207'.
  420.     line-text = 'n207'.
  421.     APPEND line TO itab.
  422.     CALL FUNCTION 'vrm_set_values'
  423.       EXPORTING
  424.         id     = 'p_pcg'
  425.         values = itab[].
  426.   ENDIF.
  427.   CLEAR itab[].
  428.   CLEAR line.
  429.   line-key = 'bs'.
  430.   line-text = 'bs'.
  431.   APPEND line TO itab.
  432.   line-key = 'is'.
  433.   line-text = 'is'.
  434.   APPEND line TO itab.
  435.   CALL FUNCTION 'vrm_set_values'
  436.     EXPORTING
  437.       id     = 'p_rp'
  438.       values = itab[].
  439. * –>2012.01.11 CCYU SRART
  440.   CLEAR itab[].
  441.   CLEAR line.
  442.   line-key = '01'.
  443.   line-text = '01'.
  444.   APPEND line TO itab.
  445.   line-key = '02'.
  446.   line-text = '02'.
  447.   APPEND line TO itab.
  448.   line-key = '03'.
  449.   line-text = '03'.
  450.   APPEND line TO itab.
  451.   line-key = '04'.
  452.   line-text = '04'.
  453.   APPEND line TO itab.
  454.   line-key = '05'.
  455.   line-text = '05'.
  456.   APPEND line TO itab.
  457.   line-key = '06'.
  458.   line-text = '06'.
  459.   APPEND line TO itab.
  460.   line-key = '07'.
  461.   line-text = '07'.
  462.   APPEND line TO itab.
  463.   line-key = '08'.
  464.   line-text = '08'.
  465.   APPEND line TO itab.
  466.   line-key = '09'.
  467.   line-text = '09'.
  468.   APPEND line TO itab.
  469.   line-key = '10'.
  470.   line-text = '10'.
  471.   APPEND line TO itab.
  472.   line-key = '11'.
  473.   line-text = '11'.
  474.   APPEND line TO itab.
  475.   line-key = '12'.
  476.   line-text = '12'.
  477.   APPEND line TO itab.
  478.   CALL FUNCTION 'vrm_set_values'
  479.     EXPORTING
  480.       id     = 'p_m'
  481.       values = itab[].
  482.   "  if p_pcg is initial.
  483.   "    clear itab[].
  484.   "    call function 'vrm_set_values'
  485.   "      exporting
  486.   "        id     = 'p_pc'
  487.   "        values = itab[].
  488.   "  else.
  489.   PERFORM setpcg USING p_rpv.
  490.   "  endif.
  491. * <–2012.01.11 CCYU END.
  492. ENDFORM.                    "setlist
  493. " setlist
  494. *&———————————————————————*
  495. *&      Form  SETPCG
  496. *&———————————————————————*
  497. *       text
  498. *———————————————————————-*
  499. *      SET THE PROFIT CENTER GROUP
  500. *———————————————————————-*
  501. form setpcg  using p.
  502. DATA: itab TYPE STANDARD TABLE OF vrm_value,
  503. line TYPE vrm_value.
  504. CLEAR: itab[],line.
  505. "CLEAR p_pcg.
  506. IF p = '2070'.
  507.   line-key = 'n207'.
  508.   line-text = 'n207'.
  509.   APPEND line TO itab.
  510.   CALL FUNCTION 'vrm_set_values'
  511.     EXPORTING
  512.       id     = 'p_pcg'
  513.       values = itab[].
  514.   p_pcg = 'n207'.
  515.   CLEAR itab[].
  516.   "  append line to itab.
  517.   CALL FUNCTION 'vrm_set_values'
  518.     EXPORTING
  519.       id     = 'p_pc'
  520.       values = itab[].
  521.   CLEAR d.
  522. ELSE.
  523.   CLEAR itab[].
  524.   CLEAR p_pc.
  525.   CALL FUNCTION 'vrm_set_values'
  526.     EXPORTING
  527.       id     = 'p_pc'
  528.       values = itab[].
  529.   IF d IS INITIAL.
  530.     SELECT DISTINCT setname AS key setname AS text FROM setleaf
  531.     INTO CORRESPONDING FIELDS OF TABLE itab
  532.     WHERE subclass = 'n207' AND setclass = '0106'.
  533.     IF itab[] IS NOT  INITIAL.
  534.       CALL FUNCTION 'vrm_set_values'
  535.         EXPORTING
  536.           id     = 'p_pcg'
  537.           values = itab[].
  538.       READ TABLE itab INTO line INDEX 1.
  539.       p_pcg = line-key.
  540.       CLEAR itab[].
  541.       SELECT DISTINCT valfrom AS key valfrom AS text FROM setleaf
  542.       INTO CORRESPONDING FIELDS OF TABLE itab
  543.       WHERE subclass = 'n207' AND setname = p_pcg AND setclass = '0106'.
  544.       IF itab[] IS NOT INITIAL.
  545.         CALL FUNCTION 'vrm_set_values'
  546.           EXPORTING
  547.             id     = 'p_pc'
  548.             values = itab[].
  549.       ENDIF.
  550.       d = 'x'.
  551.     ENDIF.
  552.   ELSE.
  553.     SELECT DISTINCT valfrom AS key valfrom AS text FROM setleaf
  554.     INTO CORRESPONDING FIELDS OF TABLE itab
  555.     WHERE subclass = 'n207' AND setname = p_pcg AND setclass = '0106'.
  556.     IF itab[] IS NOT INITIAL.
  557.       CALL FUNCTION 'vrm_set_values'
  558.         EXPORTING
  559.           id     = 'p_pc'
  560.           values = itab[].
  561.     ENDIF.
  562.     CLEAR itab[].
  563.   ENDIF.
  564. ENDIF.
  565. ENDFORM.                    "setlist
  566. " setpcg
  567. *&———————————————————————*
  568. *&      Form  SETDIS
  569. *&———————————————————————*
  570. *       set the disable of the profit center
  571. *———————————————————————-*
  572. *      –>P_P_RPV  text
  573. *———————————————————————-*
  574. form setdis  using p.
  575. LOOP AT SCREEN.
  576. IF p = '2070'.
  577.   IF screen-group1 = 'pc'.
  578.     screen-input = '0'.
  579.   ENDIF.
  580. ENDIF.
  581. MODIFY SCREEN.
  582. ENDLOOP.
  583. ENDFORM.                    "setlist
  584. " setdis
  585. *&———————————————————————*
  586. *&      Form  GET_DATA
  587. *&———————————————————————*
  588. *       text
  589. *———————————————————————-*
  590. *  –>  p1        text
  591. *  <–  p2        text
  592. *———————————————————————-*
  593. form get_data1 .
  594. PERFORM getrv."获取报表项目对应的科目范围
  595. endform.
  596. " get_data
  597. *&———————————————————————*
  598. *&      Form  GETRV
  599. *&———————————————————————*
  600. *       get the report item  and the account range
  601. *———————————————————————-*
  602. *  –>  p1        text
  603. *  <–  p2        text
  604. *———————————————————————-*
  605. form getrv .
  606. CLEAR gt_fagl_011zc[].
  607. SELECT versn
  608. ergsl
  609. vonkt
  610. biskt
  611. FROM fagl_011zc INTO CORRESPONDING FIELDS OF TABLE gt_fagl_011zc
  612. WHERE versn = p_rpv.
  613. IF gt_fagl_011zc[] IS NOT  INITIAL.
  614. SELECT DISTINCT ergsl
  615. txt45
  616. INTO CORRESPONDING FIELDS OF TABLE gt_fagl_011qt
  617. FROM fagl_011qt FOR ALL ENTRIES IN gt_fagl_011zc
  618. WHERE versn = p_rpv AND ergsl = gt_fagl_011zc-ergsl.
  619. IF gt_fagl_011qt[] IS NOT INITIAL.
  620. SORT gt_fagl_011qt BY ergsl.
  621. LOOP AT gt_fagl_011zc.
  622.   READ TABLE gt_fagl_011qt WITH KEY ergsl = gt_fagl_011zc-ergsl BINARY SEARCH.
  623.   IF sy-subrc = 0.
  624.     gt_fagl_011zc-txt45 = gt_fagl_011qt-txt45.
  625.   ENDIF.
  626.   MODIFY gt_fagl_011zc.
  627. ENDLOOP.
  628. ENDIF.
  629. IF p_curr = 'krw'.
  630. PERFORM getbs.
  631. ENDIF.
  632. ly = p_y - 1."取去年
  633. call function 'conversion_exit_alpha_input'
  634. exporting
  635. input  = p_m
  636. importing
  637. output = p_m.
  638. IF p_rp = 'bs'.
  639. CLEAR gt_alv_bs0[].
  640. PERFORM setbsitem.
  641. SORT gt_alv_bs0 BY lct1 ASCENDING.
  642. DATA:lv_pro(10) TYPE p DECIMALS 2 VALUE '3',
  643. lv_i(10) TYPE p DECIMALS 2 VALUE '3'.
  644. "为核算固定资产等项目设置的临时变量
  645. DATA:a1601_1 TYPE hslvt12,
  646. a1601_2 TYPE hslvt12,
  647. a1602_1 TYPE hslvt12,
  648. a1602_2 TYPE hslvt12,
  649. a1603_1 TYPE hslvt12,
  650. a1603_2 TYPE hslvt12,
  651. a4001_1 TYPE hslvt12,
  652. a4001_2 TYPE hslvt12,
  653. a3103_1 TYPE hslvt12,
  654. a3103_2 TYPE hslvt12,
  655. a4104_1 TYPE hslvt12,
  656. a4104_2 TYPE hslvt12,
  657. a4102_1 TYPE hslvt12,
  658. a4102_2 TYPE hslvt12,
  659. a13yamt1 TYPE hslvt12,
  660. a13ysamt1 TYPE hslvt12,
  661. a14yamt2 TYPE hslvt12,
  662. a14ysamt2 TYPE hslvt12,
  663. a23yamt2 TYPE hslvt12,
  664. a23ysamt2 TYPE hslvt12,
  665. a24yamt2 TYPE hslvt12,
  666. a24ysamt2 TYPE hslvt12,
  667. a31yamt2 TYPE hslvt12,
  668. a31ysamt2 TYPE hslvt12,
  669. a32yamt1 TYPE hslvt12,
  670. a32ysamt1 TYPE hslvt12,
  671. a33yamt1 TYPE hslvt12,
  672. a33ysamt1 TYPE hslvt12,
  673. a33yamt2 TYPE hslvt12,
  674. a33ysamt2 TYPE hslvt12,
  675. a30yamt2 TYPE hslvt12,
  676. a30ysamt2 TYPE hslvt12,
  677. a26yamt2 TYPE hslvt12,
  678. a26ysamt2 TYPE hslvt12,
  679. a27yamt2 TYPE hslvt12,
  680. a27ysamt2 TYPE hslvt12,
  681. a29yamt2 TYPE hslvt12,
  682. a29ysamt2 TYPE hslvt12.
  683. "构造科目查询范围的查询条件
  684. LOOP AT gt_alv_bs0.
  685.   IF gt_alv_bs0-item1 = '货币资金'.
  686.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1000' ly,
  687.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2001' ly.
  688.   ELSEIF gt_alv_bs0-item1 = '交易性金融资产'.
  689.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1101' ly,
  690.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2010' ly.
  691.   ELSEIF gt_alv_bs0-item1 = '应收票据'.
  692.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1121' ly,
  693.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2201' ly.
  694.   ELSEIF gt_alv_bs0-item1 = '应收账款'.
  695.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1122' ly,
  696.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2202' ly.
  697.   ELSEIF gt_alv_bs0-item1 = '预付款项'.
  698.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1123' ly,
  699.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2203' ly.
  700.   ELSEIF gt_alv_bs0-item1 = '应收利息'.
  701.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1132' ly,
  702.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2211' ly.
  703.   ELSEIF gt_alv_bs0-item1 = '应收股利'.
  704.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1131' ly,
  705.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2221' ly.
  706.   ELSEIF gt_alv_bs0-item1 = '其他应收款'.
  707.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1221' ly,
  708.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2231' ly.
  709.   ELSEIF gt_alv_bs0-item1 = '存货'.
  710.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1400' ly,
  711.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2232' ly.
  712.   ELSEIF gt_alv_bs0-item1 = '一年内到期的非流动资产'.
  713.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1507' ly,
  714.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2241' ly.
  715.   ELSEIF gt_alv_bs0-item1 = '其他流动资产'.
  716.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1499' ly,
  717.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2240' ly.
  718.   ELSEIF gt_alv_bs0-item1 = '流动资产合计'.
  719.     PERFORM getbsamt USING gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2222' ly.
  720.   ELSEIF gt_alv_bs0-item1 = '可供出售金融资产'.
  721.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1503' ly.
  722.   ELSEIF gt_alv_bs0-item1 = '持有至到期投资'.
  723.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1501' ly,
  724.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2501' ly.
  725.   ELSEIF gt_alv_bs0-item1 = '长期应收款'.
  726.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1504' ly,
  727.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2502' ly.
  728.   ELSEIF gt_alv_bs0-item1 = '长期股权投资'.
  729.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1511' ly,
  730.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2701' ly.
  731.   ELSEIF gt_alv_bs0-item1 = '投资性房地产'.
  732.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1521' ly,
  733.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2711' ly.
  734.   ELSEIF gt_alv_bs0-item1 = '固定资产'.
  735.     CLEAR:a1601_1,a1601_2,a1602_1,a1602_2,a1603_1,a1603_2.
  736.     PERFORM getbsamt USING:a1601_1 a1601_2 '1601' ly,
  737.     a1602_1 a1602_2 '1602' ly,
  738.     a1603_1 a1603_2 '1603' ly,
  739.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2801' ly.
  740.     gt_alv_bs0-yamt1 = a1601_1 + a1602_1 + a1603_1.
  741.     gt_alv_bs0-ysamt1 = a1601_2 + a1602_2 + a1603_2.
  742.   ELSEIF gt_alv_bs0-item1 = '在建工程'.
  743.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1604' ly,
  744.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2901' ly.
  745.   ELSEIF gt_alv_bs0-item1 = '工程物资'.
  746.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1605' ly,
  747.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '2000' ly.
  748.   ELSEIF gt_alv_bs0-item1 = '固定资产清理'.
  749.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1606' ly.
  750.   ELSEIF gt_alv_bs0-item1 = '无形资产'.
  751.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1701' ly,
  752.     a4001_1 a4001_2 '4001' ly,
  753.     a3103_1 a3103_2 '3103' ly.
  754.     gt_alv_bs0-yamt2 = a4001_1 + a3103_1.
  755.     gt_alv_bs0-ysamt2 = a4001_2 + a3103_2.
  756.   ELSEIF gt_alv_bs0-item1 = '开发支出'.
  757.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1710' ly,
  758.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '4002' ly.
  759.   ELSEIF gt_alv_bs0-item1 = '商誉'.
  760.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1711' ly.
  761.   ELSEIF gt_alv_bs0-item1 = '长期待摊费用'.
  762.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1801' ly,
  763.     gt_alv_bs0-yamt2 gt_alv_bs0-ysamt2 '4101' ly.
  764.   ELSEIF gt_alv_bs0-item1 = '递延所得税资产'.
  765.     "计算本年利润
  766.     DATA:a TYPE hslvt12,"截止到今年当月的利润
  767.     b TYPE hslvt12.
  768.     "留存收益中的年初利润
  769. perform getbsamt using:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1811' ly.
  770.     PERFORM getisdb.
  771.     READ TABLE gt_alv_is0 INDEX 18.
  772.     a = gt_alv_is0-yamt.
  773.     PERFORM getprofitamt USING b ly.
  774.     gt_alv_bs0-yamt2 = a + b.
  775.     gt_alv_bs0-ysamt2 = b.
  776.     CLEAR gt_alv_is0[].
  777.   ELSEIF gt_alv_bs0-item1 = '其他非流动资产'.
  778.     PERFORM getbsamt USING:gt_alv_bs0-yamt1 gt_alv_bs0-ysamt1 '1901' ly.
  779.   ENDIF.
  780.   MODIFY gt_alv_bs0.
  781.   PERFORM porcess_show USING lv_pro.
  782.   lv_pro = lv_pro + lv_i .
  783. ENDLOOP.
  784. "负债类科目贷方转正,借方转负
  785. LOOP AT gt_alv_bs0 WHERE lct1 BETWEEN 1 AND 29.
  786.   IF gt_alv_bs0-yamt2 LT 0.
  787.     gt_alv_bs0-yamt2 = abs( gt_alv_bs0-yamt2 ).
  788.   ELSE.
  789.     gt_alv_bs0-yamt2 = ( -1 ) * ( gt_alv_bs0-yamt2 ).
  790.   ENDIF.
  791.   IF gt_alv_bs0-ysamt2 LT 0.
  792.     gt_alv_bs0-ysamt2 = abs( gt_alv_bs0-ysamt2 ).
  793.   ELSE.
  794.     gt_alv_bs0-ysamt2 = ( -1 ) * ( gt_alv_bs0-ysamt2 ).
  795.   ENDIF.
  796.   MODIFY gt_alv_bs0.
  797. ENDLOOP.
  798. CLEAR:a13yamt1,
  799. a13ysamt1,
  800. a14yamt2,
  801. a14ysamt2,
  802. a23yamt2,
  803. a23ysamt2,
  804. a24yamt2,
  805. a24ysamt2,
  806. a31yamt2,
  807. a31ysamt2,
  808. a32yamt1,
  809. a32ysamt1,
  810. a33yamt1,
  811. a33ysamt1,
  812. a33yamt2,
  813. a33ysamt2,
  814. a30yamt2,
  815. a30ysamt2,
  816. a26yamt2,
  817. a26ysamt2,
  818. a27yamt2,
  819. a27ysamt2,
  820. a29yamt2,
  821. a29ysamt2.
  822. "对特殊项目进行总计
  823. LOOP AT gt_alv_bs0.
  824.   IF gt_alv_bs0-lct1 BETWEEN 2 AND 12.
  825.     "流动资产
  826. a13yamt1 = gt_alv_bs0-yamt1 + a13yamt1.
  827.     a13ysamt1 = gt_alv_bs0-ysamt1 + a13ysamt1.
  828.   ENDIF.
  829.   IF gt_alv_bs0-lct1 BETWEEN 15 AND 31.
  830.     "非流动资产
  831. a32yamt1 = gt_alv_bs0-yamt1 + a32yamt1.
  832.     a32ysamt1 = gt_alv_bs0-ysamt1 + a32ysamt1.
  833.   ENDIF.
  834.   IF gt_alv_bs0-lct1 BETWEEN 2 AND 13.
  835.     "流动负债
  836. a14yamt2 = gt_alv_bs0-yamt2 + a14yamt2.
  837.     a14ysamt2 = gt_alv_bs0-ysamt2 + a14ysamt2.
  838.   ENDIF.
  839.   IF gt_alv_bs0-lct1 BETWEEN 16 AND 22.
  840.     "非流动负债
  841. a23yamt2 = gt_alv_bs0-yamt2 + a23yamt2.
  842.     a23ysamt2 = gt_alv_bs0-ysamt2 + a23ysamt2.
  843.   ENDIF.
  844.   IF gt_alv_bs0-lct1 BETWEEN 26 AND 30.
  845.     "所有者权益
  846. a31yamt2 = gt_alv_bs0-yamt2 + a31yamt2.
  847.     a31ysamt2 = gt_alv_bs0-ysamt2 + a31ysamt2.
  848.   ENDIF.
  849. ENDLOOP.
  850. a33yamt1 = a13yamt1 + a32yamt1."资产总计
  851. a33ysamt1 = a13ysamt1 + a32ysamt1.
  852. a24yamt2 = a14yamt2 + a23yamt2."负债总计
  853. a24ysamt2 = a14ysamt2 + a23ysamt2.
  854. a33yamt2 = a24yamt2 + a31yamt2."负债+所有者权益
  855. a33ysamt2 = a24ysamt2 + a31ysamt2.
  856. " a30yamt2 = a33yamt1 - a33yamt2.
  857. "a30ysamt2 = a33ysamt1 - a33ysamt2.
  858. *      READ TABLE gt_alv_bs0 WITH KEY lct1 = 26.
  859. *      a26yamt2 = gt_alv_bs0-yamt2.
  860. *      a26ysamt2 = gt_alv_bs0-ysamt2.
  861. *      READ TABLE gt_alv_bs0 WITH KEY lct1 = 27.
  862. *      a27yamt2 = gt_alv_bs0-yamt2.
  863. *      a27ysamt2 = gt_alv_bs0-ysamt2.
  864. *      READ TABLE gt_alv_bs0 WITH KEY lct1 = 29.
  865. *      a29yamt2 = gt_alv_bs0-yamt2.
  866. *      a29ysamt2 = gt_alv_bs0-ysamt2.
  867. *      a30yamt2 = a33yamt1 - a24yamt2 - a26yamt2 - a27yamt2 - a29yamt2."本年利润调平
  868. *      a30ysamt2 = a33ysamt1 - a24ysamt2 - a26ysamt2 - a27ysamt2 - a29ysamt2.
  869. *      a31yamt2 =  a26yamt2 + a27yamt2 + a29yamt2 + a30yamt2.
  870. *      a31ysamt2 =  a26ysamt2 + a27ysamt2 + a29ysamt2 + a30ysamt2.
  871. LOOP AT gt_alv_bs0.
  872.   IF gt_alv_bs0-lct1 = 13.
  873.     gt_alv_bs0-yamt1 = a13yamt1.
  874.     gt_alv_bs0-ysamt1 = a13ysamt1.
  875.   ELSEIF gt_alv_bs0-lct1 = 14.
  876.     gt_alv_bs0-yamt2 = a14yamt2.
  877.     gt_alv_bs0-ysamt2 = a14ysamt2.
  878.   ELSEIF gt_alv_bs0-lct1 = 23.
  879.     gt_alv_bs0-yamt2 = a23yamt2.
  880.     gt_alv_bs0-ysamt2 = a23ysamt2.
  881.   ELSEIF gt_alv_bs0-lct1 = 24.
  882.     gt_alv_bs0-yamt2 = a24yamt2.
  883.     gt_alv_bs0-ysamt2 = a24ysamt2.
  884. *        ELSEIF gt_alv_bs0-lct1 = 30.
  885. *          gt_alv_bs0-yamt2 = a30yamt2.
  886. *          gt_alv_bs0-ysamt2 = a30ysamt2.
  887.   ELSEIF gt_alv_bs0-lct1 = 31.
  888.     gt_alv_bs0-yamt2 = a31yamt2.
  889.     gt_alv_bs0-ysamt2 = a31ysamt2.
  890.   ELSEIF gt_alv_bs0-lct1 = 32.
  891.     gt_alv_bs0-yamt1 = a32yamt1.
  892.     gt_alv_bs0-ysamt1 = a32ysamt1.
  893.   ELSEIF gt_alv_bs0-lct1 = 33.
  894.     gt_alv_bs0-yamt1 = a33yamt1.
  895.     gt_alv_bs0-ysamt1 = a33ysamt1.
  896.     gt_alv_bs0-yamt2 = a33yamt2.
  897.     gt_alv_bs0-ysamt2 = a33ysamt2.
  898.   ENDIF.
  899.   MODIFY gt_alv_bs0.
  900. ENDLOOP.
  901. IF p_curr = 'krw'.
  902.   LOOP AT gt_alv_bs0.
  903.     gt_alv_bs0-yamt1 = gt_alv_bs0-yamt1 * gv_bs.
  904.     gt_alv_bs0-ysamt1 = gt_alv_bs0-ysamt1 * gv_bs.
  905.     gt_alv_bs0-yamt2 = gt_alv_bs0-yamt2 * gv_bs.
  906.     gt_alv_bs0-ysamt2 = gt_alv_bs0-ysamt2 * gv_bs.
  907.     gt_alv_bs0-waers = 'krw'.
  908.     MODIFY gt_alv_bs0.
  909.   ENDLOOP.
  910. ELSE.
  911.   LOOP AT gt_alv_bs0.
  912.     gt_alv_bs0-waers = 'cny'.
  913.     MODIFY gt_alv_bs0.
  914.   ENDLOOP.
  915. ENDIF.
  916. gv_iden = 'bs'.
  917. CALL SCREEN '0100'.
  918. ELSEIF p_rp = 'is'.
  919. PERFORM getisdb.
  920. CALL SCREEN '0200'.
  921. ENDIF.
  922. ENDIF.
  923. ENDFORM.                    "setlist
  924. " getrv
  925. *&———————————————————————*
  926. *&      Form  SETISITEM
  927. *&———————————————————————*
  928. *       fill the profit table
  929. *———————————————————————-*
  930. *  –>  p1        text
  931. *  <–  p2        text
  932. *———————————————————————-*
  933. form setisitem .
  934. gt_alv_is0-lct = 1.
  935. gt_alv_is0-item = '一、营业收入'.
  936. APPEND gt_alv_is0.
  937. gt_alv_is0-lct = 2.
  938. gt_alv_is0-item = ' 减:营业成本'.
  939. APPEND gt_alv_is0.
  940. gt_alv_is0-lct = 3.
  941. gt_alv_is0-item = '  营业税金及附加'.
  942. APPEND gt_alv_is0.
  943. gt_alv_is0-lct = 4.
  944. gt_alv_is0-item = '   销售费用'.
  945. APPEND gt_alv_is0.
  946. gt_alv_is0-lct = 5.
  947. gt_alv_is0-item = '   管理费用'.
  948. APPEND gt_alv_is0.
  949. gt_alv_is0-lct = 6.
  950. gt_alv_is0-item = '   财务费用'.
  951. APPEND gt_alv_is0.
  952. gt_alv_is0-lct = 7.
  953. gt_alv_is0-item = '  资产减值损失'.
  954. APPEND gt_alv_is0.
  955. gt_alv_is0-lct = 8.
  956. gt_alv_is0-item = ' 加:公允价值变动收益(损失以"-"号填列)'.
  957. APPEND gt_alv_is0.
  958. gt_alv_is0-lct = 9.
  959. gt_alv_is0-item = '       投资收益(损失以"-"号填列)'.
  960. APPEND gt_alv_is0.
  961. gt_alv_is0-lct = 10.
  962. gt_alv_is0-item = '    其中:对联营企业和合营企业的投资收益'.
  963. APPEND gt_alv_is0.
  964. gt_alv_is0-lct = 11.
  965. gt_alv_is0-item = '二、营业利润(亏损以"-"号填列)'.
  966. APPEND gt_alv_is0.
  967. gt_alv_is0-lct = 12.
  968. gt_alv_is0-item = '   加:营业外收入'.
  969. APPEND gt_alv_is0.
  970. gt_alv_is0-lct = 13.
  971. gt_alv_is0-item = '   减:营业外支出'.
  972. APPEND gt_alv_is0.
  973. gt_alv_is0-lct = 14.
  974. gt_alv_is0-item = '  其中:非流动资产处置损失'.
  975. APPEND gt_alv_is0.
  976. gt_alv_is0-lct = 15.
  977. gt_alv_is0-item = '  加:以前年度损益调整'.
  978. APPEND gt_alv_is0.
  979. gt_alv_is0-lct = 16.
  980. gt_alv_is0-item = '三、利润总额(亏损总额以"-"号填列)'.
  981. APPEND gt_alv_is0.
  982. gt_alv_is0-lct = 17.
  983. gt_alv_is0-item = '   减:所得税费用'.
  984. APPEND gt_alv_is0.
  985. gt_alv_is0-lct = 18.
  986. gt_alv_is0-item = '四、净利润(净亏损以"-"号填列)'.
  987. APPEND gt_alv_is0.
  988. gt_alv_is0-lct = 19.
  989. gt_alv_is0-item = '五、每股收益:'.
  990. APPEND gt_alv_is0.
  991. gt_alv_is0-lct = 20.
  992. gt_alv_is0-item = '   (一)基本每股收益'.
  993. APPEND gt_alv_is0.
  994. gt_alv_is0-lct = 21.
  995. gt_alv_is0-item = '   (二)稀释每股收益'.
  996. APPEND gt_alv_is0.
  997. ENDFORM.                    "setlist
  998. " setisitem
  999. *&———————————————————————*
  1000. *&      Form  getisamt
  1001. *&———————————————————————*
  1002. *       get the is amount by itemid
  1003. *———————————————————————-*
  1004. form getisamt using  p_yamt
  1005. p_mamt
  1006. value(p_itemid)
  1007. value(p_id).
  1008. "构造科目查询范围的查询条件
  1009. p_yamt = 0.
  1010. p_mamt = 0.
  1011. PERFORM getaccrange USING p_itemid.
  1012. CLEAR gs_hsl.
  1013. REFRESH gt_monv.
  1014. CHECK gr_act[] IS NOT INITIAL.
  1015. CASE p_rpv.
  1016. WHEN '2070'.
  1017. "不考虑利润中心
  1018. if p_id = 4.
  1019. "6600取功能范围1200
  1020. select sum( hsl ) into p_mamt
  1021. from faglflexa
  1022. where ryear = p_y
  1023. and rldnr = '0l'
  1024. and racct in gr_act
  1025. and rbukrs = 'n207'
  1026. and pprctr = ''"抵消内部交易
  1027. and rfarea = '1200'
  1028. and poper = p_m.
  1029. SELECT SUM( hsl ) INTO p_yamt
  1030. FROM faglflexa
  1031. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1032. AND rldnr = '0l'
  1033. AND racct IN gr_act
  1034. AND rbukrs = 'n207'
  1035. AND pprctr = ''"抵消内部交易
  1036. AND rfarea = '1200'.
  1037. ELSEIF p_id = 5.
  1038. "6600取功能范围1300
  1039. select sum( hsl ) into p_mamt
  1040. from faglflexa
  1041. where ryear = p_y
  1042. and rldnr = '0l'
  1043. and racct in gr_act
  1044. and rbukrs = 'n207'
  1045. and pprctr = ''"抵消内部交易
  1046. and rfarea = '1300'
  1047. and poper = p_m.
  1048. SELECT SUM( hsl ) INTO p_yamt
  1049. FROM faglflexa
  1050. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1051. AND rldnr = '0l'
  1052. AND racct IN gr_act
  1053. AND rbukrs = 'n207'
  1054. AND pprctr = ''"抵消内部交易
  1055. AND rfarea = '1300'.
  1056. ELSEIF p_id = 14.
  1057. "按照科目进行取数
  1058. select sum( hsl ) into p_mamt
  1059. from faglflexa
  1060. where ryear = p_y
  1061. and rldnr = '0l'
  1062. and racct between '962101' and '962201'
  1063. and rbukrs = 'n207'
  1064. and pprctr = ''"抵消内部交易
  1065. and poper = p_m.
  1066. SELECT SUM( hsl ) INTO p_yamt
  1067. FROM faglflexa
  1068. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1069. AND rldnr = '0l'
  1070. AND racct BETWEEN '962101' AND '962201'
  1071. AND rbukrs = 'n207'
  1072. AND pprctr = ".
  1073. "抵消内部交易.
  1074. ELSE.
  1075. "正常取
  1076. select sum( hsl ) into p_mamt
  1077. from faglflexa
  1078. where ryear = p_y
  1079. and rldnr = '0l'
  1080. and racct in gr_act
  1081. and rbukrs = 'n207'
  1082. and pprctr = ''"抵消内部交易
  1083. and poper = p_m.
  1084. SELECT SUM( hsl ) INTO p_yamt
  1085. FROM faglflexa
  1086. WHERE  ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1087. AND rldnr = '0l'
  1088. AND racct IN gr_act
  1089. AND rbukrs = 'n207'
  1090. AND pprctr = ".
  1091. "抵消内部交易
  1092. endif.
  1093. WHEN '2071' OR '2072' OR '2073'.
  1094. "自选利润中心组,利润中心可输可不输
  1095. if p_pc <>  ' '.
  1096. IF p_id = 4.
  1097. "6600取功能范围1200
  1098. select sum( hsl ) into p_mamt
  1099. from faglflexa
  1100. where ryear = p_y
  1101. and rldnr = '0l'
  1102. and racct in gr_act
  1103. and rbukrs = 'n207'
  1104. and prctr = p_pc"抵消内部交易
  1105. and rfarea = '1200'
  1106. and poper = p_m.
  1107. SELECT SUM( hsl ) INTO p_yamt
  1108. FROM faglflexa
  1109. WHERE  ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1110. AND rldnr = '0l'
  1111. AND racct IN gr_act
  1112. AND rbukrs = 'n207'
  1113. AND prctr = p_pc"抵消内部交易
  1114. AND rfarea = '1200'.
  1115. ELSEIF p_id = 5.
  1116. "6600取功能范围1300
  1117. select sum( hsl ) into p_mamt
  1118. from faglflexa
  1119. where ryear = p_y
  1120. and rldnr = '0l'
  1121. and racct in gr_act
  1122. and rbukrs = 'n207'
  1123. and prctr = p_pc"抵消内部交易
  1124. and rfarea = '1300'
  1125. and poper = p_m.
  1126. SELECT SUM( hsl ) INTO p_yamt
  1127. FROM faglflexa
  1128. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1129. AND rldnr = '0l'
  1130. AND racct IN gr_act
  1131. AND rbukrs = 'n207'
  1132. AND prctr = p_pc"抵消内部交易
  1133. AND rfarea = '1300'.
  1134. ELSEIF p_id = 14.
  1135. "按照科目进行取数
  1136. select sum( hsl ) into p_mamt
  1137. from faglflexa
  1138. where ryear = p_y
  1139. and rldnr = '0l'
  1140. and racct between '962101' and '962201'
  1141. and rbukrs = 'n207'
  1142. and prctr = p_pc"抵消内部交易
  1143. and poper = p_m.
  1144. SELECT SUM( hsl ) INTO p_yamt
  1145. FROM faglflexa
  1146. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1147. AND rldnr = '0l'
  1148. AND racct BETWEEN '962101' AND '962201'
  1149. AND rbukrs = 'n207'
  1150. AND prctr = p_pc.
  1151. "抵消内部交易.
  1152. ELSE.
  1153. "正常取
  1154. select sum( hsl ) into p_mamt
  1155. from faglflexa
  1156. where ryear = p_y
  1157. and rldnr = '0l'
  1158. and racct in gr_act
  1159. and rbukrs = 'n207'
  1160. and prctr = p_pc"抵消内部交易
  1161. and poper = p_m.
  1162. SELECT SUM( hsl ) INTO p_yamt
  1163. FROM faglflexa
  1164. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1165. AND rldnr = '0l'
  1166. AND racct IN gr_act
  1167. AND rbukrs = 'n207'
  1168. AND prctr = p_pc.
  1169. "抵消内部交易
  1170. endif.
  1171. ELSEIF p_pcg <> '' AND p_pc IS INITIAL.
  1172. "利润中心为空,选取所有的利润中心
  1173. if p_id = 4.
  1174. "6600取功能范围1200
  1175. select sum( hsl ) into p_mamt
  1176. from faglflexa
  1177. where ryear = p_y
  1178. and rldnr = '0l'
  1179. and racct in gr_act
  1180. and rbukrs = 'n207'
  1181. and prctr in ( select valfrom  from setleaf where setname = p_pcg )
  1182. and rfarea = '1200'
  1183. and poper = p_m.
  1184. SELECT SUM( hsl ) INTO p_yamt
  1185. FROM faglflexa
  1186. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1187. AND rldnr = '0l'
  1188. AND racct IN gr_act
  1189. AND rbukrs = 'n207'
  1190. AND prctr IN ( SELECT valfrom  FROM setleaf WHERE setname = p_pcg )
  1191. AND rfarea = '1200'.
  1192. ELSEIF p_id = 5.
  1193. "6600取功能范围1300
  1194. select sum( hsl ) into p_mamt
  1195. from faglflexa
  1196. where ryear = p_y
  1197. and rldnr = '0l'
  1198. and racct in gr_act
  1199. and rbukrs = 'n207'
  1200. and prctr in ( select valfrom  from setleaf where setname = p_pcg )
  1201. and rfarea = '1300'
  1202. and poper = p_m.
  1203. SELECT SUM( hsl ) INTO p_yamt
  1204. FROM faglflexa
  1205. WHERE  ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1206. AND rldnr = '0l'
  1207. AND racct IN gr_act
  1208. AND rbukrs = 'n207'
  1209. AND prctr IN ( SELECT valfrom  FROM setleaf WHERE setname = p_pcg )
  1210. AND rfarea = '1300'.
  1211. ELSEIF p_id = 14.
  1212. "按照科目进行取数
  1213. select sum( hsl ) into p_mamt
  1214. from faglflexa
  1215. where ryear = p_y
  1216. and rldnr = '0l'
  1217. and racct between '962101' and '962201'
  1218. and rbukrs = 'n207'
  1219. and prctr in ( select valfrom  from setleaf where setname = p_pcg )
  1220. and poper = p_m.
  1221. SELECT SUM( hsl ) INTO p_yamt
  1222. FROM faglflexa
  1223. WHERE ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1224. AND rldnr = '0l'
  1225. AND racct BETWEEN '962101' AND '962201'
  1226. AND rbukrs = 'n207'
  1227. AND prctr IN ( SELECT valfrom  FROM setleaf WHERE setname = p_pcg ).
  1228. ELSE.
  1229. "正常取
  1230. select sum( hsl ) into p_mamt
  1231. from faglflexa
  1232. where ryear = p_y
  1233. and rldnr = '0l'
  1234. and racct in gr_act
  1235. and rbukrs = 'n207'
  1236. and prctr in ( select valfrom  from setleaf where setname = p_pcg )
  1237. and poper = p_m.
  1238. SELECT SUM( hsl ) INTO p_yamt
  1239. FROM faglflexa
  1240. WHERE  ( ryear = p_y AND poper BETWEEN '001' AND p_m )
  1241. AND rldnr = '0l'
  1242. AND racct IN gr_act
  1243. AND rbukrs = 'n207'
  1244. AND prctr IN ( SELECT valfrom  FROM setleaf WHERE setname = p_pcg ).
  1245. ENDIF.
  1246. ENDIF.
  1247. ENDCASE.
  1248. "获取结果数值,p_mamt是本期,p_yamt是累计
  1249. IF p_id <> 6.
  1250. p_yamt = abs( p_yamt ).
  1251. p_mamt = abs( p_mamt ).
  1252. ENDIF.
  1253. ENDFORM.                    "setlist
  1254. "getisamt
  1255. *&———————————————————————*
  1256. *&      Form  fillgt_monv
  1257. *&———————————————————————*
  1258. *       FILL THE MONTH VALUE
  1259. *———————————————————————-*
  1260. form fillgt_monv.
  1261. CLEAR gt_monv[].
  1262. gt_monv-month = '01'.
  1263. gt_monv-value = gs_hsl-hsl01.
  1264. APPEND gt_monv.
  1265. gt_monv-month = '02'.
  1266. gt_monv-value = gs_hsl-hsl02.
  1267. APPEND gt_monv.
  1268. gt_monv-month = '03'.
  1269. gt_monv-value = gs_hsl-hsl03.
  1270. APPEND gt_monv.
  1271. gt_monv-month = '04'.
  1272. gt_monv-value = gs_hsl-hsl04.
  1273. APPEND gt_monv.
  1274. gt_monv-month = '05'.
  1275. gt_monv-value = gs_hsl-hsl05.
  1276. APPEND gt_monv.
  1277. gt_monv-month = '06'.
  1278. gt_monv-value = gs_hsl-hsl06.
  1279. APPEND gt_monv.
  1280. gt_monv-month = '07'.
  1281. gt_monv-value = gs_hsl-hsl07.
  1282. APPEND gt_monv.
  1283. gt_monv-month = '08'.
  1284. gt_monv-value = gs_hsl-hsl08.
  1285. APPEND gt_monv.
  1286. gt_monv-month = '09'.
  1287. gt_monv-value = gs_hsl-hsl09.
  1288. APPEND gt_monv.
  1289. gt_monv-month = '10'.
  1290. gt_monv-value = gs_hsl-hsl10.
  1291. APPEND gt_monv.
  1292. gt_monv-month = '11'.
  1293. gt_monv-value = gs_hsl-hsl11.
  1294. APPEND gt_monv.
  1295. gt_monv-month = '12'.
  1296. gt_monv-value = gs_hsl-hsl12.
  1297. APPEND gt_monv.
  1298. ENDFORM.                    "setlist
  1299. "fillgt_monv
  1300. *&———————————————————————*
  1301. *&      Form  FILLGT_MONV1
  1302. *&———————————————————————*
  1303. *       text
  1304. *———————————————————————-*
  1305. form fillgt_monv1.
  1306. CLEAR gt_monv[].
  1307. gt_monv-month = '01'.
  1308. gt_monv-value = gs_hsl1-hsl01.
  1309. APPEND gt_monv.
  1310. gt_monv-month = '02'.
  1311. gt_monv-value = gs_hsl1-hsl02.
  1312. APPEND gt_monv.
  1313. gt_monv-month = '03'.
  1314. gt_monv-value = gs_hsl1-hsl03.
  1315. APPEND gt_monv.
  1316. gt_monv-month = '04'.
  1317. gt_monv-value = gs_hsl1-hsl04.
  1318. APPEND gt_monv.
  1319. gt_monv-month = '05'.
  1320. gt_monv-value = gs_hsl1-hsl05.
  1321. APPEND gt_monv.
  1322. gt_monv-month = '06'.
  1323. gt_monv-value = gs_hsl1-hsl06.
  1324. APPEND gt_monv.
  1325. gt_monv-month = '07'.
  1326. gt_monv-value = gs_hsl1-hsl07.
  1327. APPEND gt_monv.
  1328. gt_monv-month = '08'.
  1329. gt_monv-value = gs_hsl1-hsl08.
  1330. APPEND gt_monv.
  1331. gt_monv-month = '09'.
  1332. gt_monv-value = gs_hsl1-hsl09.
  1333. APPEND gt_monv.
  1334. gt_monv-month = '10'.
  1335. gt_monv-value = gs_hsl1-hsl10.
  1336. APPEND gt_monv.
  1337. gt_monv-month = '11'.
  1338. gt_monv-value = gs_hsl1-hsl11.
  1339. APPEND gt_monv.
  1340. gt_monv-month = '12'.
  1341. gt_monv-value = gs_hsl1-hsl12.
  1342. APPEND gt_monv.
  1343. ENDFORM.                    "setlist
  1344. "fillgt_monv
  1345. *&———————————————————————*
  1346. *&      Form  fm_user_command
  1347. *&———————————————————————*
  1348. *       text
  1349. *———————————————————————-*
  1350. *      –>P_UCOMM    text
  1351. *———————————————————————-*
  1352. form fm_user_command  using    p_ucomm.
  1353. CASE p_ucomm .
  1354. WHEN 'getexc' .
  1355. * –>2012.01.16 CCYU START
  1356. PERFORM get_excel.
  1357. * <–2012.01.16 CCYU END.
  1358. *    WHEN 'Mod'.
  1359. **      CALL METHOD gs_alv->set_frontend_fieldcatalog
  1360. **      CALL METHOD gs_alv->refresh_table_display .
  1361. *    WHEN 'SAVE'.
  1362. *    WHEN 'New'.
  1363. *    WHEN 'Delete'.
  1364. *    WHEN 'IMPO'.
  1365. ENDCASE .
  1366. ENDFORM.                    "setlist
  1367. " fm_user_command
  1368. *&———————————————————————*
  1369. *&      Form  modify_toolbar
  1370. *&———————————————————————*
  1371. *       text
  1372. *———————————————————————-*
  1373. *      –>P_OBJECT       text
  1374. *      –>P_INTERACTIVE  text
  1375. *———————————————————————-*
  1376. form modify_toolbar  using    p_object type ref to
  1377. cl_alv_event_toolbar_set p_interactive .
  1378. * –>2012.01.16 CCYU START
  1379. DATA: ls_toolbar TYPE stb_button .
  1380. CLEAR ls_toolbar.
  1381. MOVE 3      TO ls_toolbar-butn_type .
  1382. APPEND ls_toolbar  TO p_object->mt_toolbar .
  1383. CLEAR ls_toolbar.
  1384. MOVE 'getexc'    TO ls_toolbar-function ."function code
  1385. move icon_xxl   to ls_toolbar-icon .
  1386. "icon
  1387. move '导出excel'    to ls_toolbar-quickinfo .
  1388. "the tip
  1389. move '导出excel'  to ls_toolbar-text.
  1390. MOVE ''  TO ls_toolbar-disabled ."if disabled
  1391. append ls_toolbar  to p_object->mt_toolbar .
  1392. * <–2012.01.16 CCYU END.
  1393. ENDFORM.                    "setlist
  1394. " modify_toolbar
  1395. *&———————————————————————*
  1396. *&      Form  fill_field_category
  1397. *&———————————————————————*
  1398. *       text
  1399. *———————————————————————-*
  1400. *      –>P_SECTION  text
  1401. *      –>P_FNAME    text
  1402. *      –>P_VALUE    text
  1403. *———————————————————————-*
  1404. form fill_field_category  using    p_section
  1405. p_fname
  1406. p_value.
  1407. DATA: l_col(40) .
  1408. FIELD-SYMBOLS <l_fs> .
  1409. IF p_section = 's' .
  1410. CLEAR gs_fieldcat .
  1411. ENDIF .
  1412. CONCATENATE 'gs_fieldcat-' p_fname INTO l_col .
  1413. ASSIGN (l_col) TO <l_fs> .
  1414. MOVE p_value   TO <l_fs> .
  1415. IF p_section = 'e' .
  1416. APPEND gs_fieldcat TO gt_fieldcat .
  1417. ENDIF .
  1418. ENDFORM.                    "setlist
  1419. " fill_field_category
  1420. *&———————————————————————*
  1421. *&      Form  DISPLAYIS
  1422. *&———————————————————————*
  1423. *       text
  1424. *———————————————————————-*
  1425. *  –>  p1        text
  1426. *  <–  p2        text
  1427. *———————————————————————-*
  1428. form displayis .
  1429. PERFORM setlayout.
  1430. PERFORM buildfieldcat_is.
  1431. PERFORM excluding_tb_function.
  1432. ENDFORM.                    "setlist
  1433. " displayis
  1434. *&———————————————————————*
  1435. *&      Form  setlayout
  1436. *&———————————————————————*
  1437. *       text
  1438. *———————————————————————-*
  1439. form setlayout .
  1440. CLEAR gs_layout.
  1441. gs_layout-cwidth_opt = 'x' .
  1442. gs_layout-zebra = 'x' .
  1443. gs_layout-sel_mode = 'a'.
  1444. ENDFORM.                    "setlist
  1445. " set layout
  1446. *&———————————————————————*
  1447. *&      Form  BUILDFIELDCAT_IS
  1448. *&———————————————————————*
  1449. *       text
  1450. *———————————————————————-*
  1451. *  –>  p1        text
  1452. *  <–  p2        text
  1453. *———————————————————————-*
  1454. form buildfieldcat_is .
  1455. CLEAR gt_fieldcat[].
  1456. PERFORM fill_field_category USING :
  1457. 's' 'tabname'   'gt_alv_is0' ,
  1458. "  'scrtext_m' '项目' ,
  1459. "  'outputlen' '20' ,
  1460. 'e' 'fieldname' 'item' ,
  1461. 's' 'tabname'   'gt_alv_is0' ,
  1462. "  'scrtext_m' '行次' ,
  1463. "  'outputlen' '20' ,
  1464. "  'key'       'x',
  1465. 'e' 'fieldname' 'lct' ,
  1466. 's' 'tabname'   'gt_alv_is0' ,
  1467. "  'scrtext_m' '本期金额' ,
  1468. "  'outputlen' '20' ,
  1469. "  'hotspot'   'x',
  1470. 'e' 'fieldname' 'mamt' ,
  1471. 's' 'tabname'   'gt_alv_is0' ,
  1472. "  'scrtext_m' '累计余额' ,
  1473. "  'outputlen' '20' ,
  1474. 'e' 'fieldname' 'yamt' .
  1475. ENDFORM.                    "setlist
  1476. " buildfieldcat_is
  1477. *&———————————————————————*
  1478. *&      Form  fm_add_topofpage
  1479. *&———————————————————————*
  1480. *       text
  1481. *———————————————————————-*
  1482. *      –>P_E_DYNDOC_ID  text
  1483. *———————————————————————-*
  1484. form fm_add_topofpage  using  p_e_dyndoc_id type ref to cl_dd_document.
  1485. DATA l_text(255).
  1486. IF gv_iden = 'is'.
  1487. CALL METHOD gs_dyndoc_id->add_text
  1488. EXPORTING
  1489. text         = '利润表(非金融类)income statement(non-financial enterprise)'
  1490. sap_fontsize = cl_dd_document=>large
  1491. sap_emphasis = cl_dd_document=>strong.
  1492. CALL METHOD gs_dyndoc_id->new_line .
  1493. CONCATENATE p_y '年' '  ' p_m '月' ' 会企02表 单位:' p_curr INTO l_text.
  1494. CALL METHOD gs_dyndoc_id->new_line .
  1495. CALL METHOD gs_dyndoc_id->add_text
  1496. EXPORTING
  1497. text = l_text.
  1498. CALL METHOD gs_dyndoc_id->new_line .
  1499. CALL METHOD gs_dyndoc_id->new_line .
  1500. CALL METHOD gs_dyndoc_id->add_text
  1501. EXPORTING
  1502. text = '爱思开实业(上海)商贸有限公司'.
  1503. PERFORM fm_control_html .
  1504. ELSEIF gv_iden = 'bs'.
  1505. CALL METHOD gs_dyndoc_id->add_text
  1506. EXPORTING
  1507. text                = '资产负债表(非金融类)balance sheet(non-financialenterprise)'
  1508. sap_fontsize        = cl_dd_document=>large
  1509. sap_emphasis        = cl_dd_document=>strong.
  1510. CALL METHOD gs_dyndoc_id->new_line .
  1511. CONCATENATE p_y '年' '  ' p_m '月' ' 会企02表 单位:' p_curr INTO l_text.
  1512. CALL METHOD gs_dyndoc_id->new_line .
  1513. CALL METHOD gs_dyndoc_id->add_text
  1514. EXPORTING
  1515. text = l_text.
  1516. CALL METHOD gs_dyndoc_id->new_line .
  1517. CALL METHOD gs_dyndoc_id->new_line .
  1518. CALL METHOD gs_dyndoc_id->add_text
  1519. EXPORTING
  1520. text = '爱思开实业(上海)商贸有限公司'.
  1521. PERFORM fm_control_html .
  1522. ENDIF.
  1523. ENDFORM.                    "setlist
  1524. " fm_add_topofpage
  1525. *&———————————————————————*
  1526. *&      Form  fm_control_html
  1527. *&———————————————————————*
  1528. *       text
  1529. *———————————————————————-*
  1530. form fm_control_html .
  1531. * Define local variables
  1532. DATA: lv_length        TYPE i,                    " LENGTH
  1533. lv_background_id TYPE sdydo_key VALUE space.
  1534. " background id
  1535. * Creating HTML Control
  1536. if gs_html_cntrl is initial.
  1537. CREATE OBJECT gs_html_cntrl
  1538. EXPORTING
  1539. parent = gs_parent_html.
  1540. ENDIF.
  1541. * Call function 'REUSE_ALV_GRID_COMMENTARY_SET' to set
  1542. CALL FUNCTION 'reuse_alv_grid_commentary_set'
  1543. EXPORTING
  1544. document = gs_dyndoc_id
  1545. bottom   = 'e' "SPACE
  1546. IMPORTING
  1547. length   = lv_length.
  1548. * Get TOP->HTML_TABLE Ready
  1549. CALL METHOD gs_dyndoc_id->merge_document.
  1550. * Set wallpaper
  1551. CALL METHOD gs_dyndoc_id->set_document_background
  1552. EXPORTING
  1553. picture_id = lv_background_id.
  1554. * Connect Top of page document to HTML Control
  1555. gs_dyndoc_id->html_control = gs_html_cntrl.
  1556. * Display Top of page document
  1557. CALL METHOD gs_dyndoc_id->display_document
  1558. EXPORTING
  1559. reuse_control      = 'x'
  1560. parent             = gs_parent_html
  1561. EXCEPTIONS
  1562. html_display_error = 1.
  1563. ENDFORM.                    "setlist
  1564. "fm_control_html
  1565. *&———————————————————————*
  1566. *&      Form  excluding_tb_function
  1567. *&———————————————————————*
  1568. *       text
  1569. *———————————————————————-*
  1570. form excluding_tb_function .
  1571. CLEAR: g_toolbar .
  1572. REFRESH: g_toolbar .
  1573. PERFORM append_alv_exclude_functions TABLES g_toolbar USING :
  1574. cl_gui_alv_grid=>mc_fc_loc_undo          ,
  1575. cl_gui_alv_grid=>mc_fc_auf                 ,
  1576. cl_gui_alv_grid=>mc_fc_average            ,      "mean value
  1577. cl_gui_alv_grid=>mc_fc_back_classic       ,
  1578. cl_gui_alv_grid=>mc_fc_call_abc            ,
  1579. cl_gui_alv_grid=>mc_fc_check               ,
  1580. cl_gui_alv_grid=>mc_fc_call_chain         ,
  1581. cl_gui_alv_grid=>mc_fc_call_crbatch        ,
  1582. cl_gui_alv_grid=>mc_fc_call_crweb         ,
  1583. cl_gui_alv_grid=>mc_fc_call_lineitems      ,
  1584. cl_gui_alv_grid=>mc_fc_call_master_data   ,
  1585. cl_gui_alv_grid=>mc_fc_call_more          ,
  1586. cl_gui_alv_grid=>mc_fc_call_report        ,
  1587. cl_gui_alv_grid=>mc_fc_call_xint          ,
  1588. *          CL_GUI_ALV_GRID=>MC_FC_CALL_XXL            ,"导出EXCEL
  1589. cl_gui_alv_grid=>mc_fc_col_invisible      ,
  1590. cl_gui_alv_grid=>mc_fc_col_optimize       ,
  1591. cl_gui_alv_grid=>mc_fc_count               ,
  1592. cl_gui_alv_grid=>mc_fc_current_variant    ,
  1593. cl_gui_alv_grid=>mc_fc_data_save            ,
  1594. cl_gui_alv_grid=>mc_fc_delete_filter       ,
  1595. cl_gui_alv_grid=>mc_fc_deselect_all        ,
  1596. cl_gui_alv_grid=>mc_fc_detail           ,
  1597. cl_gui_alv_grid=>mc_fc_expcrdata         ,
  1598. cl_gui_alv_grid=>mc_fc_expcrdesig          ,
  1599. cl_gui_alv_grid=>mc_fc_expcrtempl        ,
  1600. cl_gui_alv_grid=>mc_fc_expmdb            ,
  1601. cl_gui_alv_grid=>mc_fc_extend         ,
  1602. cl_gui_alv_grid=>mc_fc_f4                ,
  1603. "         cl_gui_alv_grid=>mc_fc_filter           ,
  1604. "          cl_gui_alv_grid=>mc_fc_find              ,
  1605. "         cl_gui_alv_grid=>mc_fc_fix_columns        ,
  1606. cl_gui_alv_grid=>mc_fc_graph              ,
  1607. cl_gui_alv_grid=>mc_fc_help               ,
  1608. cl_gui_alv_grid=>mc_fc_info           ,
  1609. cl_gui_alv_grid=>mc_fc_load_variant    ,
  1610. cl_gui_alv_grid=>mc_fc_html               ,
  1611. cl_gui_alv_grid=>mc_fc_loc_move_row     ,
  1612. cl_gui_alv_grid=>mc_fc_loc_append_row      ,
  1613. cl_gui_alv_grid=>mc_fc_loc_paste        ,
  1614. cl_gui_alv_grid=>mc_fc_loc_paste_new_row  ,
  1615. cl_gui_alv_grid=>mc_fc_maintain_variant     ,
  1616. cl_gui_alv_grid=>mc_fc_maximum             ,
  1617. cl_gui_alv_grid=>mc_fc_minimum            ,
  1618. cl_gui_alv_grid=>mc_fc_pc_file           ,
  1619. cl_gui_alv_grid=>mc_fc_print              ,
  1620. cl_gui_alv_grid=>mc_fc_print_back           ,
  1621. cl_gui_alv_grid=>mc_fc_print_prev        ,
  1622. cl_gui_alv_grid=>mc_fc_refresh             ,
  1623. cl_gui_alv_grid=>mc_fc_reprep            ,
  1624. cl_gui_alv_grid=>mc_fc_url_copy_to_clipboard ,
  1625. cl_gui_alv_grid=>mc_fc_send              ,
  1626. cl_gui_alv_grid=>mc_fc_separator            ,
  1627. "        cl_gui_alv_grid=>mc_fc_sort               ,
  1628. "       cl_gui_alv_grid=>mc_fc_sort_asc          ,
  1629. "        cl_gui_alv_grid=>mc_fc_sort_dsc            ,
  1630. cl_gui_alv_grid=>mc_fc_subtot            ,
  1631. cl_gui_alv_grid=>mc_fc_sum                ,
  1632. cl_gui_alv_grid=>mc_fc_to_office         ,
  1633. cl_gui_alv_grid=>mc_fc_to_rep_tree       ,
  1634. cl_gui_alv_grid=>mc_fc_unfix_columns       ,
  1635. cl_gui_alv_grid=>mc_fc_views               ,
  1636. cl_gui_alv_grid=>mc_fc_view_crystal       ,
  1637. cl_gui_alv_grid=>mc_fc_view_excel          ,
  1638. cl_gui_alv_grid=>mc_fc_view_grid        ,
  1639. cl_gui_alv_grid=>mc_fc_word_processor      .
  1640. "   cl_gui_alv_grid=>mc_mb_export              .
  1641. ENDFORM.                    "setlist
  1642. " excluding_tb_function
  1643. *&———————————————————————*
  1644. *&      Form  EXCLUDING_TB_FUNCTION1
  1645. *&———————————————————————*
  1646. *       text
  1647. *———————————————————————-*
  1648. form excluding_tb_function1 .
  1649. CLEAR: g_toolbar .
  1650. REFRESH: g_toolbar .
  1651. PERFORM append_alv_exclude_functions TABLES g_toolbar1 USING :
  1652. cl_gui_alv_grid=>mc_fc_loc_undo          ,
  1653. cl_gui_alv_grid=>mc_fc_auf                 ,
  1654. cl_gui_alv_grid=>mc_fc_average            ,      "mean value
  1655. cl_gui_alv_grid=>mc_fc_back_classic       ,
  1656. cl_gui_alv_grid=>mc_fc_call_abc            ,
  1657. cl_gui_alv_grid=>mc_fc_check               ,
  1658. cl_gui_alv_grid=>mc_fc_call_chain         ,
  1659. cl_gui_alv_grid=>mc_fc_call_crbatch        ,
  1660. cl_gui_alv_grid=>mc_fc_call_crweb         ,
  1661. cl_gui_alv_grid=>mc_fc_call_lineitems      ,
  1662. cl_gui_alv_grid=>mc_fc_call_master_data   ,
  1663. cl_gui_alv_grid=>mc_fc_call_more          ,
  1664. cl_gui_alv_grid=>mc_fc_call_report        ,
  1665. cl_gui_alv_grid=>mc_fc_call_xint          ,
  1666. "     cl_gui_alv_grid=>mc_fc_call_xxl            ,"导出excel
  1667. cl_gui_alv_grid=>mc_fc_col_invisible      ,
  1668. cl_gui_alv_grid=>mc_fc_col_optimize       ,
  1669. cl_gui_alv_grid=>mc_fc_count               ,
  1670. cl_gui_alv_grid=>mc_fc_current_variant    ,
  1671. cl_gui_alv_grid=>mc_fc_data_save            ,
  1672. cl_gui_alv_grid=>mc_fc_delete_filter       ,
  1673. cl_gui_alv_grid=>mc_fc_deselect_all        ,
  1674. cl_gui_alv_grid=>mc_fc_detail           ,
  1675. cl_gui_alv_grid=>mc_fc_expcrdata         ,
  1676. cl_gui_alv_grid=>mc_fc_expcrdesig          ,
  1677. cl_gui_alv_grid=>mc_fc_expcrtempl        ,
  1678. cl_gui_alv_grid=>mc_fc_expmdb            ,
  1679. cl_gui_alv_grid=>mc_fc_extend         ,
  1680. cl_gui_alv_grid=>mc_fc_f4                ,
  1681. "         cl_gui_alv_grid=>mc_fc_filter           ,
  1682. "          cl_gui_alv_grid=>mc_fc_find              ,
  1683. "         cl_gui_alv_grid=>mc_fc_fix_columns        ,
  1684. cl_gui_alv_grid=>mc_fc_graph              ,
  1685. cl_gui_alv_grid=>mc_fc_help               ,
  1686. cl_gui_alv_grid=>mc_fc_info           ,
  1687. cl_gui_alv_grid=>mc_fc_load_variant    ,
  1688. cl_gui_alv_grid=>mc_fc_html               ,
  1689. cl_gui_alv_grid=>mc_fc_loc_move_row     ,
  1690. cl_gui_alv_grid=>mc_fc_loc_append_row      ,
  1691. cl_gui_alv_grid=>mc_fc_loc_paste        ,
  1692. cl_gui_alv_grid=>mc_fc_loc_paste_new_row  ,
  1693. cl_gui_alv_grid=>mc_fc_maintain_variant     ,
  1694. cl_gui_alv_grid=>mc_fc_maximum             ,
  1695. cl_gui_alv_grid=>mc_fc_minimum            ,
  1696. cl_gui_alv_grid=>mc_fc_pc_file           ,
  1697. cl_gui_alv_grid=>mc_fc_print              ,
  1698. cl_gui_alv_grid=>mc_fc_print_back           ,
  1699. cl_gui_alv_grid=>mc_fc_print_prev        ,
  1700. cl_gui_alv_grid=>mc_fc_refresh             ,
  1701. cl_gui_alv_grid=>mc_fc_reprep            ,
  1702. cl_gui_alv_grid=>mc_fc_url_copy_to_clipboard ,
  1703. cl_gui_alv_grid=>mc_fc_send              ,
  1704. cl_gui_alv_grid=>mc_fc_separator            ,
  1705. "        cl_gui_alv_grid=>mc_fc_sort               ,
  1706. "       cl_gui_alv_grid=>mc_fc_sort_asc          ,
  1707. "        cl_gui_alv_grid=>mc_fc_sort_dsc            ,
  1708. cl_gui_alv_grid=>mc_fc_subtot            ,
  1709. cl_gui_alv_grid=>mc_fc_sum                ,
  1710. cl_gui_alv_grid=>mc_fc_to_office         ,
  1711. cl_gui_alv_grid=>mc_fc_to_rep_tree       ,
  1712. cl_gui_alv_grid=>mc_fc_unfix_columns       ,
  1713. cl_gui_alv_grid=>mc_fc_views               ,
  1714. cl_gui_alv_grid=>mc_fc_view_crystal       ,
  1715. cl_gui_alv_grid=>mc_fc_view_excel          ,
  1716. cl_gui_alv_grid=>mc_fc_view_grid        ,
  1717. cl_gui_alv_grid=>mc_fc_word_processor      .
  1718. "   cl_gui_alv_grid=>mc_mb_export              .
  1719. ENDFORM.                    "setlist
  1720. " excluding_tb_function
  1721. *&———————————————————————*
  1722. *&      Form  append_alv_exclude_functions
  1723. *&———————————————————————*
  1724. *       text
  1725. *———————————————————————-*
  1726. *      –>PT_EXCLUDE text
  1727. *      –>P_VALUE    text
  1728. *———————————————————————-*
  1729. form append_alv_exclude_functions tables pt_exclude type ui_functions
  1730. using p_value     type ui_func.
  1731. APPEND p_value TO pt_exclude.
  1732. ENDFORM.                    "setlist
  1733. " append_alv_exclude_functions
  1734. *&———————————————————————*
  1735. *&      Form  GETBS
  1736. *&———————————————————————*
  1737. *       text
  1738. *———————————————————————-*
  1739. *  –>  p1        text
  1740. *  <–  p2        text
  1741. *———————————————————————-*
  1742. form getbs .
  1743. SELECT  ukurs
  1744. gdatu
  1745. INTO CORRESPONDING FIELDS OF TABLE gt_bs
  1746. FROM tcurr
  1747. WHERE  fcurr = 'cny'
  1748. AND tcurr = 'krw'
  1749. AND kurst = 'm'
  1750. AND gdatu >= sy-datum
  1751. ORDER BY gdatu ASCENDING.
  1752. IF gt_bs[] IS NOT INITIAL.
  1753. READ TABLE gt_bs INDEX 1.
  1754. gv_bs = gt_bs-ukurs.
  1755. gv_bs = abs( gv_bs ).
  1756. ENDIF.
  1757. ENDFORM.                    "setlist
  1758. " getbs
  1759. *&———————————————————————*
  1760. *&      Form  PPSMARTForms_IS
  1761. *&———————————————————————*
  1762. *       preview the is report
  1763. *———————————————————————-*
  1764. *  –>  p1        text
  1765. *  <–  p2        text
  1766. *———————————————————————-*
  1767. form ppsmartforms_is .
  1768. DATA:lv_dat TYPE zcte.
  1769. CONCATENATE p_y '年  ' p_m '月' INTO lv_dat.
  1770. DATA lv_fm_name TYPE rs38l_fnam.
  1771. DATA: ctrl_param TYPE ssfctrlop,"控制参数
  1772. out_option TYPE ssfcompop.
  1773. "控制选项
  1774. ctrl_param-preview = 'x'.
  1775. out_option-tddest = 'lp01'.
  1776. ctrl_param-no_Dialog = 'x'.
  1777. IF gv_iden = 'is'.
  1778. CALL FUNCTION 'ssf_function_module_name'
  1779. EXPORTING
  1780. formname = 'z_n207_is1'
  1781. IMPORTING
  1782. fm_name  = lv_fm_name.
  1783. IF sy-subrc <> 0.
  1784. EXIT.
  1785. ENDIF.
  1786. CALL FUNCTION lv_fm_name
  1787. EXPORTING
  1788. control_parameters = ctrl_param
  1789. output_options     = out_option
  1790. user_settings      = space
  1791. dates              = lv_dat
  1792. TABLES
  1793. itab_is            = gt_alv_is0[].
  1794. IF sy-subrc <> 0.
  1795. ENDIF.
  1796. ELSE.
  1797. CALL FUNCTION 'ssf_function_module_name'
  1798. EXPORTING
  1799. formname = 'z_n207_bs'
  1800. IMPORTING
  1801. fm_name  = lv_fm_name.
  1802. IF sy-subrc <> 0.
  1803. EXIT.
  1804. ENDIF.
  1805. CALL FUNCTION lv_fm_name
  1806. EXPORTING
  1807. control_parameters = ctrl_param
  1808. output_options     = out_option
  1809. user_settings      = space
  1810. date               = lv_dat
  1811. TABLES
  1812. it_tab             = gt_alv_bs0[].
  1813. IF sy-subrc <> 0.
  1814. ENDIF.
  1815. ENDIF.
  1816. ENDFORM.                    "setlist
  1817. " ppsmartforms_is
  1818. *&———————————————————————*
  1819. *&      Form  SETBSITEM
  1820. *&———————————————————————*
  1821. *       text
  1822. *———————————————————————-*
  1823. *  –>  p1        text
  1824. *  <–  p2        text
  1825. *———————————————————————-*
  1826. form setbsitem .
  1827. SELECT * FROM zn207_bs_item
  1828. INTO  CORRESPONDING FIELDS OF TABLE gt_alv_bs0.
  1829. ENDFORM.                    "setlist
  1830. " setbsitem
  1831. *&———————————————————————*
  1832. *&      Form  GETBSAMT
  1833. *&———————————————————————*
  1834. *       text
  1835. *———————————————————————-*
  1836. *      –>P_YAMT           text   —   期末余额
  1837. *      –>P_YSAMT          text   —   年初余额
  1838. *      –>VALUE(P_ITEMID)  text   —
  1839. *———————————————————————-*
  1840. form getbsamt using  p_yamt
  1841. p_ysamt
  1842. value(p_itemid)
  1843. value(ly).
  1844. p_yamt = 0.
  1845. p_ysamt = 0.
  1846. PERFORM getaccrange USING p_itemid."构造资产负债表项目编号下的科目范围
  1847. check gr_act[] is not initial.
  1848. CASE p_rpv.
  1849. WHEN '2070'.
  1850. "不考虑利润中心
  1851. "本年度截止到查询月的发生额
  1852. select sum( hsl ) into  p_yamt
  1853. from faglflexa
  1854. where ryear = p_y
  1855. and rldnr = '0l'
  1856. and racct in gr_act
  1857. and rbukrs = 'n207'
  1858. and poper between '001' and p_m
  1859. and pprctr = ''.
  1860. "抵消内部交易'
  1861. "截止到去年的发生额
  1862. select sum( hsl ) into  p_ysamt
  1863. from faglflexa
  1864. where ryear le ly
  1865. and rldnr = '0l'
  1866. and racct in gr_act
  1867. and rbukrs = 'n207'
  1868. and pprctr = ''.
  1869. "抵消内部交易'
  1870. p_yamt = p_yamt + p_ysamt.
  1871. WHEN '2071' OR '2072' OR '2073'.
  1872. "自选利润中心组,利润中心可输可不输
  1873. if p_pc <> ''.
  1874. "有利润中心的情况
  1875. "本年度截止到查询月的发生额
  1876. select sum( hsl ) into  p_yamt
  1877. from faglflexa
  1878. where ryear = p_y
  1879. and rldnr = '0l'
  1880. and racct in gr_act
  1881. and rbukrs = 'n207'
  1882. and poper between '001' and p_m
  1883. and prctr = p_pc.
  1884. "抵消内部交易'
  1885. "截止到去年的发生额
  1886. select sum( hsl ) into  p_ysamt
  1887. from faglflexa
  1888. where ryear le ly
  1889. and rldnr = '0l'
  1890. and racct in gr_act
  1891. and rbukrs = 'n207'
  1892. and prctr = p_pc.
  1893. p_yamt = p_yamt + p_ysamt.
  1894. ELSEIF p_pc IS INITIAL AND p_pcg IS NOT INITIAL.
  1895. "利润中心为空,选取所有的利润中心
  1896. "本年度截止到查询月的发生额
  1897. select sum( hsl ) into  p_yamt
  1898. from faglflexa
  1899. where ryear = p_y
  1900. and rldnr = '0l'
  1901. and racct in gr_act
  1902. and rbukrs = 'n207'
  1903. and poper between '001' and p_m
  1904. and prctr in ( select valfrom  from setleaf where setname = p_pcg and subclass = 'n207' and setclass = '0106' ).
  1905. "截止到去年的发生额
  1906. SELECT SUM( hsl ) INTO  p_ysamt
  1907. FROM faglflexa
  1908. WHERE ryear LE ly
  1909. AND rldnr = '0l'
  1910. AND racct IN gr_act
  1911. AND rbukrs = 'n207'
  1912. AND prctr IN ( SELECT valfrom  FROM setleaf WHERE setname = p_pcg AND subclass = 'n207' AND setclass = '0106' ).
  1913. p_yamt = p_yamt + p_ysamt.
  1914. ENDIF.
  1915. ENDCASE.
  1916. " p_yamt = abs( p_yamt )."取消转正
  1917. " p_ysamt = abs( p_ysamt ).
  1918. ENDFORM.                    "setlist
  1919. "getisamt
  1920. *&———————————————————————*
  1921. *&      Form  getprofitamt
  1922. *&———————————————————————*
  1923. *       计算年结留存收益科目的未分配利润
  1924. *———————————————————————-*
  1925. *      –>P_YAMT           text
  1926. *      –>P_YSAMT          text
  1927. *      –>VALUE(P_ITEMID)  text
  1928. *      –>VALUE(LY)        text
  1929. *———————————————————————-*
  1930. form getprofitamt using  p_yamt
  1931. value(ly).
  1932. p_yamt = 0.
  1933. CASE p_rpv.
  1934. WHEN '2070'.
  1935. "不考虑利润中心
  1936. "本年度截止到查询月的发生额
  1937. select sum( hsl ) into  p_yamt
  1938. from faglflexa
  1939. where ryear = ly
  1940. and rldnr = '0l'
  1941. and racct  = '0000465201'
  1942. and rbukrs = 'n207'
  1943. and pprctr = ''.
  1944. "抵消内部交易'
  1945. when '2071' or '2072' or '2073'.
  1946. "自选利润中心组,利润中心可输可不输
  1947. if p_pc <> ''.
  1948. "有利润中心的情况
  1949. select sum( hsl ) into  p_yamt
  1950. from faglflexa
  1951. where ryear = ly
  1952. and rldnr = '0l'
  1953. and racct  = '0000465201'
  1954. and rbukrs = 'n207'
  1955. and prctr = p_pc.
  1956. ELSEIF p_pc IS INITIAL AND p_pcg IS NOT INITIAL.
  1957. "利润中心为空,选取所有的利润中心
  1958. "本年度截止到查询月的发生额
  1959. select sum( hsl ) into  p_yamt
  1960. from faglflexa
  1961. where ryear = ly
  1962. and rldnr = '0l'
  1963. and racct  = '0000465201'
  1964. and rbukrs = 'n207'
  1965. and prctr in ( select valfrom  from setleaf where setname = p_pcg and subclass = 'n207' and setclass = '0106' ).
  1966. ENDIF.
  1967. ENDCASE.
  1968. p_yamt = ( -1 ) * p_yamt.
  1969. ENDFORM.                    "setlist
  1970. "getisamt
  1971. *&———————————————————————*
  1972. *&      Form  SETCON
  1973. *&———————————————————————*
  1974. *       set container for alv
  1975. *———————————————————————-*
  1976. *  –>  p1        text
  1977. *  <–  p2        text
  1978. *———————————————————————-*
  1979. form setcon .
  1980. CREATE OBJECT gs_con
  1981. EXPORTING
  1982. container_name = 'con'.
  1983. CREATE OBJECT gs_dyndoc_id
  1984. EXPORTING
  1985. style = 'alv_grid'.
  1986. CREATE OBJECT gs_splitter                                 "分割为1到5行
  1987. EXPORTING
  1988. parent  = gs_con
  1989. rows    = 2
  1990. columns = 1.
  1991. CALL METHOD gs_splitter->get_container"获取第一行给gs_parent_html
  1992. EXPORTING
  1993. row       = 1
  1994. column    = 1
  1995. RECEIVING
  1996. container = gs_parent_html.
  1997. CALL METHOD gs_splitter->get_container
  1998. EXPORTING
  1999. row       = 2
  2000. column    = 1
  2001. RECEIVING
  2002. container = gs_parent_grid.
  2003. CALL METHOD gs_splitter->set_row_height
  2004. EXPORTING
  2005. id     = 1
  2006. height = 20.
  2007. IF gv_iden = 'is'.
  2008. IF gs_alv_is IS INITIAL.
  2009. CREATE OBJECT gs_alv_is
  2010. EXPORTING
  2011. i_parent = gs_parent_grid.
  2012. ENDIF.
  2013. ELSEIF gv_iden = 'bs'.
  2014. IF gs_alv_bs IS INITIAL.
  2015. CREATE OBJECT gs_alv_bs
  2016. EXPORTING
  2017. i_parent = gs_parent_grid.
  2018. ENDIF.
  2019. ENDIF.
  2020. ENDFORM.                    "setlist
  2021. " setcon
  2022. *&———————————————————————*
  2023. *&      Form  SETCON1
  2024. *&———————————————————————*
  2025. *       text
  2026. *———————————————————————-*
  2027. form setcon1 .
  2028. CREATE OBJECT gs_con1
  2029. EXPORTING
  2030. container_name = 'con1'.
  2031. CREATE OBJECT gs_dyndoc_id1
  2032. EXPORTING
  2033. style = 'alv_grid'.
  2034. CREATE OBJECT gs_splitter1                                "分割为1到5行
  2035. EXPORTING
  2036. parent  = gs_con1
  2037. ROWS    = 1
  2038. COLUMNS = 1.
  2039. *  CALL METHOD GS_SPLITTER1->GET_CONTAINER"获取第一行给GS_PARENT_HTML
  2040. *    EXPORTING
  2041. *      ROW       = 1
  2042. *      COLUMN    = 1
  2043. *    RECEIVING
  2044. *      CONTAINER = GS_PARENT_HTML1.
  2045. CALL METHOD gs_splitter1->get_container
  2046. EXPORTING
  2047. row       = 1
  2048. column    = 1
  2049. RECEIVING
  2050. container = gs_parent_grid1.
  2051. ENDFORM.                    "setlist
  2052. " setcon
  2053. *&———————————————————————*
  2054. *&      Form  DISPLAYBS
  2055. *&———————————————————————*
  2056. *       text
  2057. *———————————————————————-*
  2058. *  –>  p1        text
  2059. *  <–  p2        text
  2060. *———————————————————————-*
  2061. form displaybs .
  2062. PERFORM setlayout .
  2063. PERFORM buildfieldcat_bs.
  2064. PERFORM excluding_tb_function.
  2065. ENDFORM.                    "setlist
  2066. " displaybs
  2067. *&———————————————————————*
  2068. *&      Form  BUILDFIELDCAT_BS
  2069. *&———————————————————————*
  2070. *       text
  2071. *———————————————————————-*
  2072. *  –>  p1        text
  2073. *  <–  p2        text
  2074. *———————————————————————-*
  2075. form buildfieldcat_bs .
  2076. CLEAR gt_fieldcat[].
  2077. PERFORM fill_field_category USING :
  2078. 's' 'tabname'   'gt_alv_bs0' ,
  2079. "  'scrtext_m' '行次' ,
  2080. "  'outputlen' '20' ,
  2081. "  'key'       'x',
  2082. "  'col_pos'   '2',
  2083. 'e' 'fieldname' 'lct1' ,
  2084. 's' 'tabname'   'gt_alv_bs0' ,
  2085. "  'scrtext_m' '资产' ,
  2086. "  'outputlen' '20' ,
  2087. "  'col_pos'   '1',
  2088. 'e' 'fieldname' 'item1' ,
  2089. 's' 'tabname'   'gt_alv_bs0' ,
  2090. "  'scrtext_m' '期末余额' ,
  2091. "  'outputlen' '20' ,
  2092. "  'hotspot'   'x',
  2093. "  'col_pos'   '3',
  2094. 'e' 'fieldname' 'yamt1' ,
  2095. 's' 'tabname'   'gt_alv_bs0' ,
  2096. "  'scrtext_m' '年初余额' ,
  2097. "  'outputlen' '20' ,
  2098. "  'col_pos'   '4',
  2099. 'e' 'fieldname' 'ysamt1' ,
  2100. 's' 'tabname'   'gt_alv_bs0' ,
  2101. "  'scrtext_m' '行次' ,
  2102. "  'outputlen' '20' ,
  2103. "  'key'       'x',
  2104. "  'col_pos'   '6',
  2105. 'e' 'fieldname' 'lct2' ,
  2106. 's' 'tabname'   'gt_alv_bs0' ,
  2107. "  'scrtext_m' '负债和所有者权益(或股东权益)' ,
  2108. "  'outputlen' '20' ,
  2109. "  'col_pos'   '5',
  2110. 'e' 'fieldname' 'item2' ,
  2111. 's' 'tabname'   'gt_alv_bs0' ,
  2112. "  'scrtext_m' '期末余额' ,
  2113. "  'col_pos'   '7',
  2114. "  'hotspot'   'x',
  2115. "  'outputlen' '20' ,
  2116. 'e' 'fieldname' 'yamt2' ,
  2117. 's' 'tabname'   'gt_alv_bs0' ,
  2118. "  'scrtext_m' '年初余额' ,
  2119. "  'outputlen' '20' ,
  2120. "  'col_pos'   '8',
  2121. 'e' 'fieldname' 'ysamt2' .
  2122. ENDFORM.                    "setlist
  2123. " buildfieldcat_bs
  2124. *&———————————————————————*
  2125. *&      Form  PRINT
  2126. *&———————————————————————*
  2127. *       text
  2128. *———————————————————————-*
  2129. *  –>  p1        text
  2130. *  <–  p2        text
  2131. *———————————————————————-*
  2132. form print .
  2133. DATA:lv_dat TYPE zcte.
  2134. CONCATENATE p_y '年  ' p_m '月' INTO lv_dat.
  2135. DATA lv_fm_name TYPE rs38l_fnam."定义一个rs38l_fnam类型的变量存储功能模块名
  2136. if gv_iden = 'bs'.
  2137. CALL FUNCTION 'ssf_function_module_name'
  2138. exporting"输入参数,传递smartforms名子
  2139. formname = 'z_n207_bs'
  2140. IMPORTING:"输出参数,返回smartforms激活时生成的功能模块名
  2141. fm_name  = lv_fm_name.
  2142. IF sy-subrc <> 0.
  2143. EXIT.
  2144. ENDIF.
  2145. CALL FUNCTION lv_fm_name
  2146. EXPORTING
  2147. date   = lv_dat
  2148. TABLES
  2149. it_tab = gt_alv_bs0[].
  2150. ELSE.
  2151. CALL FUNCTION 'ssf_function_module_name'
  2152. exporting"输入参数,传递smartforms名子
  2153. formname = 'z_n207_is1'
  2154. IMPORTING:"输出参数,返回smartforms激活时生成的功能模块名
  2155. fm_name  = lv_fm_name.
  2156. IF sy-subrc <> 0.
  2157. EXIT.
  2158. ENDIF.
  2159. CALL FUNCTION lv_fm_name
  2160. EXPORTING
  2161. dates   = lv_dat
  2162. TABLES
  2163. itab_is = gt_alv_is0[].
  2164. ENDIF.
  2165. ENDFORM.                    "setlist
  2166. " print
  2167. *&———————————————————————*
  2168. *&      Form  DRILLDOWNIS1
  2169. *&———————————————————————*
  2170. *       获取利润表和资产负债表中本期金额的详细信息
  2171. *———————————————————————-*
  2172. *      –>P_E_ROW_ID  text
  2173. *      –>P_E_COLUMN_ID  text
  2174. *      –>P_ES_ROW_NO  text
  2175. *———————————————————————-*
  2176. form drilldownis1  using    p_e_row_id
  2177. p_e_column_id type lvc_s_col
  2178. p_es_row_no type lvc_s_roid.
  2179. IF gv_iden = 'is'.
  2180. CLEAR gt_alv_is_dp1[].
  2181. CASE  p_es_row_no-row_id.
  2182. WHEN 1.
  2183. PERFORM getisdpdata USING '6001' p_es_row_no-row_id.
  2184. APPEND LINES OF gt_alv_is_dp1 TO gt_alv_is_dp2.
  2185. PERFORM getisdpdata USING '6100' p_es_row_no-row_id.
  2186. APPEND LINES OF gt_alv_is_dp2 TO gt_alv_is_dp1.
  2187. SORT gt_alv_is_dp1 BY racct ASCENDING.
  2188. CLEAR gt_alv_is_dp2[].
  2189. WHEN 2.
  2190. PERFORM getisdpdata USING '6400' p_es_row_no-row_id.
  2191. APPEND LINES OF gt_alv_is_dp1 TO gt_alv_is_dp2.
  2192. PERFORM getisdpdata USING '6500' p_es_row_no-row_id.
  2193. APPEND LINES OF gt_alv_is_dp2 TO gt_alv_is_dp1.
  2194. CLEAR gt_alv_is_dp2[].
  2195. APPEND LINES OF gt_alv_is_dp1 TO gt_alv_is_dp2.
  2196. PERFORM getisdpdata USING '6610' p_es_row_no-row_id.
  2197. APPEND LINES OF gt_alv_is_dp2 TO gt_alv_is_dp1.
  2198. SORT gt_alv_is_dp1 BY racct ASCENDING.
  2199. CLEAR gt_alv_is_dp2[].
  2200. WHEN 3.
  2201. PERFORM getisdpdata USING '6450' p_es_row_no-row_id.
  2202. WHEN 4.
  2203. PERFORM getisdpdata USING '6600' p_es_row_no-row_id.
  2204. WHEN 5.
  2205. PERFORM getisdpdata USING '6600' p_es_row_no-row_id.
  2206. WHEN 6.
  2207. PERFORM getisdpdata USING '6620' p_es_row_no-row_id.
  2208. WHEN 7.
  2209. PERFORM getisdpdata USING '6630' p_es_row_no-row_id.
  2210. WHEN 8.
  2211. PERFORM getisdpdata USING '6640' p_es_row_no-row_id.
  2212. WHEN 9.
  2213. PERFORM getisdpdata USING '6645' p_es_row_no-row_id.
  2214. WHEN 12.
  2215. PERFORM getisdpdata USING '6301' p_es_row_no-row_id.
  2216. WHEN 13.
  2217. PERFORM getisdpdata USING '6711' p_es_row_no-row_id.
  2218. WHEN 14.
  2219. PERFORM getisdpdata USING '0000' p_es_row_no-row_id.
  2220. WHEN 15.
  2221. PERFORM getisdpdata USING '6901' p_es_row_no-row_id.
  2222. WHEN 17.
  2223. PERFORM getisdpdata USING '6801' p_es_row_no-row_id.
  2224. ENDCASE.
  2225. * –>2012.01.16 CCYU START
  2226. IF gt_alv_is_dp1[] IS NOT INITIAL.
  2227. SELECT saknr txt50
  2228. FROM skat
  2229. INTO CORRESPONDING FIELDS OF TABLE gt_skat
  2230. FOR ALL ENTRIES IN gt_alv_is_dp1
  2231. WHERE saknr = gt_alv_is_dp1-racct
  2232. AND spras = '1'
  2233. AND ktopl = 'skgc'.
  2234. ENDIF.
  2235. SORT gt_alv_is_dp1 BY racct.
  2236. SORT gt_skat BY saknr.
  2237. LOOP AT gt_alv_is_dp1.
  2238. READ TABLE gt_skat WITH KEY saknr = gt_alv_is_dp1-racct.
  2239. IF sy-subrc = 0.
  2240. gt_alv_is_dp1-txt50 = gt_skat-txt50.
  2241. ENDIF.
  2242. MODIFY gt_alv_is_dp1.
  2243. ENDLOOP.
  2244. * <–2012.01.16 CCYU END.
  2245. LOOP AT gt_alv_is_dp1.
  2246. CALL FUNCTION 'conversion_exit_alpha_output'
  2247. EXPORTING
  2248. input  = gt_alv_is_dp1-racct
  2249. IMPORTING
  2250. output = gt_alv_is_dp1-racct.
  2251. MODIFY  gt_alv_is_dp1.
  2252. ENDLOOP.
  2253. IF p_es_row_no-row_id = 10 OR
  2254. p_es_row_no-row_id = 11 OR
  2255. p_es_row_no-row_id = 16 OR
  2256. p_es_row_no-row_id = 18 OR
  2257. p_es_row_no-row_id = 19 OR
  2258. p_es_row_no-row_id = 20 OR
  2259. p_es_row_no-row_id = 21.
  2260. ELSE.
  2261. CALL SCREEN '0300' STARTING AT 10 10 ENDING AT 65 25.
  2262. ENDIF.
  2263. ELSE.
  2264. "资产负债表的下钻报表
  2265. clear gt_alv_bs_dp1[].
  2266. CLEAR gt_alv_bs_dp2[].
  2267. DATA:p_tran(1) VALUE '0'.
  2268. CASE  p_es_row_no-row_id.
  2269. "选中行的行号
  2270. when 2.
  2271. IF p_e_column_id-fieldname = 'yamt1'.
  2272. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1000'.
  2273. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2274. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2001'.
  2275. ENDIF.
  2276. p_tran = '1'.
  2277. WHEN 3.
  2278. IF p_e_column_id-fieldname = 'yamt1'.
  2279. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1101'.
  2280. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2281. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2010'.
  2282. ENDIF.
  2283. p_tran = '1'.
  2284. WHEN 4.
  2285. IF p_e_column_id-fieldname = 'yamt1'.
  2286. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1121'.
  2287. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2288. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2201'.
  2289. ENDIF.
  2290. p_tran = '1'.
  2291. WHEN 5.
  2292. IF p_e_column_id-fieldname = 'yamt1'.
  2293. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1122'.
  2294. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2295. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2202'.
  2296. ENDIF.
  2297. p_tran = '1'.
  2298. WHEN 6.
  2299. IF p_e_column_id-fieldname = 'yamt1'.
  2300. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1123'.
  2301. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2302. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2203'.
  2303. ENDIF.
  2304. p_tran = '1'.
  2305. WHEN 7.
  2306. IF p_e_column_id-fieldname = 'yamt1'.
  2307. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1132'.
  2308. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2309. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2211'.
  2310. ENDIF.
  2311. p_tran = '1'.
  2312. WHEN 8.
  2313. IF p_e_column_id-fieldname = 'yamt1'.
  2314. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1131'.
  2315. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2316. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2221'.
  2317. ENDIF.
  2318. p_tran = '1'.
  2319. WHEN 9.
  2320. IF p_e_column_id-fieldname = 'yamt1'.
  2321. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1221'.
  2322. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2323. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2231'.
  2324. ENDIF.
  2325. p_tran = '1'.
  2326. WHEN 10.
  2327. IF p_e_column_id-fieldname = 'yamt1'.
  2328. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1400'.
  2329. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2330. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2232'.
  2331. ENDIF.
  2332. p_tran = '1'.
  2333. WHEN 11.
  2334. IF p_e_column_id-fieldname = 'yamt1'.
  2335. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1507'.
  2336. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2337. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2241'.
  2338. ENDIF.
  2339. p_tran = '1'.
  2340. WHEN 12.
  2341. IF p_e_column_id-fieldname = 'yamt1'.
  2342. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1499'.
  2343. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2344. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2240'.
  2345. ENDIF.
  2346. p_tran = '1'.
  2347. WHEN 13.
  2348. IF p_e_column_id-fieldname = 'yamt2'.
  2349. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2222'.
  2350. p_tran = '1'.
  2351. ENDIF.
  2352. WHEN 15.
  2353. IF p_e_column_id-fieldname = 'yamt1'.
  2354. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1503'.
  2355. p_tran = '1'.
  2356. ENDIF.
  2357. WHEN 16.
  2358. IF p_e_column_id-fieldname = 'yamt1'.
  2359. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1501'.
  2360. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2361. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2501'.
  2362. ENDIF.
  2363. p_tran = '1'.
  2364. WHEN 17.
  2365. IF p_e_column_id-fieldname = 'yamt1'.
  2366. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1504'.
  2367. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2368. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2502'.
  2369. ENDIF.
  2370. p_tran = '1'.
  2371. WHEN 18.
  2372. IF p_e_column_id-fieldname = 'yamt1'.
  2373. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1511'.
  2374. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2375. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2701'.
  2376. ENDIF.
  2377. p_tran = '1'.
  2378. WHEN 19.
  2379. IF p_e_column_id-fieldname = 'yamt1'.
  2380. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1521'.
  2381. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2382. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2711'.
  2383. ENDIF.
  2384. p_tran = '1'.
  2385. WHEN 20.
  2386. IF p_e_column_id-fieldname = 'yamt2'.
  2387. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2801'.
  2388. p_tran = '1'.
  2389. ENDIF.
  2390. WHEN 21.
  2391. IF p_e_column_id-fieldname = 'yamt1'.
  2392. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1604'.
  2393. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2394. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2901'.
  2395. ENDIF.
  2396. p_tran = '1'.
  2397. WHEN 22.
  2398. IF p_e_column_id-fieldname = 'yamt1'.
  2399. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1605'.
  2400. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2401. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '2000'.
  2402. ENDIF.
  2403. p_tran = '1'.
  2404. WHEN 23.
  2405. IF p_e_column_id-fieldname = 'yamt1'.
  2406. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1606'.
  2407. p_tran = '1'.
  2408. ENDIF.
  2409. WHEN 26.
  2410. IF p_e_column_id-fieldname = 'yamt1'.
  2411. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1701'.
  2412. p_tran = '1'.
  2413. ENDIF.
  2414. WHEN 27.
  2415. IF p_e_column_id-fieldname = 'yamt1'.
  2416. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1710'.
  2417. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2418. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '4002'.
  2419. ENDIF.
  2420. p_tran = '1'.
  2421. WHEN 28.
  2422. IF p_e_column_id-fieldname = 'yamt1'.
  2423. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1711'.
  2424. p_tran = '1'.
  2425. ENDIF.
  2426. WHEN 29.
  2427. IF p_e_column_id-fieldname = 'yamt1'.
  2428. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1801'.
  2429. ELSEIF p_e_column_id-fieldname = 'yamt2'.
  2430. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '4101'.
  2431. ENDIF.
  2432. p_tran = '1'.
  2433. WHEN 30.
  2434. IF p_e_column_id-fieldname = 'yamt1'.
  2435. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1811'.
  2436. p_tran = '1'.
  2437. ENDIF.
  2438. WHEN 31.
  2439. IF p_e_column_id-fieldname = 'yamt1'.
  2440. PERFORM getbsdp TABLES gt_alv_bs_dp1 USING '1901'.
  2441. p_tran = '1'.
  2442. ENDIF.
  2443. ENDCASE.
  2444. * –>2012.01.16 CCYU START
  2445. IF gt_alv_bs_dp1[] IS NOT INITIAL.
  2446. CLEAR gt_skat[].
  2447. SELECT saknr txt50
  2448. FROM skat
  2449. INTO CORRESPONDING FIELDS OF TABLE gt_skat
  2450. FOR ALL ENTRIES IN gt_alv_bs_dp1
  2451. WHERE saknr = gt_alv_bs_dp1-racct
  2452. AND spras = '1'
  2453. AND ktopl = 'skgc'.
  2454. ENDIF.
  2455. SORT gt_alv_bs_dp1 BY racct.
  2456. SORT gt_skat BY saknr.
  2457. LOOP AT gt_alv_bs_dp1.
  2458. READ TABLE gt_skat WITH KEY saknr = gt_alv_bs_dp1-racct.
  2459. IF sy-subrc = 0.
  2460. gt_alv_bs_dp1-txt50 = gt_skat-txt50.
  2461. ENDIF.
  2462. MODIFY gt_alv_bs_dp1.
  2463. ENDLOOP.
  2464. * <–2012.01.16 CCYU END.
  2465. LOOP AT gt_alv_bs_dp1.
  2466. "去除科目编号的前导零
  2467. call function 'conversion_exit_alpha_output'
  2468. exporting
  2469. input  = gt_alv_bs_dp1-racct
  2470. importing
  2471. output = gt_alv_bs_dp1-racct.
  2472. MODIFY  gt_alv_bs_dp1.
  2473. ENDLOOP.
  2474. IF p_tran = '1'.
  2475. CALL SCREEN '0400' STARTING AT 10 10 ENDING AT 65 25.
  2476. ENDIF.
  2477. ENDIF.
  2478. ENDFORM.                    "setlist
  2479. " drilldownis1
  2480. *&———————————————————————*
  2481. *&      Form  GETACCRANGE
  2482. *&———————————————————————*
  2483. *       获取报表版本下的科目范围
  2484. *———————————————————————-*
  2485. *  –>  p1        text
  2486. *  <–  p2        text
  2487. *———————————————————————-*
  2488. form getaccrange using p_itemid.
  2489. CLEAR gr_act[].
  2490. LOOP AT gt_fagl_011zc WHERE ergsl = p_itemid.
  2491. gr_act-sign = 'i'.
  2492. gr_act-low = gt_fagl_011zc-vonkt.
  2493. gr_act-high = gt_fagl_011zc-biskt.
  2494. gr_act-option = 'bt'.
  2495. CALL FUNCTION 'conversion_exit_alpha_input'
  2496. EXPORTING
  2497. input  = gr_act-low
  2498. IMPORTING
  2499. output = gr_act-low.
  2500. CALL FUNCTION 'conversion_exit_alpha_input'
  2501. EXPORTING
  2502. input  = gr_act-high
  2503. IMPORTING
  2504. output = gr_act-high.
  2505. APPEND gr_act.
  2506. ENDLOOP.
  2507. ENDFORM.                    "setlist
  2508. " getaccrange
  2509. *&———————————————————————*
  2510. *&      Form  GETISAMT
  2511. *&———————————————————————*
  2512. *       获取利润表下钻的报表数据
  2513. *———————————————————————-*
  2514. *      –>P_YAMT           text
  2515. *      –>P_MAMT           text
  2516. *      –>VALUE(P_ITEMID)  text
  2517. *      –>VALUE(P_ID)      text
  2518. *———————————————————————-*
  2519. form getisdpdata using
  2520. value(p_itemid)
  2521. value(p_id).
  2522. CLEAR gt_alv_is_dp1[].
  2523. "构造科目查询范围的查询条件
  2524. PERFORM getaccrange USING p_itemid.
  2525. CHECK gr_act[] IS NOT INITIAL.
  2526. CASE p_rpv.
  2527. WHEN '2070'.
  2528. "不考虑利润中心
  2529. if p_id = 4.
  2530. "6600取功能范围1200
  2531. select racct as racct
  2532. sum( hsl ) as hsl
  2533. from faglflexa
  2534. into corresponding fields of table gt_alv_is_dp1
  2535. where ryear = p_y
  2536. and poper = p_m
  2537. and rldnr = '0l'
  2538. and racct in gr_act
  2539. and pprctr = ''"'"抵消内部交易
  2540. and rfarea = '1200'
  2541. and rbukrs = 'n207'
  2542. group by racct
  2543. order by racct ascending.
  2544. ELSEIF p_id = 5.
  2545. "6600取功能范围1300
  2546. select racct as racct
  2547. sum( hsl ) as hsl
  2548. from faglflexa
  2549. into corresponding fields of table gt_alv_is_dp1
  2550. where ryear = p_y
  2551. and poper = p_m
  2552. and rldnr = '0l'
  2553. and racct in gr_act
  2554. and pprctr = ''"'"抵消内部交易
  2555. and rbukrs = 'n207'
  2556. and rfarea = '1300'
  2557. group by racct
  2558. order by racct ascending.
  2559. ELSEIF p_id = 14.
  2560. "按照科目进行取数
  2561. select racct as racct
  2562. sum( hsl ) as hsl
  2563. from faglflexa
  2564. into corresponding fields of table gt_alv_is_dp1
  2565. where ryear = p_y
  2566. and poper = p_m
  2567. and rbukrs = 'n207'
  2568. and rldnr = '0l'
  2569. and racct between '962101' and '962201'
  2570. and pprctr ='' "抵消内部交易
  2571. group by racct
  2572. order by racct ascending.
  2573. ELSE.
  2574. "正常取
  2575. select racct as racct
  2576. sum( hsl ) as hsl
  2577. from faglflexa
  2578. into corresponding fields of table gt_alv_is_dp1
  2579. where ryear = p_y
  2580. and poper = p_m
  2581. and rldnr = '0l'
  2582. and rbukrs = 'n207'
  2583. and racct in gr_act
  2584. and pprctr = ""抵消内部交易
  2585. group by racct
  2586. order by racct ascending.
  2587. ENDIF.
  2588. WHEN '2071' OR '2072' OR '2073'.
  2589. "自选利润中心组,利润中心可输可不输
  2590. if p_pc <> ''.
  2591. IF p_id = 4.
  2592. "6600取功能范围1200
  2593. select racct as racct
  2594. sum( hsl ) as hsl
  2595. from faglflexa
  2596. into corresponding fields of table gt_alv_is_dp1
  2597. where ryear = p_y
  2598. and poper = p_m
  2599. and rldnr = '0l'
  2600. and racct in gr_act
  2601. and rbukrs = 'n207'
  2602. and prctr = p_pc
  2603. and rfarea = '1200'
  2604. group by racct
  2605. order by racct ascending.
  2606. ELSEIF p_id = 5.
  2607. "6600取功能范围1300
  2608. select racct as racct
  2609. sum( hsl ) as hsl
  2610. from faglflexa
  2611. into corresponding fields of table gt_alv_is_dp1
  2612. where ryear = p_y
  2613. and poper = p_m
  2614. and rldnr = '0l'
  2615. and racct in gr_act
  2616. and rbukrs = 'n207'
  2617. and prctr = p_pc
  2618. and rfarea = '1300'
  2619. group by racct
  2620. order by racct ascending.
  2621. ELSEIF p_id = 14.
  2622. "按照科目进行取数
  2623. select racct as racct
  2624. sum( hsl ) as hsl
  2625. from faglflexa
  2626. into corresponding fields of table gt_alv_is_dp1
  2627. where ryear = p_y
  2628. and poper = p_m
  2629. and rldnr = '0l'
  2630. and racct between '962101' and '962201'
  2631. and prctr = p_pc
  2632. and rbukrs = 'n207'
  2633. group by racct
  2634. order by racct ascending.
  2635. ELSE.
  2636. "正常取
  2637. select racct as racct
  2638. sum( hsl ) as hsl
  2639. from faglflexa
  2640. into corresponding fields of table gt_alv_is_dp1
  2641. where ryear = p_y
  2642. and poper = p_m
  2643. and rldnr = '0l'
  2644. and racct in gr_act
  2645. and rbukrs = 'n207'
  2646. and prctr = p_pc
  2647. group by racct
  2648. order by racct ascending.
  2649. ENDIF.
  2650. ELSEIF p_pc = ''.
  2651. "利润中心为空,选取所有的利润中心
  2652. if p_id = 4.
  2653. "6600取功能范围1200
  2654. select racct as racct
  2655. sum( hsl ) as hsl
  2656. from faglflexa
  2657. into corresponding fields of table gt_alv_is_dp1
  2658. where ryear = p_y
  2659. and poper = p_m
  2660. and rldnr = '0l'
  2661. and rbukrs = 'n207'
  2662. and racct in gr_act
  2663. and prctr in ( select valfrom  from setleaf where setname = p_pcg and subclass = 'n207' and setclass = '0106')
  2664. and rfarea = '1200'
  2665. group by racct
  2666. order by racct ascending.
  2667. ELSEIF p_id = 5.
  2668. "6600取功能范围1300
  2669. select racct as racct
  2670. sum( hsl ) as hsl
  2671. from faglflexa
  2672. into corresponding fields of table gt_alv_is_dp1
  2673. where ryear = p_y
  2674. and poper = p_m
  2675. and rldnr = '0l'
  2676. and rbukrs = 'n207'
  2677. and racct in gr_act
  2678. and prctr in ( select valfrom  from setleaf where setname = p_pcg and subclass = 'n207' and setclass = '0106')
  2679. and rfarea = '1300'
  2680. group by racct
  2681. order by racct ascending.
  2682. ELSEIF p_id = 14.
  2683. "按照科目进行取数
  2684. select racct as racct
  2685. sum( hsl ) as hsl
  2686. from faglflexa
  2687. into corresponding fields of table gt_alv_is_dp1
  2688. where ryear = p_y
  2689. and poper = p_m
  2690. and rldnr = '0l'
  2691. and rbukrs = 'n207'
  2692. and racct between '962101' and '962201'
  2693. and prctr in ( select valfrom  from setleaf where setname = p_pcg and subclass = 'n207' and setclass = '0106')
  2694. group by racct
  2695. order by racct ascending.
  2696. ELSE.
  2697. "正常取
  2698. select racct as racct
  2699. sum( hsl ) as hsl
  2700. from faglflexa
  2701. into corresponding fields of table gt_alv_is_dp1
  2702. where ryear = p_y
  2703. and poper = p_m
  2704. and rbukrs = 'n207'
  2705. and rldnr = '0l'
  2706. and racct in gr_act
  2707. and prctr in ( select valfrom  from setleaf where setname = p_pcg )
  2708. group by racct
  2709. order by racct ascending.
  2710. ENDIF.
  2711. ENDIF.
  2712. ENDCASE.
  2713. ENDFORM.                    "setlist
  2714. "getisamt
  2715. *&———————————————————————*
  2716. *&      Form  DISPLAYISDP
  2717. *&———————————————————————*
  2718. *       text
  2719. *———————————————————————-*
  2720. *  –>  p1        text
  2721. *  <–  p2        text
  2722. *———————————————————————-*
  2723. form displayisdp .
  2724. PERFORM setlayoutisdp.
  2725. PERFORM buildfieldcat_isdp.
  2726. PERFORM excluding_tb_function1.
  2727. ENDFORM.                    "setlist
  2728. " displayisdp
  2729. *&———————————————————————*
  2730. *&      Form  DISPLAYBSDP
  2731. *&———————————————————————*
  2732. *       text
  2733. *———————————————————————-*
  2734. form displaybsdp .
  2735. PERFORM setlayoutisdp.
  2736. PERFORM buildfieldcat_bsdp.
  2737. PERFORM excluding_tb_function1.
  2738. ENDFORM.                    "setlist
  2739. " displayisdp
  2740. *&———————————————————————*
  2741. *&      Form  SETLAYOUTISDP
  2742. *&———————————————————————*
  2743. *       SET THE LAYOUT
  2744. *———————————————————————-*
  2745. *  –>  p1        text
  2746. *  <–  p2        text
  2747. *———————————————————————-*
  2748. form setlayoutisdp .
  2749. CLEAR gs_layout.
  2750. gs_layout-cwidth_opt = 'x' .
  2751. gs_layout-zebra = 'x' .
  2752. gs_layout-sel_mode = 'a'.
  2753. gs_layout-numc_total = 'x'.
  2754. ENDFORM.                    "setlist
  2755. " setlayoutisdp
  2756. *&———————————————————————*
  2757. *&      Form  BUILDFIELDCAT_ISDP
  2758. *&———————————————————————*
  2759. *       text
  2760. *———————————————————————-*
  2761. *  –>  p1        text
  2762. *  <–  p2        text
  2763. *———————————————————————-*
  2764. form buildfieldcat_isdp .
  2765. CLEAR gt_fieldcat[].
  2766. PERFORM fill_field_category USING :
  2767. 's' 'tabname'   'gt_alv_is_dp1' ,
  2768. "  'scrtext_m' '科目' ,
  2769. "  'key'       'x',
  2770. "  'col_pos'   '1',
  2771. 'e' 'fieldname' 'racct' ,
  2772. * –>2012.01.16 CCYU START
  2773. 's' 'tabname'   'gt_alv_is_dp1' ,
  2774. "  'scrtext_m' '科目描述' ,
  2775. "  'key'       'x',
  2776. "  'outputlen' '20',
  2777. "  'col_pos'   '2',
  2778. 'e' 'fieldname' 'txt50' ,
  2779. * <–2012.01.16 CCYU END.
  2780. 's' 'tabname'   'gt_alv_is_dp1' ,
  2781. "  'scrtext_m' '金额' ,
  2782. "  'col_pos'   '3',
  2783. "  'do_sum'    'x',
  2784. 'e' 'fieldname' 'hsl' .
  2785. ENDFORM.                    "setlist
  2786. " buildfieldcat_isdp
  2787. *&———————————————————————*
  2788. *&      Form  GETBSDP
  2789. *&———————————————————————*
  2790. *       获取资产负债表的下钻信息
  2791. *———————————————————————-*
  2792. *      –>P_YAMT           text
  2793. *      –>P_YSAMT          text
  2794. *      –>VALUE(P_ITEMID)  text
  2795. *———————————————————————-*
  2796. form getbsdp tables p_gt_alv_bs_dp1 type gt_alv_bs_dp"tables参数是输入输出参数
  2797. using  value(p_itemid).
  2798. "构造科目查询范围的查询条件
  2799. CLEAR gt_alv_bs_dp2[].
  2800. CLEAR p_gt_alv_bs_dp1[].
  2801. PERFORM getaccrange USING p_itemid.
  2802. CHECK gr_act[] IS NOT INITIAL.
  2803. DATA ly TYPE n LENGTH 4.
  2804. ly = p_y - 1.
  2805. CASE p_rpv.
  2806. WHEN '2070'.
  2807. "不考虑利润中心
  2808. select racct
  2809. hsl
  2810. from faglflexa
  2811. into corresponding fields of table gt_alv_bs_dp2
  2812. where
  2813. ( ( ryear = p_y and poper between '01' and p_m ) or ( ryear le ly ) )
  2814. and rldnr = '0l'
  2815. and rbukrs = 'n207'
  2816. and racct in gr_act
  2817. and pprctr = ''.
  2818. "抵消内部交易.
  2819. WHEN '2071' OR '2072' OR '2073'.
  2820. "自选利润中心组,利润中心可输可不输
  2821. if p_pc <> ''.
  2822. "有利润中心的情况
  2823. select racct hsl
  2824. from faglflexa
  2825. into corresponding fields of table gt_alv_bs_dp2
  2826. where
  2827. ( ( ryear = p_y and poper between '01' and p_m ) or ( ryear le ly ) )
  2828. and rldnr = '0l'
  2829. and rbukrs = 'n207'
  2830. and racct in gr_act
  2831. and prctr = p_pc.
  2832. ELSEIF p_pc = ''.
  2833. "利润中心为空,选取利润中心组下的利润中心
  2834. select racct
  2835. hsl
  2836. from faglflexa
  2837. into corresponding fields of table gt_alv_bs_dp2
  2838. where
  2839. ( ( ryear = p_y and poper between '01' and p_m ) or ( ryear le ly ) )
  2840. and rldnr = '0l'
  2841. and rbukrs = 'n207'
  2842. and racct in gr_act
  2843. and prctr in ( select valfrom  from setleaf where setname = p_pcg and subclass = 'n207' and setclass = '0106').
  2844. ENDIF.
  2845. ENDCASE.
  2846. LOOP AT gt_alv_bs_dp2.
  2847. "利用collect进行合计
  2848. move-corresponding gt_alv_bs_dp2 to gs_alv_bs_dp_obj1.
  2849. COLLECT gs_alv_bs_dp_obj1 INTO p_gt_alv_bs_dp1.
  2850. ENDLOOP.
  2851. SORT p_gt_alv_bs_dp1 BY racct ASCENDING.
  2852. ENDFORM.                    "setlist
  2853. "getisamt
  2854. *&———————————————————————*
  2855. *&      Form  BUILDFIELDCAT_BSDP
  2856. *&———————————————————————*
  2857. *       text
  2858. *———————————————————————-*
  2859. *  –>  p1        text
  2860. *  <–  p2        text
  2861. *———————————————————————-*
  2862. form buildfieldcat_bsdp .
  2863. CLEAR gt_fieldcat[].
  2864. PERFORM fill_field_category USING :
  2865. 's' 'tabname'   'gt_alv_bs_dp1' ,
  2866. "  'scrtext_m' '科目' ,
  2867. "  'key'       'x',
  2868. "  'col_pos'   '1',
  2869. 'e' 'fieldname' 'racct' ,
  2870. * –>2012.01.16 CCYU START
  2871. 's' 'tabname'   'gt_alv_bs_dp1' ,
  2872. "  'scrtext_m' '科目描述' ,
  2873. "  'key'       'x',
  2874. "  'outputlen' '20',
  2875. "  'col_pos'   '2',
  2876. 'e' 'fieldname' 'txt50' ,
  2877. * <–2012.01.16 CCYU END.
  2878. 's' 'tabname'   'gt_alv_bs_dp1' ,
  2879. "  'scrtext_m' '金额' ,
  2880. "  'col_pos'   '3',
  2881. "  'do_sum'    'x',
  2882. 'e' 'fieldname' 'hsl' .
  2883. ENDFORM.                    "setlist
  2884. " buildfieldcat_bsdp
  2885. *&———————————————————————*
  2886. *&      Form  porcess_show
  2887. *&———————————————————————*
  2888. *       text
  2889. *———————————————————————-*
  2890. form porcess_show using value(p_pro).
  2891. CALL FUNCTION 'sapgui_progress_indicator'
  2892. EXPORTING
  2893. percentage = p_pro
  2894. text       = '正在查询…'.
  2895. ENDFORM.                    "setlist
  2896. "porcess_show
  2897. *&———————————————————————*
  2898. *&      Form  GET_EXCEL
  2899. *&———————————————————————*
  2900. *       text
  2901. *———————————————————————-*
  2902. *  –>  p1        text
  2903. *  <–  p2        text
  2904. *———————————————————————-*
  2905. form get_excel .
  2906. * –>2012.01.17 ccyu START
  2907. DATA:gv_fname LIKE rlgrap-filename,
  2908. gv_filename TYPE string.
  2909. IF gv_iden = 'bs'.
  2910. "资产负债表
  2911. clear gt_head1[].
  2912. gt_head1-t1 = '行次'.
  2913. gt_head1-t2 = '资产'.
  2914. gt_head1-t3 = '期末余额'.
  2915. gt_head1-t4 = '年初余额'.
  2916. gt_head1-t5 = '行次'.
  2917. gt_head1-t6 = '负债和所有者权益(或股东权益)'.
  2918. gt_head1-t7 = '期末余额'.
  2919. gt_head1-t8 = '年初余额'.
  2920. APPEND gt_head1.
  2921. CLEAR:gt_alv_bs01,gt_alv_bs01[].
  2922. LOOP AT gt_alv_bs0.
  2923. gt_alv_bs01-lct1 = gt_alv_bs0-lct1.
  2924. gt_alv_bs01-item1 = gt_alv_bs0-item1.
  2925. gt_alv_bs01-yamt1 = gt_alv_bs0-yamt1.
  2926. gt_alv_bs01-ysamt1 = gt_alv_bs0-ysamt1.
  2927. gt_alv_bs01-lct2 = gt_alv_bs0-lct2.
  2928. gt_alv_bs01-item2 = gt_alv_bs0-item2.
  2929. gt_alv_bs01-yamt2 = gt_alv_bs0-yamt2.
  2930. gt_alv_bs01-ysamt2 = gt_alv_bs0-ysamt2.
  2931. APPEND gt_alv_bs01.
  2932. ENDLOOP.
  2933. CALL FUNCTION 'ws_filename_get'
  2934. EXPORTING
  2935. mask = '
  2936. *.
  2937. xls,*.xls.'
  2938. mode             = 's'
  2939. importing
  2940. filename         = gv_fname
  2941. exceptions
  2942. inv_winsys       = 1
  2943. no_batch         = 2
  2944. selection_cancel = 3
  2945. selection_error  = 4
  2946. others           = 5.
  2947. IF gv_fname IS NOT INITIAL.
  2948. gv_filename = gv_fname.
  2949. *————————————————————-*
  2950. *                 DOWNLOAD HEADER                             *
  2951. *————————————————————-*
  2952. CALL FUNCTION 'gui_download'
  2953. EXPORTING
  2954. filename                = gv_filename
  2955. filetype                = 'asc'
  2956. write_field_separator   = 'x'
  2957. TABLES
  2958. data_tab                = gt_head1
  2959. EXCEPTIONS
  2960. file_write_error        = 1
  2961. no_batch                = 2
  2962. gui_refuse_filetransfer = 3
  2963. invalid_type            = 4
  2964. no_authority            = 5
  2965. unknown_error           = 6
  2966. header_not_allowed      = 7
  2967. separator_not_allowed   = 8
  2968. filesize_not_allowed    = 9
  2969. header_too_long         = 10
  2970. dp_error_create         = 11
  2971. dp_error_send           = 12
  2972. dp_error_write          = 13
  2973. unknown_dp_error        = 14
  2974. access_denied           = 15
  2975. dp_out_of_memory        = 16
  2976. disk_full               = 17
  2977. dp_timeout              = 18
  2978. file_not_found          = 19
  2979. dataprovider_exception  = 20
  2980. control_flush_error     = 21
  2981. OTHERS                  = 22.
  2982. *————————————————————-*
  2983. *                 DOWNLOAD TABLE                              *
  2984. *————————————————————-*
  2985. CALL FUNCTION 'gui_download'
  2986. EXPORTING
  2987. filename                = gv_filename
  2988. filetype                = 'asc'
  2989. append                  = 'x'
  2990. write_field_separator   = 'x'
  2991. TABLES
  2992. data_tab                = gt_alv_bs01[]
  2993. EXCEPTIONS
  2994. file_write_error        = 1
  2995. no_batch                = 2
  2996. gui_refuse_filetransfer = 3
  2997. invalid_type            = 4
  2998. no_authority            = 5
  2999. unknown_error           = 6
  3000. header_not_allowed      = 7
  3001. separator_not_allowed   = 8
  3002. filesize_not_allowed    = 9
  3003. header_too_long         = 10
  3004. dp_error_create         = 11
  3005. dp_error_send           = 12
  3006. dp_error_write          = 13
  3007. unknown_dp_error        = 14
  3008. access_denied           = 15
  3009. dp_out_of_memory        = 16
  3010. disk_full               = 17
  3011. dp_timeout              = 18
  3012. file_not_found          = 19
  3013. dataprovider_exception  = 20
  3014. control_flush_error     = 21
  3015. OTHERS                  = 22.
  3016. IF sy-subrc = 0.
  3017. MESSAGE i003(zn207m).
  3018. ENDIF.
  3019. ENDIF.
  3020. ELSEIF gv_iden = 'is'.
  3021. "利润表
  3022. call function 'ws_filename_get'
  3023. exporting
  3024. mask             = ',*.
  3025. xls,*.xls.'
  3026. mode             = 's'
  3027. importing
  3028. filename         = gv_fname
  3029. exceptions
  3030. inv_winsys       = 1
  3031. no_batch         = 2
  3032. selection_cancel = 3
  3033. selection_error  = 4
  3034. others           = 5.
  3035. IF gv_fname IS NOT INITIAL.
  3036. CLEAR: gt_alv_is01[],gt_alv_is01.
  3037. LOOP AT gt_alv_is0.
  3038. MOVE-CORRESPONDING gt_alv_is0 TO gt_alv_is01.
  3039. APPEND gt_alv_is01.
  3040. ENDLOOP.
  3041. CLEAR gt_head2[].
  3042. gt_head2-t1 = '行次'.
  3043. gt_head2-t2 = '项目'.
  3044. gt_head2-t3 = '本期余额'.
  3045. gt_head2-t4 = '累计余额'.
  3046. APPEND gt_head2.
  3047. gv_filename = gv_fname.
  3048. *————————————————————-*
  3049. *                 DOWNLOAD HEADER                             *
  3050. *————————————————————-*
  3051. CALL FUNCTION 'gui_download'
  3052. EXPORTING
  3053. filename                = gv_filename
  3054. filetype                = 'asc'
  3055. write_field_separator   = 'x'
  3056. TABLES
  3057. data_tab                = gt_head2[]
  3058. EXCEPTIONS
  3059. file_write_error        = 1
  3060. no_batch                = 2
  3061. gui_refuse_filetransfer = 3
  3062. invalid_type            = 4
  3063. no_authority            = 5
  3064. unknown_error           = 6
  3065. header_not_allowed      = 7
  3066. separator_not_allowed   = 8
  3067. filesize_not_allowed    = 9
  3068. header_too_long         = 10
  3069. dp_error_create         = 11
  3070. dp_error_send           = 12
  3071. dp_error_write          = 13
  3072. unknown_dp_error        = 14
  3073. access_denied           = 15
  3074. dp_out_of_memory        = 16
  3075. disk_full               = 17
  3076. dp_timeout              = 18
  3077. file_not_found          = 19
  3078. dataprovider_exception  = 20
  3079. control_flush_error     = 21
  3080. OTHERS                  = 22.
  3081. *————————————————————-*
  3082. *                 DOWNLOAD TABLE                              *
  3083. *————————————————————-*
  3084. CALL FUNCTION 'gui_download'
  3085. EXPORTING
  3086. filename                = gv_filename
  3087. filetype                = 'asc'
  3088. append                  = 'x'
  3089. write_field_separator   = 'x'
  3090. TABLES
  3091. data_tab                = gt_alv_is01[]
  3092. EXCEPTIONS
  3093. file_write_error        = 1
  3094. no_batch                = 2
  3095. gui_refuse_filetransfer = 3
  3096. invalid_type            = 4
  3097. no_authority            = 5
  3098. unknown_error           = 6
  3099. header_not_allowed      = 7
  3100. separator_not_allowed   = 8
  3101. filesize_not_allowed    = 9
  3102. header_too_long         = 10
  3103. dp_error_create         = 11
  3104. dp_error_send           = 12
  3105. dp_error_write          = 13
  3106. unknown_dp_error        = 14
  3107. access_denied           = 15
  3108. dp_out_of_memory        = 16
  3109. disk_full               = 17
  3110. dp_timeout              = 18
  3111. file_not_found          = 19
  3112. dataprovider_exception  = 20
  3113. control_flush_error     = 21
  3114. OTHERS                  = 22.
  3115. IF sy-subrc = 0.
  3116. MESSAGE i003(zn207m).
  3117. ENDIF.
  3118. ENDIF.
  3119. ENDIF.
  3120. ENDFORM.                    "setlist
  3121. " get_excel
  3122. *&———————————————————————*
  3123. *&      Form  SYNCHRODATA
  3124. *&———————————————————————*
  3125. *       同步BSEG表和FAGLFLEXA表的利润中心和伙伴利润中心的数据
  3126. *———————————————————————-*
  3127. *  –>  p1        text
  3128. *  <–  p2        text
  3129. *———————————————————————-*
  3130. form synchrodata .
  3131. CALL FUNCTION 'sapgui_progress_indicator'
  3132. EXPORTING
  3133. *ERCENTAGE = 0
  3134. text       = '正在同步数据…'.
  3135. "取抬头
  3136. SELECT gjahr
  3137. bukrs
  3138. belnr
  3139. FROM bkpf INTO CORRESPONDING FIELDS OF TABLE gt_bkpfsyn
  3140. WHERE bukrs = 'n207'
  3141. AND gjahr = p_y
  3142. AND monat = p_m.
  3143. IF gt_bkpfsyn[] IS NOT INITIAL.
  3144. "取抬头下的行项目
  3145. SELECT gjahr
  3146. bukrs
  3147. belnr
  3148. prctr
  3149. pprct
  3150. buzei
  3151. INTO CORRESPONDING FIELDS OF TABLE gt_bsegsyn
  3152. FROM bseg FOR ALL ENTRIES IN gt_bkpfsyn
  3153. WHERE bukrs = gt_bkpfsyn-bukrs
  3154. AND gjahr = gt_bkpfsyn-gjahr
  3155. AND belnr = gt_bkpfsyn-belnr.
  3156. "SORT gt_bsegsyn BY belnr ASCENDING.
  3157. "按月份取行项目
  3158. SELECT ryear
  3159. rbukrs
  3160. docnr
  3161. prctr
  3162. pprctr
  3163. buzei
  3164. FROM faglflexa INTO CORRESPONDING FIELDS OF TABLE gt_fagasyn
  3165. WHERE ryear = p_y
  3166. AND rbukrs = 'n207'
  3167. AND poper = p_m
  3168. AND rldnr = '0l'.
  3169. LOOP AT gt_fagasyn.
  3170. " gt_fagasyn-rclnt = sy-mandt.
  3171. READ TABLE gt_bsegsyn WITH KEY belnr = gt_fagasyn-docnr
  3172. buzei = gt_fagasyn-buzei.
  3173. IF sy-subrc = 0.
  3174. IF gt_bsegsyn-prctr IS NOT INITIAL.
  3175. "不为空才更改
  3176. if gt_fagasyn-prctr ne gt_bsegsyn-prctr.
  3177. UPDATE faglflexa SET prctr = gt_bsegsyn-prctr
  3178. WHERE rbukrs = 'n207'
  3179. AND ryear = p_y
  3180. AND docnr = gt_fagasyn-docnr
  3181. AND buzei = gt_fagasyn-buzei
  3182. AND rldnr = '0l'.
  3183. IF sy-subrc = 0.
  3184. COMMIT WORK.
  3185. ENDIF.
  3186. ENDIF.
  3187. ENDIF.
  3188. IF gt_bsegsyn-pprct IS NOT INITIAL.
  3189. "不为空才更改
  3190. if gt_fagasyn-pprctr ne gt_bsegsyn-pprct.
  3191. UPDATE faglflexa SET pprctr = gt_bsegsyn-pprct
  3192. WHERE rbukrs = 'n207'
  3193. AND ryear = p_y
  3194. AND docnr = gt_fagasyn-docnr
  3195. AND buzei = gt_fagasyn-buzei
  3196. AND rldnr = '0l'.
  3197. IF sy-subrc = 0.
  3198. COMMIT WORK.
  3199. ENDIF.
  3200. ENDIF.
  3201. ENDIF.
  3202. ENDIF.
  3203. ENDLOOP.
  3204. "  modify faglflexa from table gt_fagasyn[]. :不行?
  3205. clear: gt_fagasyn[],gt_fagasyn,
  3206. gt_bsegsyn[],gt_bsegsyn,
  3207. gt_bkpfsyn[],gt_bkpfsyn.
  3208. ENDIF.
  3209. ENDFORM.                    "setlist
  3210. " synchrodata
  3211. *&———————————————————————*
  3212. *&      Form  getisdb
  3213. *&———————————————————————*
  3214. *       text
  3215. *———————————————————————-*
  3216. form getisdb.
  3217. DATA:lv_pro1(10) TYPE p DECIMALS 2 VALUE '5',
  3218. lv_i1(10) TYPE p DECIMALS 2 VALUE '5'.
  3219. gv_iden = 'is'.
  3220. CLEAR  gt_alv_is0[].
  3221. PERFORM setisitem."设置利润表项目
  3222. data:a like faglflext-hslvt,
  3223. b like faglflext-hslvt,
  3224. c like faglflext-hslvt,
  3225. d like faglflext-hslvt,
  3226. e like faglflext-hslvt,
  3227. f like faglflext-hslvt.
  3228. LOOP AT gt_alv_is0.
  3229. IF gt_alv_is0-lct = 1.
  3230. PERFORM getisamt USING a
  3231. b
  3232. '6001'
  3233. 1.
  3234. PERFORM getisamt USING c
  3235. d
  3236. '6100'
  3237. 1.
  3238. gt_alv_is0-yamt = a + c.
  3239. gt_alv_is0-mamt = b + d.
  3240. ELSEIF gt_alv_is0-lct = 2.
  3241. PERFORM getisamt USING a
  3242. b
  3243. '6400'
  3244. 2.
  3245. PERFORM getisamt USING c
  3246. d
  3247. '6500'
  3248. 2.
  3249. PERFORM getisamt USING e
  3250. f
  3251. '6610'
  3252. 2.
  3253. gt_alv_is0-yamt = a + c + e.
  3254. gt_alv_is0-mamt = b + d + f.
  3255. ELSEIF gt_alv_is0-lct = 3.
  3256. PERFORM getisamt USING a
  3257. b
  3258. '6450'
  3259. 3.
  3260. gt_alv_is0-yamt = a.
  3261. gt_alv_is0-mamt = b.
  3262. ELSEIF gt_alv_is0-lct = 4.
  3263. PERFORM getisamt USING a
  3264. b
  3265. '6600'
  3266. 4.
  3267. gt_alv_is0-yamt = a.
  3268. gt_alv_is0-mamt = b.
  3269. ELSEIF gt_alv_is0-lct = 5.
  3270. PERFORM getisamt USING a
  3271. b
  3272. '6600'
  3273. 5.
  3274. gt_alv_is0-yamt = a.
  3275. gt_alv_is0-mamt = b.
  3276. ELSEIF gt_alv_is0-lct = 6.
  3277. PERFORM getisamt USING a
  3278. b
  3279. '6620'
  3280. 6.
  3281. gt_alv_is0-yamt = a.
  3282. gt_alv_is0-mamt = b.
  3283. ELSEIF gt_alv_is0-lct = 7.
  3284. PERFORM getisamt USING a
  3285. b
  3286. '6630'
  3287. 7.
  3288. gt_alv_is0-yamt = a.
  3289. gt_alv_is0-mamt = b.
  3290. ELSEIF gt_alv_is0-lct = 8.
  3291. PERFORM getisamt USING a
  3292. b
  3293. '6640'
  3294. 8.
  3295. gt_alv_is0-yamt = a.
  3296. gt_alv_is0-mamt = b.
  3297. ELSEIF gt_alv_is0-lct = 9.
  3298. PERFORM getisamt USING a
  3299. b
  3300. '6645'
  3301. 9.
  3302. gt_alv_is0-yamt = a.
  3303. gt_alv_is0-mamt = b.
  3304. ELSEIF gt_alv_is0-lct = 12.
  3305. PERFORM getisamt USING a
  3306. b
  3307. '6301'
  3308. 12.
  3309. gt_alv_is0-yamt = a.
  3310. gt_alv_is0-mamt = b.
  3311. ELSEIF gt_alv_is0-lct = 13.
  3312. PERFORM getisamt USING a
  3313. b
  3314. '6711'
  3315. 13.
  3316. gt_alv_is0-yamt = a.
  3317. gt_alv_is0-mamt = b.
  3318. ELSEIF gt_alv_is0-lct = 14.
  3319. "按科目直接取数
  3320. perform getisamt using a
  3321. b
  3322. '0000'
  3323. 14.
  3324. gt_alv_is0-yamt = a.
  3325. gt_alv_is0-mamt = b.
  3326. ELSEIF gt_alv_is0-lct = 15.
  3327. PERFORM getisamt USING a
  3328. b
  3329. '6901'
  3330. 15.
  3331. gt_alv_is0-yamt = a.
  3332. gt_alv_is0-mamt = b.
  3333. ELSEIF gt_alv_is0-lct = 17.
  3334. PERFORM getisamt USING a
  3335. b
  3336. '6801'
  3337. 17.
  3338. gt_alv_is0-yamt = a.
  3339. gt_alv_is0-mamt = b.
  3340. ENDIF.
  3341. MODIFY gt_alv_is0.
  3342. PERFORM porcess_show USING lv_pro1.
  3343. lv_pro1 = lv_pro1 + lv_i1.
  3344. ENDLOOP.
  3345. DATA:a1 LIKE faglflext-hslvt,
  3346. a1_1 LIKE faglflext-hslvt,
  3347. a2 LIKE faglflext-hslvt,
  3348. a2_1 LIKE faglflext-hslvt,
  3349. a3 LIKE faglflext-hslvt,
  3350. a3_1 LIKE faglflext-hslvt,
  3351. a4 LIKE faglflext-hslvt,
  3352. a4_1 LIKE faglflext-hslvt,
  3353. a5 LIKE faglflext-hslvt,
  3354. a5_1 LIKE faglflext-hslvt,
  3355. a6 LIKE faglflext-hslvt,
  3356. a6_1 LIKE faglflext-hslvt,
  3357. a7 LIKE faglflext-hslvt,
  3358. a7_1 LIKE faglflext-hslvt,
  3359. a8 LIKE faglflext-hslvt,
  3360. a8_1 LIKE faglflext-hslvt,
  3361. a9 LIKE faglflext-hslvt,
  3362. a9_1 LIKE faglflext-hslvt,
  3363. a10 LIKE faglflext-hslvt,
  3364. a10_1 LIKE faglflext-hslvt,
  3365. a11 LIKE faglflext-hslvt,
  3366. a11_1 LIKE faglflext-hslvt,
  3367. a12 LIKE faglflext-hslvt,
  3368. a12_1 LIKE faglflext-hslvt,
  3369. a13 LIKE faglflext-hslvt,
  3370. a13_1 LIKE faglflext-hslvt,
  3371. a14 LIKE faglflext-hslvt,
  3372. a14_1 LIKE faglflext-hslvt,
  3373. a15 LIKE faglflext-hslvt,
  3374. a15_1 LIKE faglflext-hslvt,
  3375. a16 LIKE faglflext-hslvt,
  3376. a16_1 LIKE faglflext-hslvt,
  3377. a17 LIKE faglflext-hslvt,
  3378. a17_1 LIKE faglflext-hslvt,
  3379. a18 LIKE faglflext-hslvt,
  3380. a18_1 LIKE faglflext-hslvt,
  3381. a19 LIKE faglflext-hslvt,
  3382. a19_1 LIKE faglflext-hslvt.
  3383. READ TABLE gt_alv_is0 WITH KEY lct = 1.
  3384. a1 = gt_alv_is0-yamt.
  3385. a1_1 = gt_alv_is0-mamt.
  3386. READ TABLE gt_alv_is0 WITH KEY lct = 2.
  3387. a2 = gt_alv_is0-yamt.
  3388. a2_1 = gt_alv_is0-mamt.
  3389. READ TABLE gt_alv_is0 WITH KEY lct = 3.
  3390. a3 = gt_alv_is0-yamt.
  3391. a3_1 = gt_alv_is0-mamt.
  3392. READ TABLE gt_alv_is0 WITH KEY lct = 4.
  3393. a4 = gt_alv_is0-yamt.
  3394. a4_1 = gt_alv_is0-mamt.
  3395. READ TABLE gt_alv_is0 WITH KEY lct = 5.
  3396. a5 = gt_alv_is0-yamt.
  3397. a5_1 = gt_alv_is0-mamt.
  3398. READ TABLE gt_alv_is0 WITH KEY lct = 6.
  3399. a6 = gt_alv_is0-yamt.
  3400. a6_1 = gt_alv_is0-mamt.
  3401. READ TABLE gt_alv_is0 WITH KEY lct = 7.
  3402. a7 = gt_alv_is0-yamt.
  3403. a7_1 = gt_alv_is0-mamt.
  3404. READ TABLE gt_alv_is0 WITH KEY lct = 8.
  3405. a8 = gt_alv_is0-yamt.
  3406. a8_1 = gt_alv_is0-mamt.
  3407. READ TABLE gt_alv_is0 WITH KEY lct = 9.
  3408. a9 = gt_alv_is0-yamt.
  3409. a9_1 = gt_alv_is0-mamt.
  3410. READ TABLE gt_alv_is0 WITH KEY lct = 12.
  3411. a12 = gt_alv_is0-yamt.
  3412. a12_1 = gt_alv_is0-mamt.
  3413. READ TABLE gt_alv_is0 WITH KEY lct = 13.
  3414. a13 = gt_alv_is0-yamt.
  3415. a13_1 = gt_alv_is0-mamt.
  3416. READ TABLE gt_alv_is0 WITH KEY lct = 15.
  3417. a15 = gt_alv_is0-yamt.
  3418. a15_1 = gt_alv_is0-mamt.
  3419. READ TABLE gt_alv_is0 WITH KEY lct = 17.
  3420. a17 = gt_alv_is0-yamt.
  3421. a17_1 = gt_alv_is0-mamt.
  3422. READ TABLE gt_alv_is0 WITH KEY lct = 14.
  3423. a14 = gt_alv_is0-yamt.
  3424. a14_1 = gt_alv_is0-mamt.
  3425. a11 = a1 - a2 - a3 - a4 - a5 - a6 - a7 + a8 + a9.
  3426. a11_1 = a1_1 - a2_1 - a3_1 - a4_1 - a5_1 - a6_1 - a7_1 + a8_1 + a9_1.
  3427. a16 = a11 + a12 - a13 - a14 + a15.
  3428. a16_1 = a11_1 + a12_1 - a13_1 - a14_1 + a15_1.
  3429. a18 = a16 - a17.
  3430. a18_1 = a16_1 - a17_1.
  3431. LOOP AT gt_alv_is0.
  3432. IF gt_alv_is0-lct = 11.
  3433. gt_alv_is0-yamt = a11.
  3434. gt_alv_is0-mamt = a11_1.
  3435. ELSEIF gt_alv_is0-lct = 16.
  3436. gt_alv_is0-yamt = a16.
  3437. gt_alv_is0-mamt = a16_1.
  3438. ELSEIF gt_alv_is0-lct = 18.
  3439. gt_alv_is0-yamt = a18.
  3440. gt_alv_is0-mamt = a18_1.
  3441. ENDIF.
  3442. MODIFY  gt_alv_is0.
  3443. ENDLOOP.
  3444. IF p_curr = 'krw'.
  3445. LOOP AT gt_alv_is0.
  3446. gt_alv_is0-yamt = gt_alv_is0-yamt * gv_bs.
  3447. gt_alv_is0-mamt = gt_alv_is0-mamt * gv_bs.
  3448. gt_alv_is0-waers = 'krw'.
  3449. MODIFY gt_alv_is0.
  3450. ENDLOOP.
  3451. ELSE.
  3452. LOOP AT gt_alv_is0.
  3453. gt_alv_is0-waers = 'cny'.
  3454. MODIFY gt_alv_is0.
  3455. ENDLOOP.
  3456. ENDIF.
  3457. ENDFORM.                    "setlist
  3458. "getisdb
  3459. *&———————————————————————*
  3460. *&  Include           ZFIR00026_I01
  3461. *&———————————————————————*
  3462. *&———————————————————————*
  3463. *&      Module  USER_COMMAND_0200  INPUT
  3464. *&———————————————————————*
  3465. *       text
  3466. *———————————————————————-*
  3467. module user_command_0200 input.
  3468. CASE sy-ucomm.
  3469. WHEN 'exit' OR 'back' OR 'cancle'.
  3470. LEAVE TO SCREEN 0.
  3471. WHEN 'pp'.
  3472. PERFORM ppsmartforms_is.
  3473. WHEN 'pr'.
  3474. PERFORM print.
  3475. ENDCASE.
  3476. ENDMODULE.                    "setlist
  3477. " user_command_0200  input
  3478. *&———————————————————————*
  3479. *&      Module  USER_COMMAND_0100  INPUT
  3480. *&———————————————————————*
  3481. *       text
  3482. *———————————————————————-*
  3483. module user_command_0100 input.
  3484. CASE sy-ucomm.
  3485. WHEN 'cancle' OR 'exit' OR 'back'.
  3486. LEAVE TO SCREEN 0.
  3487. WHEN 'pp'.
  3488. PERFORM ppsmartforms_is.
  3489. WHEN 'pr'.
  3490. PERFORM print.
  3491. ENDCASE.
  3492. ENDMODULE.                    "setlist
  3493. " user_command_0100  input
  3494. *&———————————————————————*
  3495. *&      Module  USER_COMMAND_0300  INPUT
  3496. *&———————————————————————*
  3497. *       text
  3498. *———————————————————————-*
  3499. module user_command_0300 input.
  3500. CASE sy-ucomm.
  3501. WHEN 'cancle' OR 'exit' OR 'back'.
  3502. LEAVE TO SCREEN 0.
  3503. ENDCASE.
  3504. ENDMODULE.                    "setlist
  3505. " user_command_0300  input
  3506. *&———————————————————————*
  3507. *&      Module  USER_COMMAND_0400  INPUT
  3508. *&———————————————————————*
  3509. *       text
  3510. *———————————————————————-*
  3511. module user_command_0400 input.
  3512. CASE sy-ucomm.
  3513. WHEN 'cancle' OR 'exit' OR 'back'.
  3514. LEAVE TO SCREEN 0.
  3515. ENDCASE.
  3516. ENDMODULE.                    "setlist
  3517. " user_command_0400  input
  3518. *&———————————————————————*
  3519. *&  Include           ZFIR00026_O01
  3520. *&———————————————————————*
  3521. *&———————————————————————*
  3522. *&      Module  INITIAL  OUTPUT
  3523. *&———————————————————————*
  3524. *       text
  3525. *———————————————————————-*
  3526. module initial output.
  3527. DATA: lv_object TYPE REF TO lcl_app_compt.
  3528. CREATE OBJECT lv_object.
  3529. IF gs_alv_is IS INITIAL.
  3530. PERFORM setcon.
  3531. PERFORM displayis.
  3532. SET HANDLER lv_object->handle_toolbar FOR gs_alv_is  .
  3533. *–>2012.01.18 CCYU START
  3534. SET HANDLER lv_object->handle_user_command FOR gs_alv_is .
  3535. *<–2012.01.18 CCYU END.
  3536. SET HANDLER lv_object->handle_topofpage FOR gs_alv_is .
  3537. SET HANDLER lv_object->handle_hotspot_click FOR gs_alv_is .
  3538. CALL METHOD gs_alv_is->set_table_for_first_display
  3539. EXPORTING
  3540. is_layout            = gs_layout
  3541. it_toolbar_excluding = g_toolbar
  3542. CHANGING
  3543. it_outtab            = gt_alv_is0[]
  3544. it_fieldcatalog      = gt_fieldcat.
  3545. CALL METHOD gs_alv_is->list_processing_events
  3546. EXPORTING
  3547. i_event_name = 'top_of_page'
  3548. i_dyndoc_id  = gs_dyndoc_id.
  3549. ENDIF.
  3550. ENDMODULE.                    "setlist
  3551. " initial  output
  3552. *&———————————————————————*
  3553. *&      Module  SETPF  OUTPUT
  3554. *&———————————————————————*
  3555. *       text
  3556. *———————————————————————-*
  3557. module setpf output.
  3558. SET PF-STATUS '0200'.
  3559. SET TITLEBAR '0200'.
  3560. ENDMODULE.                    "setlist
  3561. " setpf  output
  3562. *&———————————————————————*
  3563. *&      Module  STATUS_0100  OUTPUT
  3564. *&———————————————————————*
  3565. *       text
  3566. *———————————————————————-*
  3567. module status_0100 output.
  3568. SET PF-STATUS '0100'.
  3569. SET TITLEBAR '0100'.
  3570. ENDMODULE.                    "setlist
  3571. " status_0100  output
  3572. *&———————————————————————*
  3573. *&      Module  INITIAL_0100  OUTPUT
  3574. *&———————————————————————*
  3575. *       text
  3576. *———————————————————————-*
  3577. module initial_0100 output.
  3578. DATA: lv_object1 TYPE REF TO lcl_app_compt.
  3579. CREATE OBJECT lv_object1.
  3580. IF gs_alv_bs IS INITIAL.
  3581. PERFORM setcon.
  3582. PERFORM displaybs.
  3583. SET HANDLER lv_object1->handle_toolbar FOR gs_alv_bs.
  3584. *–>2012.01.18 CCYU START
  3585. SET HANDLER lv_object1->handle_user_command FOR gs_alv_bs .
  3586. *<–2012.01.18 CCYU END.
  3587. SET HANDLER lv_object1->handle_topofpage FOR gs_alv_bs .
  3588. SET HANDLER lv_object1->handle_hotspot_click FOR gs_alv_bs ."给gs_alv_bs注册事件
  3589. call method gs_alv_bs->set_table_for_first_display
  3590. exporting
  3591. is_layout            = gs_layout
  3592. it_toolbar_excluding = g_toolbar
  3593. changing
  3594. it_outtab            = gt_alv_bs0[]
  3595. it_fieldcatalog      = gt_fieldcat.
  3596. CALL METHOD gs_alv_bs->list_processing_events
  3597. EXPORTING
  3598. i_event_name = 'top_of_page'
  3599. i_dyndoc_id  = gs_dyndoc_id.
  3600. ENDIF.
  3601. ENDMODULE.                    "setlist
  3602. " initial_0100  output
  3603. *&———————————————————————*
  3604. *&      Module  STATUS_0300  OUTPUT
  3605. *&———————————————————————*
  3606. *       text
  3607. *———————————————————————-*
  3608. module status_0300 output.
  3609. SET PF-STATUS '0300'.
  3610. SET TITLEBAR '0300'.
  3611. ENDMODULE.                    "setlist
  3612. " status_0300  output
  3613. *&———————————————————————*
  3614. *&      Module  INITIAL_0300  OUTPUT
  3615. *&———————————————————————*
  3616. *       text
  3617. *———————————————————————-*
  3618. module initial_0300 output.
  3619. DATA: lv_object2 TYPE REF TO lcl_app_compt.
  3620. CREATE OBJECT lv_object2.
  3621. IF gs_alv_is_dp1 IS INITIAL.
  3622. PERFORM setcon1.
  3623. CREATE OBJECT gs_alv_is_dp1
  3624. EXPORTING
  3625. i_parent = gs_parent_grid1.
  3626. PERFORM displayisdp.
  3627. *–>2012.01.18 CCYU START
  3628. SET HANDLER lv_object2->handle_user_command FOR gs_alv_is_dp1  .
  3629. *<–2012.01.18 CCYU END.
  3630. "SET HANDLER LV_OBJECT2->HANDLE_TOOLBAR FOR GS_ALV_IS_DP1.
  3631. "   set handler lv_object2->handle_topofpage for gs_alv_is_dp1 .
  3632. CALL METHOD gs_alv_is_dp1->set_table_for_first_display
  3633. EXPORTING
  3634. is_layout            = gs_layout
  3635. it_toolbar_excluding = g_toolbar1
  3636. CHANGING
  3637. it_outtab            = gt_alv_is_dp1[]
  3638. it_fieldcatalog      = gt_fieldcat.
  3639. ELSE.
  3640. "CALL METHOD GS_ALV_IS_DP1->REFRESH_TABLE_DISPLAY.
  3641. "根据GT_ALV_IS_DP1[]中的数据重新刷新ALV
  3642. CALL METHOD gs_alv_is_dp1->set_table_for_first_display
  3643. EXPORTING
  3644. is_layout            = gs_layout
  3645. it_toolbar_excluding = g_toolbar1
  3646. CHANGING
  3647. it_outtab            = gt_alv_is_dp1[]
  3648. it_fieldcatalog      = gt_fieldcat.
  3649. ENDIF.
  3650. ENDMODULE.                    "setlist
  3651. " initial_0300  output
  3652. *&———————————————————————*
  3653. *&      Module  STATUS_0400  OUTPUT
  3654. *&———————————————————————*
  3655. *       text
  3656. *———————————————————————-*
  3657. module status_0400 output.
  3658. SET PF-STATUS '0300'.
  3659. SET TITLEBAR '0300'.
  3660. ENDMODULE.                    "setlist
  3661. " status_0400  output
  3662. *&———————————————————————*
  3663. *&      Module  INITIAL_0400  OUTPUT
  3664. *&———————————————————————*
  3665. *       text
  3666. *———————————————————————-*
  3667. module initial_0400 output.
  3668. DATA: lv_object3 TYPE REF TO lcl_app_compt.
  3669. CREATE OBJECT lv_object3.
  3670. IF gs_alv_bs_dp1 IS INITIAL.
  3671. PERFORM setcon1.
  3672. CREATE OBJECT gs_alv_bs_dp1
  3673. EXPORTING
  3674. i_parent = gs_parent_grid1.
  3675. PERFORM displaybsdp.
  3676. *–>2012.01.18 CCYU START
  3677. SET HANDLER lv_object3->handle_user_command FOR gs_alv_bs_dp1  .
  3678. *<–2012.01.18 CCYU END.
  3679. "SET HANDLER LV_OBJECT2->HANDLE_TOOLBAR FOR GS_ALV_IS_DP1.
  3680. "   set handler lv_object2->handle_topofpage for gs_alv_is_dp1 .
  3681. CALL METHOD gs_alv_bs_dp1->set_table_for_first_display
  3682. EXPORTING
  3683. is_layout            = gs_layout
  3684. it_toolbar_excluding = g_toolbar1
  3685. CHANGING
  3686. it_outtab            = gt_alv_bs_dp1[]
  3687. it_fieldcatalog      = gt_fieldcat.
  3688. ELSE.
  3689. CALL METHOD gs_alv_bs_dp1->set_table_for_first_display
  3690. EXPORTING
  3691. is_layout            = gs_layout
  3692. it_toolbar_excluding = g_toolbar1
  3693. CHANGING
  3694. it_outtab            = gt_alv_bs_dp1[]
  3695. it_fieldcatalog      = gt_fieldcat.
  3696. ENDIF.
  3697. ENDMODULE.                    "setlist
  3698. " initial_0400  output
复制代码
回复

使用道具 举报

zhongguomao
厉害了我的哥。
回复

使用道具 举报

xiao
谢谢分享!
回复

使用道具 举报

zhongguomao
怎么没有了。
回复 支持 反对

使用道具 举报

Kd330
查看写学习学习
回复 支持 反对

使用道具 举报

Kd330
怎么什么都没有的
回复 支持 反对

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表