FORM. FRM_KONDI_WERT_981.
*{ INSERT SDQK9A1SZA 1
******* 20100326 by five
data: v_vbeln like vbak-vbeln,
v_aufnr like vbep-aufnr,
v_posnr like vbap-posnr,
custpo like vbak-bstnk,
amount like konp-kbetr,
amount1 like konp-kbetr,
amount2 like konp-kbetr,
amount3 like konp-kbetr,
ZROOT(100) TYPE C.
data : begin of pwotable occurs 0 .
include structure zwoamout.
data : end of pwotable.
data : begin of PWOCONPNENT occurs 0 .
include structure ZWOCONPNENT.
data : end of pWOCONPNENT.
if komk-vkorg = 'PELH' and komk-vtweg = 'C0'.
**** get SO number
select single vgbel vgpos into (v_vbeln, v_posnr)
from lips
where vbeln = komp-vgbel
and posnr = komp-vgpos.
*******get customer po
select single vbak~bstnk
into (custpo)
from vbak
where vbak~vbeln = v_vbeln.
*****get work no
select single aufnr into v_aufnr
from vbep
where vbeln = v_vbeln
and posnr = v_posnr.
****get total price by wo to update billing price.
if not custpo is initial.
call function 'ZRFC_SD_PCE_0085'
exporting
zcustpo = custpo
importing
zamount = amount1
tables
WOCOMPNENT = pWOCONPNENT
woamout = pwotable.
if not pwotable[] is initial and v_aufnr <> ''.
read table pwotable with key aufnr = v_aufnr.
amount = pwotable-netpr.
clear:pwotable.
endif.
************** UPDATE PRICE BY WO
if amount <> ''.
read table xkomv with key kschl = 'PR00'.
if xkomV-WAERS <> 'USD'.
amount2 = ( amount * xkomv-kkurs / 100000 ) / ( KOMP-MGAME / 1000 ).
ELSE.
amount2 = amount / ( KOMP-MGAME / 1000 ).
ENDIF.
if xkomv-kbetr <> amount2.
xkomv-kbetr = amount2.
endif.
If xkomV-WAERS <> 'USD'.
amount3 = ( amount * xkomv-kkurs * xkomv-KPEIN ) / 100000.
ELSE.
amount3 = amount * xkomv-KPEIN.
ENDIF.
if xkwert <> amount3 .
xkwert = amount3.
endif.
endif.
endif.
LOOP AT pWOCONPNENT WHERE AUFNR = v_aufnr.
IF pWOCONPNENT-KBETR = 0 .
concatenate pWOCONPNENT-MATNR ' price is zero in wo:' v_aufnr into ZROOT.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TITEL = 'Warning !!'
textline1 = ZROOT
START_COLUMN = 10
START_ROW = 6 .
xkomv-kbetr = ''.
xkwert = ''.
EXIT.
ENDIF.
ENDLOOP.
endif.
*} INSERT
ENDFORM.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14397246/viewspace-665760/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14397246/viewspace-665760/