data: t_status (200) type c,
OR_NO LIKE JEST-OBJNR.
*-- 定义内表itab
data: begin of itab occurs 0,
AUFNR LIKE AFKO-AUFNR,
GSTRP LIKE AFKO-GSTRP,
GAMNG LIKE AFKO-GAMNG,
RSNUM like AFKO-RSNUM,
STLBEZ LIKE AFKO-STLBEZ,
skude like makt-maktx,
POSNR LIKE resb-POSNR,
XFEHL LIKE RESB-XFEHL,
LGORT like resb-lgort,
MATNR LIKE RESB-MATNR,
end of itab.
*------------
clear itab.
refresh itab.
select AFKO~AUFNR AFKO~GSTRP AFKO~GAMNG
AFKO~STLBEZ AFKO~RSNUM resb~werks resb~matnr
resb~bdmng resb~vmeng resb~lgort RESB~ENMNG
AFPO~GSBTR
AFPO~KDAUF AFPO~KDPOS
into (itab-AUFNR,itab-GSTRP,itab-GAMNG,
itab-STLBEZ,itab-RSNUM,itab-werks,
itab-matnr,itab-bdmng,itab-vmeng,itab-lgort,
ITAB-ENMNG,
ITAB-EINDT,
ITAB-KDAUF,ITAB-KDPOS)
from afko
inner join resb on AFKO~RSNUM = RESB~RSNUM
INNER JOIN AFPO ON AFKO~AUFNR = AFPO~AUFNR
where AFKO~AUFNR in t_order
and AFKO~GSTRP in t_date
and resb~XFEHL = 'X'
and resb~BDART = 'AR'
and resb~werks in T_WERKS
AND AFPO~KDAUF IN T_KDAUF
and resb~bdmng gt 0.
OR_NO = 'OR'.
OR_NO+2 = itab-AUFNR.
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
OBJNR = OR_NO
ONLY_ACTIVE = 'X'
SPRAS = 'E'
BYPASS_BUFFER = '1'
IMPORTING
LINE = t_status.
IF t_STATUS NS 'CNF' OR t_status NS 'MACM' OR t_STATUS NS 'DLV'.
append itab.
ENDIF.
endselect.
OR_NO LIKE JEST-OBJNR.
*-- 定义内表itab
data: begin of itab occurs 0,
AUFNR LIKE AFKO-AUFNR,
GSTRP LIKE AFKO-GSTRP,
GAMNG LIKE AFKO-GAMNG,
RSNUM like AFKO-RSNUM,
STLBEZ LIKE AFKO-STLBEZ,
skude like makt-maktx,
POSNR LIKE resb-POSNR,
XFEHL LIKE RESB-XFEHL,
LGORT like resb-lgort,
MATNR LIKE RESB-MATNR,
end of itab.
*------------
clear itab.
refresh itab.
select AFKO~AUFNR AFKO~GSTRP AFKO~GAMNG
AFKO~STLBEZ AFKO~RSNUM resb~werks resb~matnr
resb~bdmng resb~vmeng resb~lgort RESB~ENMNG
AFPO~GSBTR
AFPO~KDAUF AFPO~KDPOS
into (itab-AUFNR,itab-GSTRP,itab-GAMNG,
itab-STLBEZ,itab-RSNUM,itab-werks,
itab-matnr,itab-bdmng,itab-vmeng,itab-lgort,
ITAB-ENMNG,
ITAB-EINDT,
ITAB-KDAUF,ITAB-KDPOS)
from afko
inner join resb on AFKO~RSNUM = RESB~RSNUM
INNER JOIN AFPO ON AFKO~AUFNR = AFPO~AUFNR
where AFKO~AUFNR in t_order
and AFKO~GSTRP in t_date
and resb~XFEHL = 'X'
and resb~BDART = 'AR'
and resb~werks in T_WERKS
AND AFPO~KDAUF IN T_KDAUF
and resb~bdmng gt 0.
OR_NO = 'OR'.
OR_NO+2 = itab-AUFNR.
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
OBJNR = OR_NO
ONLY_ACTIVE = 'X'
SPRAS = 'E'
BYPASS_BUFFER = '1'
IMPORTING
LINE = t_status.
IF t_STATUS NS 'CNF' OR t_status NS 'MACM' OR t_STATUS NS 'DLV'.
append itab.
ENDIF.
endselect.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-551897/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15117617/viewspace-551897/