SAP ABAP FV60 : Park Document Using Custom Function Module
I_Header Structure
LT_GLACCOUNT structure
LT_WIHTAX Structure
function z_vim_park_fv60.
*"----------------------------------------------------------------------
*"*"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.
refresh bdc_data.
clear : str_bldat, str_budat, str_zfbdt.
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.
"New
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=DUMMY'.
perform bdc_field using 'RF05A-BUSCS'
'R'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-MWSKZ'.
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-WAERS'
i_header-waers.
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' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/ECCDE'.
perform bdc_dynpro using 'SAPLACHD' '1000'.
perform bdc_field using 'BDC_CURSOR'
'BKPF-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'BKPF-BUKRS'
i_header-bukrs.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF05A-BUSCS'
'R'.
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-WAERS'
i_header-waers.
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.
"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-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' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=0005'.
else.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endif.
clear ls_gl.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=DUMMY'.
perform bdc_field using 'RF05A-BUSCS'
'R'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-XMWST'.
perform bdc_field using 'INVFO-ACCNT'
i_header-lifnr.
perform bdc_field using 'INVFO-BLDAT'
str_bldat.
perform bdc_field using 'INVFO-XBLNR'
'FAKTURPAJAK'.
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' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=PAYM'.
perform bdc_field using 'RF05A-BUSCS'
'R'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-XMWST'.
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' '1100'.
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_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=MORE'.
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_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-GSBER'.
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' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=WT'.
perform bdc_field using 'BDC_CURSOR'
'INVFO-GSBER'.
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' '1100'.
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 strbdcfld
ls_wihtax-wt_amount.
clear ls_wihtax.
endloop.
'10000'.
perform bdc_dynpro using 'SAPMF05A' '1100'.
perform bdc_field using 'BDC_OKCODE'
'=BP'.
perform bdc_field using 'BDC_CURSOR'
'ACWT_ITEM-WT_QSSHB(01)'.
ls_bdcopt-dismode = 'N'. "A=FOREGROUND N=BACKGROUND E=ERROR
ls_bdcopt-updmode = 'A'. "S=SYNCHRONOUS A=ASYNCHRONOUS L=LOCAL
ls_bdcopt-defsize = 'X'.
ls_bdcopt-racommit = 'X'.
refresh lt_return.
call transaction 'FV60'
using bdc_data
messages into lt_return
options from ls_bdcopt.
endfunction.
Comments
Post a Comment