Select query new syntax in ABAP(7.4+).
* The separator between the columns is , .
* ABAP data objects used in open SQL statements are called as host variables and they are prefixed with @.
Report
REPORT zab_rp_select_query_new.
TABLES: mara.
TYPES: BEGIN OF ls_mara,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
meins TYPE mara-meins,
END OF ls_mara.
DATA: lt_mara TYPE TABLE OF ls_mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT matnr mtart mbrsh matkl meins
FROM mara
INTO TABLE lt_mara
WHERE matnr IN s_matnr.
cl_demo_output=>display( lt_mara ).
New Syntax Report
REPORT zab_rp_select_query_new.
TABLES: mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT matnr, mtart, mbrsh, matkl, meins
FROM mara
INTO TABLE @data(lt_mara)
WHERE matnr IN @s_matnr.
cl_demo_output=>display( lt_mara ).
Input
Output
******************************Thank You***************************
Comments
Post a Comment