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

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

1.设计思路:

SAP没有提供标准的符合中国标准的资产负债表和损益表,需要我们在系统中自定义开发,我们在配置报表版本时都指定了

一个项目的编号,一个版本下面都有期其统驭的科目范围,我们可以根据这个项目编号找到相应的科目范围,然后根据科目范围

获取科目借贷汇总的值。

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

d0a5llwkebnjfy
我们传统的资产负债表如下格式:
eyhbe8qm0m_n_11la
我们可以在程序中用项目编号找到其下面的科目范围,然后取科目汇总值,因为资产负债表是固定的,所以我们要
建立一个CBO表来存放各个具体的项目和在SAP中对应的项目编号。
最后要强调的是在资产负债表中未分配利润的计算:
未分配利润的期末余额=年初结转额(留存收益的上年余额)+今年截至到本月的盈利额(利润表中有体现)
利润表的思路和资产负债表是一样的。
aht5dycclvu_rtlev2
具体的代码实现:
*&———————————————————————*
*&Company Code:N207
*& module:FI
*& create by:rrzhang
*& create date:2011.12.28
*&———————————————————————*
*& title:资产负债表,利润表
*& Description:资产负债表,利润表报表呈现
*&———————————————————————*
*& Change History
*———————————————————————-*
*C.R No    |Date|Developer|Description
*———————————————————————-*
*         2012.01.11|ccyu
*———————————————————————-*
REPORT  zfir00026.
INCLUDE zfir00026_top.
INCLUDE zfir00026_cls.
INCLUDE zfir00026_f01.
INCLUDE zfir00026_o01.
INCLUDE zfir00026_i01.
INCLUDE <icon>.
INITIALIZATION.
p_y = sy-datum+0(4).
p_m = sy-datum+4(2).
AT SELECTION-SCREEN OUTPUT.
PERFORM setdis USING p_rpv.
IF c IS INITIAL.
PERFORM setlist.
gv_name = ‘爱思开实业(上海)商贸有限公司合并财务报表版本’.
c = ‘X’.
gv_rp = ‘资产负债表’.
ELSE.
PERFORM setpcg USING p_rpv.
CASE p_rpv.
WHEN ‘2070′.
gv_name = ‘爱思开实业(上海)商贸有限公司合并财务报表版本’.
WHEN ‘2071′.
gv_name = ‘爱思开实业(上海)商贸有限公总部财务报表版本’.
WHEN ‘2072′.
gv_name = ‘爱思开实业(上海)商贸有限公司直营店财务报表版本’.
WHEN ‘2073′.
gv_name = ”.
ENDCASE.
IF p_rp = ‘BS’.
gv_rp = ‘资产负债表’.
ELSE.
gv_rp = ‘利润表’.
ENDIF.
ENDIF.
START-OF-SELECTION.
PERFORM synchrodata.
PERFORM get_data1.
*&———————————————————————*
*&  Include           ZFIR00026_TOP
*&———————————————————————*
*Data definition
TYPE-POOLS vrm.
TABLES:faglflexa.
“同步数据用的凭证抬头表
DATA:BEGIN OF gt_bkpfsyn OCCURS 0,
gjahr LIKE bkpf-gjahr,
bukrs LIKE bkpf-bukrs,
belnr LIKE bkpf-belnr,
END OF gt_bkpfsyn.
DATA ly(4) TYPE n.
“同步数据用的凭证行项目表(bseg)
DATA:BEGIN OF gt_bsegsyn OCCURS 0,
gjahr LIKE bseg-gjahr,
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
prctr LIKE bseg-prctr,
pprct LIKE bseg-pprct,
buzei LIKE bseg-buzei,
END OF gt_bsegsyn.
DATA:BEGIN OF gt_fagasyn OCCURS 0.
INCLUDE STRUCTURE faglflexa.
DATA:END OF gt_fagasyn.
TYPES: ch(3) TYPE c,
cf(4) TYPE c,
cgcp(12) TYPE c,
ok_code LIKE sy-ucomm.
DATA:c,d,
gv_bs TYPE ukurs_curr VALUE 1,”倍数
gv_iden(2).
“要显示的资产负债表
DATA:BEGIN OF gt_alv_bs0 OCCURS 0,
lct1 TYPE int1,
item1 TYPE zitem,
yamt1 TYPE hslvt12,
ysamt1 TYPE hslvt12,
lct2 TYPE int1,
item2 TYPE zitem,
yamt2 TYPE hslvt12,
ysamt2 TYPE hslvt12,
waers LIKE t001-waers,
END OF  gt_alv_bs0.
DATA:BEGIN OF gt_bs OCCURS 0,
ukurs TYPE ukurs_curr,
gdatu TYPE gdatu_inv,
END OF gt_bs.
DATA:gv_mf(5).”The month field
*The report version account information.
“要显示的利润表
DATA:BEGIN OF gt_alv_is0 OCCURS 0,
lct TYPE int1,
item TYPE zitem,
yamt LIKE faglflext-hslvt,”本年累计数
mamt LIKE faglflext-hslvt,”本月累计数
waers LIKE t001-waers,
END OF gt_alv_is0.
“下载数据的内表
DATA:BEGIN OF gt_alv_is01 OCCURS 0,
lct TYPE int1,
item TYPE zitem,
yamt LIKE faglflext-hslvt,”本年累计数
mamt LIKE faglflext-hslvt,”本月累计数
END OF gt_alv_is01.
*利润表下钻数据内表
* –>2012.01.16 CCYU START
DATA:BEGIN OF gt_skat OCCURS 0,
saknr LIKE skat-saknr,
txt50 LIKE skat-txt50,
END OF gt_skat.
* <–2012.01.16 CCYU END.
DATA:BEGIN OF gt_alv_is_dp1  OCCURS 0,
racct LIKE faglflexa-racct,
* –>2012.01.16 CCYU START
txt50 LIKE skat-txt50,
* <–2012.01.16 CCYU END.
hsl LIKE faglflexa-hsl,
END OF gt_alv_is_dp1.
*利润表下钻数据内表
DATA:BEGIN OF gt_alv_bs_dp1  OCCURS 0,
racct LIKE faglflexa-racct,
* –>2012.01.16 CCYU START
txt50 LIKE skat-txt50,
* <–2012.01.16 CCYU END.
hsl LIKE faglflexa-hsl,
END OF gt_alv_bs_dp1.
DATA:BEGIN OF gt_alv_bs_dp2  OCCURS 0,
racct LIKE faglflexa-racct,
* –>2012.01.16 CCYU START
txt50 LIKE skat-txt50,
* <–2012.01.16 CCYU END.
hsl LIKE faglflexa-hsl,
END OF gt_alv_bs_dp2.
TYPES:BEGIN OF gs_alv_bs_dp_obj ,
racct LIKE faglflexa-racct,
* –>2012.01.16 CCYU START
txt50 LIKE skat-txt50,
* <–2012.01.16 CCYU END.
hsl LIKE faglflexa-hsl,
END OF gs_alv_bs_dp_obj.
DATA:gs_alv_bs_dp_obj1 TYPE gs_alv_bs_dp_obj.
TYPES:gt_alv_bs_dp TYPE STANDARD TABLE OF gs_alv_bs_dp_obj.
*利润表下钻临时数据内表
DATA:BEGIN OF gt_alv_is_dp2 OCCURS 0,
racct LIKE faglflexa-racct,
* –>2012.01.16 CCYU START
txt50 LIKE skat-txt50,
* <–2012.01.16 CCYU END.
hsl LIKE faglflexa-hsl,
END OF gt_alv_is_dp2.
DATA:BEGIN OF gt_fagl_011zc OCCURS 0,
versn LIKE fagl_011zc-versn,
ergsl  LIKE fagl_011zc-ergsl,
txt45 LIKE fagl_011qt-txt45,
vonkt LIKE fagl_011zc-vonkt,
biskt LIKE fagl_011zc-biskt,
END OF gt_fagl_011zc.
DATA:BEGIN OF gt_fagl_011qt OCCURS 0,
ergsl  LIKE fagl_011qt-ergsl,
txt45 LIKE fagl_011qt-txt45,
END OF gt_fagl_011qt.
DATA:BEGIN OF gt_mamt_is OCCURS 0,
amt LIKE faglflext-hslvt,
END OF gt_mamt_is.
RANGES gr_act FOR faglflext-racct.
DATA:BEGIN OF gt_monv OCCURS 0,
month(2) TYPE n,
value LIKE faglflext-hslvt,
END OF gt_monv.
DATA:BEGIN OF gs_hsl,
hsl01 LIKE faglflext-hslvt,
hsl02 LIKE faglflext-hslvt,
hsl03 LIKE faglflext-hslvt,
hsl04 LIKE faglflext-hslvt,
hsl05 LIKE faglflext-hslvt,
hsl06 LIKE faglflext-hslvt,
hsl07 LIKE faglflext-hslvt,
hsl08 LIKE faglflext-hslvt,
hsl09 LIKE faglflext-hslvt,
hsl10 LIKE faglflext-hslvt,
hsl11 LIKE faglflext-hslvt,
hsl12 LIKE faglflext-hslvt,
END OF gs_hsl.
DATA:BEGIN OF gs_hsl1,
hsl01 LIKE faglflext-hslvt,
hsl02 LIKE faglflext-hslvt,
hsl03 LIKE faglflext-hslvt,
hsl04 LIKE faglflext-hslvt,
hsl05 LIKE faglflext-hslvt,
hsl06 LIKE faglflext-hslvt,
hsl07 LIKE faglflext-hslvt,
hsl08 LIKE faglflext-hslvt,
hsl09 LIKE faglflext-hslvt,
hsl10 LIKE faglflext-hslvt,
hsl11 LIKE faglflext-hslvt,
hsl12 LIKE faglflext-hslvt,
hslvt LIKE faglflext-hslvt,
END OF gs_hsl1.
DATA:gs_alv_is TYPE REF TO cl_gui_alv_grid,”the alv object for is report
gs_alv_bs TYPE REF TO cl_gui_alv_grid,”the alv object for bs report
gs_alv_is_dp1 TYPE REF TO cl_gui_alv_grid,”the alv object for bs report
gs_alv_bs_dp1 TYPE REF TO cl_gui_alv_grid,”the alv object for bs report
gs_con TYPE REF TO cl_gui_custom_container,”the contianer object
gs_con1 TYPE REF TO cl_gui_custom_container,”the contianer object
gs_layout   TYPE lvc_s_layo,”set the layout of the alv
gt_fieldcat TYPE lvc_t_fcat,”the field catelog table
gs_fieldcat TYPE lvc_s_fcat,”the field catelog work area
g_toolbar   TYPE ui_functions,”the toolbar of the alv
g_toolbar1   TYPE ui_functions,”the toolbar of the alv
gt_sort     TYPE lvc_t_sort,”control the sort of the alv
gs_sort     TYPE lvc_s_sort.”the work area of the gt_sort
DATA:gs_dyndoc_id TYPE REF TO cl_dd_document ,
gs_dyndoc_id1 TYPE REF TO cl_dd_document ,
gs_splitter TYPE REF TO cl_gui_splitter_container ,
gs_parent_html TYPE REF TO cl_gui_container ,
gs_parent_grid TYPE REF TO cl_gui_container ,
gs_splitter1 TYPE REF TO cl_gui_splitter_container ,
gs_parent_html1 TYPE REF TO cl_gui_container ,
gs_parent_grid1 TYPE REF TO cl_gui_container ,
gs_html_cntrl TYPE REF TO cl_gui_html_viewer .
*SCREEN DEFINE
DATA  ok_code.
* –>2012.01.17 CCYU START
DATA:BEGIN OF gt_head1  OCCURS 0,
t1(6),
t2(20),
t3(20),
t4(20),
t5(6),
t6(20),
t7(20),
t8(20),
END OF gt_head1.
DATA:BEGIN OF gt_head2  OCCURS 0,
t1(6),
t2(20),
t3(20),
t4(20),
END OF gt_head2.
DATA:BEGIN OF gt_alv_bs01 OCCURS 0,
lct1 TYPE int1,
item1 TYPE zitem,
yamt1 TYPE hslvt12,
ysamt1 TYPE hslvt12,
lct2 TYPE int1,
item2 TYPE zitem,
yamt2 TYPE hslvt12,
ysamt2 TYPE hslvt12,
END OF  gt_alv_bs01.
* <–2012.01.17 CCYU END.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
“公司代码
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (79) text-002.
SELECTION-SCREEN END OF LINE.
“Currency
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.                               “从位置1开始输出
SELECTION-SCREEN COMMENT (7) text-003 FOR FIELD p_curr.
SELECTION-SCREEN POSITION 15.
PARAMETERS p_curr TYPE ch AS LISTBOX  VISIBLE LENGTH 12  OBLIGATORY DEFAULT ‘CNY’ .
SELECTION-SCREEN END OF LINE.
“report version
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (9) text-004 FOR FIELD p_rpv.
SELECTION-SCREEN POSITION 15.
PARAMETERS p_rpv TYPE cf AS LISTBOX VISIBLE LENGTH 12 USER-COMMAND dp OBLIGATORY DEFAULT ‘2070′.
SELECTION-SCREEN POSITION 28.
SELECTION-SCREEN COMMENT (60) gv_name.
SELECTION-SCREEN END OF LINE.
“profit center group
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (12) text-005 FOR FIELD p_pcg.
SELECTION-SCREEN POSITION 15.
PARAMETERS p_pcg TYPE cgcp AS LISTBOX VISIBLE LENGTH 12 USER-COMMAND dp1 OBLIGATORY.
SELECTION-SCREEN END OF LINE.
“profit center
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (12) text-006 FOR FIELD p_pc.
SELECTION-SCREEN POSITION 15.
PARAMETERS p_pc TYPE cgcp AS LISTBOX VISIBLE LENGTH 12 MODIF ID pc.
SELECTION-SCREEN END OF LINE.
“REPROT
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (12) text-007 FOR FIELD p_rp.
SELECTION-SCREEN POSITION 15.
PARAMETERS p_rp TYPE cgcp AS LISTBOX VISIBLE LENGTH 12 USER-COMMAND rp OBLIGATORY DEFAULT ‘BS’.
SELECTION-SCREEN COMMENT (12) gv_rp.
SELECTION-SCREEN END OF LINE.
“YEAR
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (12) text-008 FOR FIELD p_y.
SELECTION-SCREEN POSITION 15.
PARAMETERS p_y(4) TYPE n OBLIGATORY.
SELECTION-SCREEN END OF LINE.
“MONTH
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN COMMENT (12) text-009 FOR FIELD p_m.
SELECTION-SCREEN POSITION 15.
* PARAMETERS P_M(2) TYPE N OBLIGATORY.
* –>2012.01.11 ccyu START
PARAMETERS p_m(3) TYPE n AS LISTBOX  VISIBLE LENGTH 4 OBLIGATORY.
* <–2012.01.11 ccyu END.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK blk.
*&———————————————————————*
*&———————————————————————*
*&       Class LCL_APP_COMPT
*&———————————————————————*
*        the event handler class for alv
*———————————————————————-*
CLASS LCL_APP_COMPT DEFINITION.
PUBLIC SECTION .
*the function handle_toolbar which handle the toolbar event of the alv
METHODS : HANDLE_TOOLBAR FOR EVENT TOOLBAR
OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT
E_INTERACTIVE .
*the function handle_user_command which handle the user_command
*event of the alv
METHODS: HANDLE_USER_COMMAND FOR EVENT USER_COMMAND
OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM .
*the function handle_topofpage which handle the top of page
METHODS:HANDLE_TOPOFPAGE FOR EVENT TOP_OF_PAGE
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID .
*handle the hotspot_click事件
METHODS:HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK
OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO.
ENDCLASS.               “LCL_APP_COMPT
*&  Include           ZOOALV_CLS                                       *
*&———————————————————————*
*&———————————————————————*
*&       Class (Implementation)  lcl_app_compt
*&———————————————————————*
*        implementation:for alv
*———————————————————————-*
CLASS LCL_APP_COMPT IMPLEMENTATION.
METHOD : HANDLE_TOOLBAR .
PERFORM MODIFY_TOOLBAR USING E_OBJECT ” .
ENDMETHOD .                    ”:
METHOD: HANDLE_USER_COMMAND .
PERFORM FM_USER_COMMAND USING E_UCOMM .
ENDMETHOD .                    ”handle_user_command
*TOP OF PAGE
METHOD: HANDLE_TOPOFPAGE .
PERFORM FM_ADD_TOPOFPAGE USING E_DYNDOC_ID .
ENDMETHOD .                    ”handle_topofpage
METHOD:HANDLE_HOTSPOT_CLICK.
PERFORM DRILLDOWNIS1 USING E_ROW_ID E_COLUMN_ID ES_ROW_NO.
ENDMETHOD.                    ”HANDLE_HOTSPOT_CLICK
ENDCLASS.               “lcl_app_compt
*&———————————————————————*
*&  Include           ZFIR00026_F01
*&———————————————————————*
*&———————————————————————*
*&      Form  SETLIST
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM setlist .
DATA: itab TYPE STANDARD TABLE OF vrm_value,
line TYPE vrm_value.
CLEAR itab[].
line-key = ‘CNY’.
line-text = ‘CNY’.
APPEND line TO itab.
line-key = ‘KRW’.
line-text = ‘KRW’.
APPEND line TO itab.
CALL FUNCTION ‘VRM_SET_VALUES’
EXPORTING
id     = ‘P_CURR’
values = itab[].
CLEAR itab[].
CLEAR line.
line-key = ‘2070′.
line-text = ‘2070′.
APPEND line TO itab.
line-key = ‘2071′.
line-text = ‘2071′.
APPEND line TO itab.
line-key = ‘2072′.
line-text = ‘2072′.
APPEND line TO itab.
line-key = ‘2073′.
line-text = ‘2073′.
APPEND line TO itab.
CALL FUNCTION ‘VRM_SET_VALUES’
EXPORTING
id     = ‘P_RPV’
values = itab[].
IF p_pcg IS INITIAL.
CLEAR itab[].
CLEAR line.
line-key = ‘N207′.
line-text = ‘N207′.
APPEND line TO itab.
CALL FUNCTION ‘VRM_SET_VALUES’
EXPORTING
id     = ‘P_PCG’
values = itab[].
ENDIF.
CLEAR itab[].
CLEAR line.
line-key = ‘BS’.
line-text = ‘BS’.
APPEND line TO itab.
line-key = ‘IS’.
line-text = ‘IS’.
APPEND line TO itab.
CALL FUNCTION ‘VRM_SET_VALUES’
EXPORTING
id     = ‘P_RP’
values = itab[].
* –>2012.01.11 CCYU SRART
CLEAR itab[].
CLEAR line.
line-key = ‘01′.
line-text = ‘01′.
APPEND line TO itab.
line-key = ‘02′.
line-text = ‘02′.
APPEND line TO itab.
line-key = ‘03′.
line-text = ‘03′.
APPEND line TO itab.
line-key = ‘04′.
line-text = ‘04′.
APPEND line TO itab.
line-key = ‘05′.
line-text = ‘05′.
APPEND line TO itab.
line-key = ‘06′.
line-text = ‘06′.
APPEND line TO itab.
line-key = ‘07′.
line-text = ‘07′.
APPEND line TO itab.
line-key = ‘08′.
line-text = ‘08′.
APPEND line TO itab.
line-key = ‘09′.
line-text 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
基于BERT构建新闻文本分类模型,并结合node.js + vue完成了一个可视化界面。 爬虫(Web Crawler)是一种自动化程序,用于从互联网上收集信息。其主要功能是访问网页、提取数据并存储,以便后续分析或展示。爬虫通常由搜索引擎、数据挖掘工具、监测系统等应用于网络数据抓取的场景。 爬虫的工作流程包括以下几个关键步骤: URL收集: 爬虫从一个或多个初始URL开始,递归或迭代地发现新的URL,构建一个URL队列。这些URL可以通过链接分析、站点地图、搜索引擎等方式获取。 请求网页: 爬虫使用HTTP或其他协议向目标URL发起请求,获取网页的HTML内容。这通常通过HTTP请求库实现,如Python中的Requests库。 解析内容: 爬虫对获取的HTML进行解析,提取有用的信息。常用的解析工具有正则表达式、XPath、Beautiful Soup等。这些工具帮助爬虫定位和提取目标数据,如文本、图片、链接等。 数据存储: 爬虫将提取的数据存储到数据库、文件或其他存储介质中,以备后续分析或展示。常用的存储形式包括关系型数据库、NoSQL数据库、JSON文件等。 遵守规则: 为避免对网站造成过大负担或触发反爬虫机制,爬虫需要遵守网站的robots.txt协议,限制访问频率和深度,并模拟人类访问行为,如设置User-Agent。 反爬虫应对: 由于爬虫的存在,一些网站采取了反爬虫措施,如验证码、IP封锁等。爬虫工程师需要设计相应的策略来应对这些挑战。 爬虫在各个领域都有广泛的应用,包括搜索引擎索引、数据挖掘、价格监测、新闻聚合等。然而,使用爬虫需要遵守法律和伦理规范,尊重网站的使用政策,并确保对被访问网站的服务器负责。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值