当前位置:网站首页>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.
边栏推荐
- Codeforces Round #808 (Div. 2)(A~D)
- Shell introduction and variable definition
- None of the most complete MySQL commands in history is applicable to work and interview (supreme Collection Edition)
- Conditional judgment of Shell Foundation
- ECCV 2022 open source | target segmentation for 10000 frames of video
- Today, there's a power failure for one day.... stop working for another day. Don't forget to study
- Using gcc to avoid stack smash attack
- Pressing Ctrl will cause several key press messages
- Can bank financial products be redeemed and transferred out on the same day?
- Sword finger offer 15. number of 1 in binary
猜你喜欢

String matching (Huawei)

From front-line development to technical director, you are almost on the shelf

Volcano engine releases cloud growth solutions for six industries

Penetration test - command execution injection

Mysql database query is so slow. Besides index, what else can it do?

Metauniverse: technological evolution, industrial ecology and big country game

C synchronous asynchronous callback state machine async await demo

Lecun proposed that mask strategy can also be applied to twin networks based on vit for self supervised learning!

About the acid of MySQL, there are thirty rounds of skirmishes with mvcc and interviewers

CAD sets hyperlinks to entities (WEB version)
随机推荐
Brand new: the latest ranking of programming languages in July
Is there any capital requirement for the online account opening of Ping An Securities? Is it safe
Is it safe to open an account on Alipay
Jenkins introduction
Career development suggestions shared by ten CIOs
Drawing library Matplotlib drawing
None of the most complete MySQL commands in history is applicable to work and interview (supreme Collection Edition)
Together again Net program hangs dead, a real case analysis of using WinDbg
C local functions and yield statements
climb stairs
Intel internship mentor layout problem 1
Problems with SQLite compare comparison tables
Quick sort
[verification of ID number]
Go language pack management
Leetcode skimming -- bit by bit record 017
One bite of Stream(6)
Press Ctrl to pop up a dialog box. How to close this dialog box?
Bring new people's experience
[shallow copy and deep copy], [heap and stack], [basic type and reference type]