tables: vbak, vbap.
select-options: s_vbeln for vbak-vbeln.
types:
begin of t_vbak,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam type vbak-ernam,
netwr type vbak-netwr,
end of t_vbak,
begin of t_vbap,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
arktx type vbap-arktx,
matnr like vbap-matnr,
meins like vbap-meins,
end of t_vbap,
begin of lt_report,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam type vbak-ernam,
netwr type vbak-netwr,
posnr like vbap-posnr,
arktx type vbap-arktx,
matnr like vbap-matnr,
meins like vbap-meins,
end of lt_report.
data:
li_vbak type t_vbak occurs 0 with header line,
li_vbap type t_vbap occurs 0 with header line,
t_report type lt_report occurs 0 with header line.
at selection-screen.
start-of-selection.
select vbeln erdat ernam netwr
from vbak
into table li_vbak where vbeln in s_vbeln.
if not li_vbak[] is initial.
sort li_vbak by vbeln.
DELETE ADJACENT DUPLICATES FROM li_vbak.
select vbeln posnr arktx matnr meins
from vbap
into table li_vbap
for all entries in li_vbak
where vbeln = li_vbak-vbeln.
endif.
+*select a~vbeln a~erdat a~ernam a~netwr+
+* b~posnr b~arktx b~matnr b~meins+
+* into table t_report+
+* from vbak as a inner join vbap as b+
+* on a~vbeln = b~vbeln+
+* where a~vbeln in s_vbeln.+
loop at li_vbap.
t_report-vbeln = li_vbap-vbeln.
t_report-posnr = li_vbap-posnr.
t_report-arktx = li_vbap-arktx.
t_report-matnr = li_vbap-matnr.
t_report-meins = li_vbap-meins.
read table li_vbak with key vbeln = li_vbap-vbeln.
if sy-subrc = 0.
t_report-vbeln = li_vbak-vbeln.
t_report-erdat = li_vbak-erdat.
t_report-ernam = li_vbak-ernam.
t_report-netwr = li_vbak-netwr.
endif.
append t_report.
clear li_vbap.
endloop.
refresh: li_vbak, li_vbap.
sort t_report by vbeln.
DELETE ADJACENT DUPLICATES FROM t_report.
end-of-selection.
sort t_report by vbeln.
loop at t_report.
write: / t_report-vbeln, t_report-erdat, t_report-ernam,
t_report-netwr, t_report-posnr, t_report-arktx,
t_report-matnr, t_report-meins.
endloop.
RELATED POST
INTERACTIVE ABAP REPORT WITH SD MODULE
EDI Tasks and roles
Work item and SAP IN box
Error notification process part one and two
Work item in EDI Work flow
EDI Work flow part one, two, three and four
No comments:
Post a Comment