当前位置:网站首页>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.
边栏推荐
- Binary search
- Huawei Router: basic principle and configuration of Isis (including experiment)
- Unity & facegood audio2face drives face blendshape with audio
- 96. Strange tower of Hanoi
- [jzof] 06 print linked list from end to end
- How to realize three schemes of finclip wechat authorized login
- npm Warn config global `--global`, `--local` are deprecated. Use `--location=global` instead
- 2787: calculate 24
- [development tutorial 6] crazy shell arm function mobile phone - interruption experiment tutorial
- Together again Net program hangs dead, a real case analysis of using WinDbg
猜你喜欢

Use of cache in C #

C # image template matching and marking

C synchronous asynchronous callback state machine async await demo

Information System Project Manager - Chapter 10 project communication management and project stakeholder management

what? Does the multi merchant system not adapt to app? This is coming!

How to gracefully realize regular backup of MySQL database (glory Collection Edition)
![[record of question brushing] 16. The sum of the nearest three numbers](/img/b9/a78b72650e94c75ccbe22af1f43857.png)
[record of question brushing] 16. The sum of the nearest three numbers

A simple method of converting SVG to PDF

Rce (no echo)

How does redis realize inventory deduction and prevent oversold? (glory Collection Edition)
随机推荐
Go language pack management
RESNET interpretation and 1 × 1 Introduction to convolution
[jzof] 05 replace spaces
Classical review: understanding the "knowledge consistency" of neural networks (ICLR 2020)
Scientific computing toolkit SciPy image processing
How to choose securities companies that support flush? Is it safe to open an account on your mobile phone
[shallow copy and deep copy], [heap and stack], [basic type and reference type]
Build your own stock analysis system based on b\s architecture
You must make good use of MySQL and JSON
Day5: three pointers describe a tree
OSI的体系结构,以及各层协议
Pressing Ctrl will cause several key press messages
[install PG]
How to buy Xinke financial products in CICC securities? Revenue 6%
How to design the order system in e-commerce projects? (supreme Collection Edition)
A simple method of converting SVG to PDF
2787: calculate 24
驱动子系统开发
Make good use of these seven tips in code review, and it is easy to establish your opposition alliance
Smarter! Airiot accelerates the upgrading of energy conservation and emission reduction in the coal industry