当前位置:网站首页>Prefabricated financial voucher Bapi
Prefabricated financial voucher Bapi
2022-07-24 21:33:00 【Harryjing2018】
List of articles
1 Introduction
This blog will demostrate that how to generate finance certicate .
2 Code
clear:it_bseg,it_bseg[],it_bkpf,it_bkpf[].
"Add BKPF(header) and BSEG(item data) loop at gt_tmp into gw_tmp. it_bseg-mandt = sy-mandt. " client
it_bseg-bukrs = wa_head-bukrs." Company code it_bseg-gjahr = wa_head-budat1(4)."P_GJAHR. " Fiscal year it_bseg-buzei = gw_tmp-buzei. " Row item
it_bseg-bschl = gw_tmp-bschl. " Accounting code it_bseg-umskz = gw_tmp-umskz. " special G/L identification
it_bseg-hkont = gw_tmp-hkont. " General ledger accounts * IT_BSEG-KUNNR = GW_TMP-KUNNR. " Customer number
it_bseg-lifnr = gw_tmp-lifnr. " Supplier No it_bseg-rstgr = gw_tmp-rstgr. " Reason code
it_bseg-wrbtr = abs( gw_tmp-wrbtr ). " amount of money "it_bseg-skfbt = gw_tmp-skfbt. " The amount of cash discount in the available voucher currency "-------ADD BY ZX 20180801 END-----------
it_bseg-kkber = gw_tmp-kkber. " Scope of control of the lender it_bseg-mwskz = gw_tmp-mwskz. " Sales tax code
it_bseg-kostl = gw_tmp-kostl. " Cost center it_bseg-fkber = gw_tmp-fkber. " Functional range
it_bseg-prctr = gw_tmp-prctr. " Profit center it_bseg-sgtxt = gw_tmp-sgtxt. " Project text
it_bseg-koart = gw_tmp-koart. " Subject type it_bseg-shkzg = gw_tmp-shkzg. " Debit / Credit identification
it_bseg-valut = gw_tmp-valut." Value date it_bseg-zfbdt = sy-datum. it_bseg-zbd1t = gw_tmp-zbd1t. it_bseg-zbd1p = gw_tmp-zbd1p. it_bseg-zbd2t = gw_tmp-zbd2t. it_bseg-zbd2p = gw_tmp-zbd2p. it_bseg-zbd3t = gw_tmp-zbd3t. it_bseg-kokrs = gw_tmp-kokrs. it_bseg-dmbtr = abs( gw_tmp-wrbtr ). " Amount in functional currency
it_bseg-zterm = gw_tmp-zterm.
append it_bseg.
clear gw_tmp.
endloop.
"20200305 by chenyl begin-- data:l_budat type dats, l_budat1 type dats. data: l_date type string. it_bkpf-mandt = sy-mandt. " client
it_bkpf-bukrs = wa_head-bukrs. " Company code it_bkpf-gjahr = wa_head-budat1(4). " Fiscal year
it_bkpf-monat = wa_head-monat." Accounting period it_bkpf-blart = wa_head-blart. " Voucher type
it_bkpf-numpg = wa_head-numpg. " Number of pages of invoice it_bkpf-xblnr = wa_head-xblnr. " reference
it_bkpf-bktxt = wa_head-bktxt. " Header text it_bkpf-usnam = l_uname. " user name
it_bkpf-ppnam = ''." Prefabricator it_bkpf-bldat = wa_head-bldat. " Certificate date
it_bkpf-budat = wa_head-budat1. " Certificate date it_bkpf-wwert = it_bkpf-budat. " Translate Date
it_bkpf-cpudt = it_bkpf-budat. " Input time "IT_BKPF-WAERS = T_WAERS. " Currency code "IT_BKPF-HWAER = T_WAERS. " Local currency it_bkpf-waers = 'RMB'. " Currency code
it_bkpf-hwaer = 'RMB'. " Local currency append it_bkpf. "generate evidence function
call function 'PRELIMINARY_POSTING_FB01'
exporting
i_xcmpl = ''
i_tcode = ''
i_tcode_int = ''
tables
t_bkpf = it_bkpf
t_bseg = it_bseg
t_bsec = it_bsec
t_bset = it_bset
t_bsez = it_bsez
exceptions
error_message = 1.
if sy-msgty ne 'E'.
get parameter id 'BLP' field w_belnr.
* Add log table function
loop at gt_ztfi085b into gw_ztfi085b .
l_idx = sy-tabix.
select max( zno ) into l_zno from ztfi085b
where zanln1 = gw_ztfi085b-zanln1 and bukrs = gw_ztfi085b-bukrs.
select single * into lw_ztfi085b from ztfi085b
where zanln1 = gw_ztfi085b-zanln1 and bukrs = gw_ztfi085b-bukrs and zno = l_zno.
if sy-subrc = 0.
gw_ztfi085b-zno = l_zno + 1.
read table it_item into wa_item with key hkont = '1601020001' .
if sy-subrc = 0.
gw_ztfi085b-zkansw = wa_item-wrbtr .
gw_ztfi085b-kansw = lw_ztfi085b-kansw .
if wa_item-shkzg = 'S'.
gw_ztfi085b-answl = lw_ztfi085b-answl + wa_item-wrbtr .
else.
gw_ztfi085b-answl = lw_ztfi085b-answl - wa_item-wrbtr .
endif.
endif.
else .
gw_ztfi085b-zno = 1.
read table it_item into wa_item with key hkont = '1601020001' .
if sy-subrc = 0.
gw_ztfi085b-kansw = wa_item-wrbtr .
gw_ztfi085b-zkansw = wa_item-wrbtr .
gw_ztfi085b-answl = wa_item-wrbtr .
endif.
endif.
if g_pz = 'ZGS'.
elseif g_pz = 'FGZ'.
endif.
gw_ztfi085b-budat = wa_head-budat1 .
gw_ztfi085b-monat = wa_head-monat .
gw_ztfi085b-gjahr = wa_head-budat1+0(4) .
modify gt_ztfi085b index l_idx from gw_ztfi085b transporting belnr zno budat monat gjahr zkansw kansw
answl .
clear:gw_ztfi085b,l_idx , l_zno,wa_item,lw_ztfi085b.
endloop.
modify ztfi085b from table gt_ztfi085b.
if sy-subrc = 0.
commit work.
else.
rollback work.
endif.
concatenate ' Prefabricated voucher :' w_belnr ' Create success !' into w_msg.
message s000(zmsg001) with w_msg.
w_save = 'X'.
else.
clear w_belnr.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
message w_msg type 'S' display like 'E'.
leave screen.
endif.
边栏推荐
- One bite of Stream(7)
- Information system project manager must recite the core examination site (47) project subcontract
- How do test / development programmers survive the midlife crisis? You can see it at a glance
- Baidu interview question - judge whether a positive integer is to the power of K of 2
- Leetcode skimming -- bit by bit record 018
- Spark related FAQ summary
- [jzof] 05 replace spaces
- Shenzhen Merchants Securities account opening? Is it safe to open a mobile account?
- How to buy Xinke financial products in CICC securities? Revenue 6%
- What are intelligent investment advisory products?
猜你喜欢
Hilditch refinement (implementation I)

Rce (no echo)

Go language pack management

Uniqueness and ordering in set
![[Development Tutorial 4] open source Bluetooth heart rate waterproof sports Bracelet - external flash reading and writing](/img/cf/db40dcbb141c5a2e8ccaed7700fa3e.png)
[Development Tutorial 4] open source Bluetooth heart rate waterproof sports Bracelet - external flash reading and writing

Smarter! Airiot accelerates the upgrading of energy conservation and emission reduction in the coal industry

How to gracefully realize regular backup of MySQL database (glory Collection Edition)

01_ UE4 advanced_ PBR material

How to realize three schemes of finclip wechat authorized login

Baidu interview question - judge whether a positive integer is to the power of K of 2
随机推荐
How about Urumqi Shenwan Hongyuan securities account opening? Is it safe?
Redis (12) -- redis server
Experience of using dump file to reverse locate crash location
Detailed explanation of ThreadLocal
How to design the order system in e-commerce projects? (supreme Collection Edition)
Codeforces Round #809 (Div. 2)(A~D2)
ECCV 2022 open source | target segmentation for 10000 frames of video
Unfair distribution
Leetcode skimming -- bit by bit record 018
Problems with SQLite compare comparison tables
【类的组合(在一个类中定义一个类)】
Summary of yarn capacity scheduler
C # image template matching and marking
Conditional judgment of Shell Foundation
Opencv learning Day2
Build your own stock analysis system based on b\s architecture
Baidu interview question - judge whether a positive integer is to the power of K of 2
Can century model simulate soil respiration? Practice technology application and case analysis of century model
【Pyspark基础】行转列和列转行(超多列时)
Together again Net program hangs dead, a real case analysis of using WinDbg