SAP ABAP Post Customer Parked Invoice
function Z_VIM_POST_FV70.
*"--------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_HEADER) TYPE ZSVIM_LIVNPO_HEADER
*" TABLES
*" LT_GLACCOUNT STRUCTURE ZSVIM_LIVNPO_GL OPTIONAL
*" LT_WIHTAX STRUCTURE ZSVIM_LIVNPO_WHT OPTIONAL
*" LT_RETURN STRUCTURE BDCMSGCOLL
*"--------------------------------------------------------------------
data :
ls_gl type zsvim_livnpo_gl,
ls_wihtax type zsvim_livnpo_wht,
ls_bdcopt type ctu_params,
str_bldat type char10,
str_budat type char10,
str_zfbdt type char10,
itabidx(2) type n,
strbdcfld type string.
data :
xbelnr type bkpf-belnr,
xgjahr type bkpf-gjahr,
xbukrs type bkpf-bukrs.
refresh bdc_data.
clear : str_bldat, str_budat, str_zfbdt, xbelnr, xgjahr, xbukrs.
concatenate i_header-bldat+6(2) '.' i_header-bldat+4(2) '.' i_header-bldat(4) into str_bldat.
concatenate i_header-budat+6(2) '.' i_header-budat+4(2) '.' i_header-budat(4) into str_budat.
concatenate i_header-zfbdt+6(2) '.' i_header-zfbdt+4(2) '.' i_header-zfbdt(4) into str_zfbdt.
xbelnr = i_header-sapdoc(10).
xbukrs = i_header-sapdoc+10(4).
xgjahr = i_header-sapdoc+14(4).
perform bdc_dynpro using 'SAPMF05V' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF05V-BELNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF05V-BUKRS'
xbukrs.
perform bdc_field using 'RF05V-BELNR'
xbelnr.
perform bdc_field using 'RF05V-GJAHR'
xgjahr.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=0003'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-ACCNT'.
perform bdc_field using 'INVFO-ACCNT'
i_header-lifnr.
perform bdc_field using 'INVFO-BLDAT'
str_bldat.
perform bdc_field using 'INVFO-XBLNR'
i_header-xblnr.
perform bdc_field using 'INVFO-BUDAT'
str_budat.
* perform bdc_field using 'INVFO-WRBTR'
* i_header-rmwwr.
* perform bdc_field using 'INVFO-XMWST'
* 'X'.
* perform bdc_field using 'INVFO-MWSKZ'
* i_header-mwskz1.
* perform bdc_field using 'INVFO-BUPLA'
* i_header-bupla.
* perform bdc_field using 'INVFO-SGTXT'
* i_header-sgtxt.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=0007'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-ACCNT'.
perform bdc_field using 'INVFO-ACCNT'
i_header-lifnr.
perform bdc_field using 'INVFO-BLDAT'
str_bldat.
perform bdc_field using 'INVFO-XBLNR'
i_header-xblnr.
perform bdc_field using 'INVFO-BUDAT'
str_budat.
* perform bdc_field using 'INVFO-WRBTR'
* i_header-rmwwr.
* perform bdc_field using 'INVFO-XMWST'
* 'X'.
* perform bdc_field using 'INVFO-MWSKZ'
* i_header-mwskz1.
* perform bdc_field using 'INVFO-BUPLA'
* i_header-bupla.
* perform bdc_field using 'INVFO-SGTXT'
* i_header-sgtxt.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=MAIN'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
"GL DATA
clear : ls_gl, itabidx.
loop at lt_glaccount into ls_gl.
itabidx = itabidx + 1.
if itabidx >= 4.
itabidx = 4.
endif.
clear strbdcfld.
concatenate 'ACGL_ITEM-HKONT(' itabidx ')' into strbdcfld.
perform bdc_field using 'BDC_CURSOR'
strbdcfld.
clear strbdcfld.
concatenate 'ACGL_ITEM-HKONT(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_gl-hkont.
clear strbdcfld.
concatenate 'ACGL_ITEM-MWSKZ(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_gl-adtxcode.
clear strbdcfld.
concatenate 'ACGL_ITEM-WRBTR(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_gl-adjamount.
clear strbdcfld.
concatenate 'ACGL_ITEM-ZUONR(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_gl-zuonr.
clear strbdcfld.
concatenate 'ACGL_ITEM-SGTXT(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_gl-adtext.
clear strbdcfld.
concatenate 'ACGL_ITEM-GSBER(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
i_header-bupla.
clear strbdcfld.
concatenate 'ACGL_ITEM-KOSTL(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_gl-kostl.
if itabidx >= 4.
clear strbdcfld.
concatenate 'ACGL_ITEM-MARKSP(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
'X'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=0005'.
else.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endif.
clear ls_gl.
endloop.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=MAIN'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'INVFO-ACCNT'
i_header-lifnr.
perform bdc_field using 'INVFO-BLDAT'
str_bldat.
perform bdc_field using 'INVFO-XBLNR'
i_header-xblnr.
perform bdc_field using 'INVFO-BUDAT'
str_budat.
perform bdc_field using 'INVFO-WRBTR'
i_header-rmwwr.
perform bdc_field using 'INVFO-XMWST'
'X'.
perform bdc_field using 'INVFO-MWSKZ'
i_header-mwskz1.
perform bdc_field using 'INVFO-BUPLA'
i_header-bupla.
perform bdc_field using 'INVFO-SGTXT'
i_header-sgtxt.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=PAYM'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-ZTERM'.
perform bdc_field using 'INVFO-ZFBDT'
str_zfbdt.
perform bdc_field using 'INVFO-ZTERM'
i_header-zterm.
perform bdc_field using 'INVFO-ZLSPR'
i_header-zlspr.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=MORE'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-BKTXT'.
perform bdc_field using 'INVFO-ZUONR'
i_header-zuonr.
perform bdc_field using 'INVFO-BKTXT'
i_header-bktxt.
perform bdc_field using 'INVFO-GSBER'
i_header-bupla.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=TAX'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=WT'.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
clear : ls_wihtax, itabidx.
loop at lt_wihtax into ls_wihtax.
itabidx = itabidx + 1.
clear strbdcfld.
concatenate 'ACWT_ITEM-WT_WITHCD(' itabidx ')' into strbdcfld.
perform bdc_field using 'BDC_CURSOR'
strbdcfld.
clear strbdcfld.
concatenate 'ACWT_ITEM-WT_WITHCD(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_wihtax-wt_withcd.
* clear strbdcfld.
* concatenate 'ACWT_ITEM-WT_QSSHB(' itabidx ')' into strbdcfld.
* perform bdc_field using 'BDC_CURSOR'
* strbdcfld.
clear strbdcfld.
concatenate 'ACWT_ITEM-WT_QSSHB(' itabidx ')' into strbdcfld.
perform bdc_field using strbdcfld
ls_wihtax-wt_amount.
clear ls_wihtax.
endloop.
perform bdc_dynpro using 'SAPMF05A' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
ls_bdcopt-dismode = 'N'. "A=FOREGROUND N=BACKGROUND E=ERROR
ls_bdcopt-updmode = 'S'. "S=SYNCHRONOUS A=ASYNCHRONOUS L=LOCAL
ls_bdcopt-defsize = 'X'.
ls_bdcopt-racommit = 'X'.
refresh lt_return.
call transaction 'FBV0'
using bdc_data
messages into lt_return
options from ls_bdcopt.
endfunction.
Comments
Post a Comment