VA01-VA03,VA41,VA42,VA43這三個事務代碼的增強直接寫在他們的程序裏面,這裏的增強有點特殊要注意首先要讓他顯示出來,而後才能修改,
程序名:SAPMV45A 增強的點在:include mv45afzb.和include mv45afzz. 雙擊進去後點擊編輯菜單裏面的增強,如下圖:
然後對準裏面的增強點寫相應的代碼。
2.在寫VL01N和VL02N發貨過賬的增強的時候要進去程序相應的點調試然後去找到增強,主要在包含裏面:FV50XF0B_BELEG_SICHERN
3.在寫VF01退出的時候擡頭文本更新時候在包含裏面:MV60AF0B_BELEG_SICHERN,在程序裏面必須等待幾秒才能進行操作,用 WAIT UP TO 2 SECONDS.
4.vl01n點發貨過賬以後的增強點在程序SAPMV50A裏面的es_fv50xf0b_beleg_sichern這裏的第六個增強點
5.VF01點擊保存後的增強點在程序SAPMV60A裏面的enhancement-section beleg_sichern_11 spots es_sapmv60a.
” 把發貨單的擡頭文本和行項目文本帶到發票,此處增強是VL01N直接點擊發貨過賬按鈕的時候執行的
type-pools: tpit.
“BREAK ABAP_02.
data: tbseg type bseg,
it_errtab type tpit_t_errdoc with header line,
rt_buztab type tpit_t_buztab with header line,
fldtab type tpit_t_fname with header line.
data: wa_bkpf type bkpf.
data: l_bseg type table of bseg with header line.
data: name type thead-tdname.
data: l_belnr type bkpf-belnr.
data: lines type table of tline with header line.
data: it_texts type table of tline with header line.
data: it_bseg type table of bseg with header line.
data: wa_stxh type stxh.
data: wa_stxl type stxl.
data wa_thead type thead.
data: str type string.
break abap_02.
if sy-tcode eq ‘VL01N’ or sy-tcode eq ‘VL02N’.
select max( belnr ) into l_belnr from bkpf where xblnr eq likp-vbeln .”ORDER BY BLDAT.
select single * into wa_bkpf from bkpf where xblnr eq likp-vbeln and belnr eq l_belnr .”AND BLDAT EQ LIKP-FKDAT.
if wa_bkpf is not initial.
“先寫入擡頭文本
name = wa_bkpf-xblnr.”likp-vbeln.
select single * into wa_stxh from stxh where tdname eq name.
if wa_stxh is not initial.
call function ‘READ_TEXT’
exporting
* CLIENT = SY-MANDT
id = wa_stxh-tdid”‘0001′
language = ‘1′
name = name
object = ‘VBBK’
tables
lines = lines[]
.
read table lines index 1.
wa_bkpf-bktxt = lines-tdline.
modify bkpf from wa_bkpf.
endif.
endif.
“寫入行項目文本
select * into corresponding fields of table l_bseg from bseg where bukrs eq wa_bkpf-bukrs and belnr eq wa_bkpf-belnr.
concatenate wa_bkpf-xblnr ‘000010′ into wa_thead-tdname.
select single * into wa_stxl from stxl where tdname eq wa_thead-tdname.
if wa_stxl is not initial.
call function ‘READ_TEXT’
exporting
id = wa_stxl-tdid”‘0001′”wa_thead-tdid
language = ‘1′
name = wa_thead-tdname
object = ‘VBBP’
tables
lines = it_texts[].
read table it_texts index 1.
clear str.
loop at it_texts.
concatenate str it_texts-tdline into str.
endloop.
if strlen( str ) > 50.
str = str+0(50).
endif.
loop at l_bseg.
clear: rt_buztab[],fldtab[].
l_bseg-sgtxt = str.”it_texts-TDLINE.
move-corresponding l_bseg to rt_buztab.
rt_buztab-bstat = ”.
rt_buztab-mwskz = ”.
rt_buztab-flaen = ‘X’.
append rt_buztab.
fldtab-fname = ‘SGTXT’.
fldtab-aenkz = ‘X’.
append fldtab.
call function ‘FI_ITEMS_MASS_CHANGE’
exporting
s_bseg = l_bseg
importing
errtab = it_errtab[]
tables
it_buztab = rt_buztab
it_fldtab = fldtab
exceptions
bdc_errors = 1
others = 2.
if sy-subrc = 0.
wait up to 2 seconds.
endif.
endloop.
endif.
endif.