Report program1.
TYPES : begin of ty_sales,
VBELN type vbak-vbeln,
KUNNR type vbak-kunnr,
BSTNK type vbak-bstnk,
ERDAT type vbak-erdat,
WERKS type vbap-werks,
MATNR type VBAP-matnr,
fixmg type vbap-fixmg,
BANFN type ekpo-banfn,
MAKTX type makt-maktx,
END OF ty_sales.
data : itab type table of ty_sales,
wa type ty_sales.
PARAMETERS : p_VBELN type vbak-vbeln,
KUNNR type vbak-kunnr,
BSTNK type vbak-bstnk,
ERDAT type vbak-erdat,
WERKS type vbap-werks,
p_MATNR type mara-matnr.
Select vbak~VBELN vbak~KUNNR vbak~BSTNK vbak~ERDAT vbap~WERKS VBAP~MATNR vbap~fixmg
from vbak inner join vbap
on vbak~vbeln = vbap~vbeln
into table itab
where vbap~vbeln = p_vbeln.
if sy-subrc eq 0.
loop at itab into wa.
AT new vbeln.
write : 'sales ordre number :' COLOR 1,wa-vbeln.
ENDAT.
at new bstnk.
write: / 'customer purchase order number :' COLOR 2,wa-bstnk.
endat.
skip 1.
write : / 'material number :' color 3,wa-matnr.
write : / 'purchase order item delivery date :' color 4,wa-fixmg.
write: / 'material description :' COLOR 5,wa-maktx.
write: / 'purchase order requestion :' COLOR 6,wa-banfn.
uline.
ENDLOOP.
endif.