Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

REPORT ZDEMO_PRG27 line-size 200.

data lv_kunnr type kna1-kunnr.


select-OPTIONS so_kunnr for lv_kunnr.

types : begin of ty_sales,


kunnr type kna1-kunnr,
land1 type kna1-land1,
name1 type kna1-name1,
vbeln type vbak-vbeln,
erdat type vbak-erdat,
v_kunnr type vbak-kunnr,
v_vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
end of ty_sales.

data : lt_sales type table of ty_sales,


ls_sales type ty_sales.

INITIALIZATION.
so_kunnr-low = '1000'.
so_kunnr-high = '1005'.
append so_kunnr.

start-of-SELECTION.
perform getdata.
if lt_sales[] is not INITIAL.
perform display.
else.
message 'No data' type 'I'.
endif.

FORM GETDATA .
select kna1~kunnr land1 name1
vbak~vbeln vbak~erdat vbak~kunnr
vbap~vbeln posnr matnr
from kna1 inner join vbak
on kna1~kunnr = vbak~kunnr
inner join vbap
on vbak~vbeln = vbap~vbeln
into table lt_sales
where kna1~kunnr in so_kunnr.
ENDFORM. " GETDATA

FORM DISPLAY .
sort lt_sales by kunnr.
loop at lt_sales into ls_sales.
at new kunnr.
write :/ 'Customer No :',ls_sales-kunnr color 3.
endat.
at new land1.
write :/3 'Customer country :',ls_sales-land1 color 4.
endat.
at new name1.
write :/5 'Customer name :',ls_sales-name1 color 6.
endat.
format color 7.
write :/8 ls_sales-vbeln,
ls_sales-erdat,
ls_sales-v_kunnr,
ls_sales-v_vbeln,
ls_sales-posnr,
ls_sales-matnr.
format color off.
endloop.
ENDFORM. " DISPLAY

You might also like