Paylaş.
*&———————————————————————*
*& Report Zdeneme
*&
*&———————————————————————*
*&
*&
*&———————————————————————*
REPORT zes_selections2_2.
” loopları kullanarak aslında join le yapılmalı
TABLES : vbak, vbap, makt.
DATA : BEGIN OF itab OCCURS 0,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF itab.
DATA : BEGIN OF ls_itab,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF ls_itab.
DATA : BEGIN OF itab2 OCCURS 0,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF itab2.
DATA : BEGIN OF ls_itab2,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF ls_itab2.
SELECT-OPTIONS so_vbeln FOR vbak-vbeln.
data : lt_vbak type table of vbak .
data : ls_vbak type vbak .
data : lt_vbap type table of vbap .
data : ls_vbap type vbap .
data : lt_makt type table of makt .
data : ls_makt type makt .
select * from vbak
into corresponding fields of table itab
where vbeln in so_vbeln .
*”move itab[] to itab2[] .
itab2[] = itab[] .
clear itab[] .
refresh itab .
LOOP AT itab2 into ls_itab2.
select * from vbap
into corresponding fields of table lt_vbap
where vbeln eq ls_itab2-vbeln .
LOOP AT lt_vbap into ls_vbap .
itab-vbeln = ls_vbap-vbeln .
itab-erdat = ls_vbap-erdat .
itab-matnr = ls_vbap-matnr.
append itab .
ENDLOOP.
clear lt_vbak[] .
refresh lt_vbak[] .
ENDLOOP.
clear itab2[] .
refresh itab2 .
itab2[] = itab[] .
clear itab[] .
refresh itab .
LOOP AT itab2 into ls_itab2.
select single * from makt
into ls_makt
where matnr eq ls_itab2-matnr .
itab-vbeln = ls_itab2-vbeln .
itab-erdat = ls_itab2-erdat .
itab-matnr = ls_itab2-matnr.
itab-maktx = ls_makt-maktx.
MODIFY itab index sy-tabix .
append itab .
endloop.
“delete itab where matnr is initial .
LOOP AT itab.
WRITE :/ itab-vbeln ,
itab-erdat,
itab-posnr,
itab-matnr,
itab-netwr,
itab-waerk,
itab-maktx.
ENDLOOP.
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Haz 18 2014
Sap Abap ta yanlış programlama
Paylaş.
*&———————————————————————*
*& Report Zdeneme
*&
*&———————————————————————*
*&
*&
*&———————————————————————*
REPORT zes_selections2_2.
” loopları kullanarak aslında join le yapılmalı
TABLES : vbak, vbap, makt.
DATA : BEGIN OF itab OCCURS 0,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF itab.
DATA : BEGIN OF ls_itab,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF ls_itab.
DATA : BEGIN OF itab2 OCCURS 0,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF itab2.
DATA : BEGIN OF ls_itab2,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
maktx TYPE makt-maktx,
END OF ls_itab2.
SELECT-OPTIONS so_vbeln FOR vbak-vbeln.
data : lt_vbak type table of vbak .
data : ls_vbak type vbak .
data : lt_vbap type table of vbap .
data : ls_vbap type vbap .
data : lt_makt type table of makt .
data : ls_makt type makt .
select * from vbak
into corresponding fields of table itab
where vbeln in so_vbeln .
*”move itab[] to itab2[] .
itab2[] = itab[] .
clear itab[] .
refresh itab .
LOOP AT itab2 into ls_itab2.
select * from vbap
into corresponding fields of table lt_vbap
where vbeln eq ls_itab2-vbeln .
LOOP AT lt_vbap into ls_vbap .
itab-vbeln = ls_vbap-vbeln .
itab-erdat = ls_vbap-erdat .
itab-matnr = ls_vbap-matnr.
append itab .
ENDLOOP.
clear lt_vbak[] .
refresh lt_vbak[] .
ENDLOOP.
clear itab2[] .
refresh itab2 .
itab2[] = itab[] .
clear itab[] .
refresh itab .
LOOP AT itab2 into ls_itab2.
select single * from makt
into ls_makt
where matnr eq ls_itab2-matnr .
itab-vbeln = ls_itab2-vbeln .
itab-erdat = ls_itab2-erdat .
itab-matnr = ls_itab2-matnr.
itab-maktx = ls_makt-maktx.
MODIFY itab index sy-tabix .
append itab .
endloop.
“delete itab where matnr is initial .
LOOP AT itab.
WRITE :/ itab-vbeln ,
itab-erdat,
itab-posnr,
itab-matnr,
itab-netwr,
itab-waerk,
itab-maktx.
ENDLOOP.
By Burhan KARADERE • ABAP, Programlama - Software, SAP • 0 • Tags: Abap, programlama, SAP, yanlış