SD模块的几个增强
VA01-VA03,VA41,VA42,VA43这三个事务代码的增强直接写在他们的程序里面,这里的增强有点特殊要注意首先要让他显示出来,而后才能修改,
程序名:SAPMV45A增强的点在:includemv45afzb.和includemv45afzz. 双击进去后点击编辑菜单里面的增强,如下图:
然后对准里面的增强点写相应的代码。
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.