SELECT Statement in ABAP

SELECT Statement Basic SELECT Statement SELECT * FROM TABLE MARA WHERE MATNR = 'ABC' ENDSELECT. SELECT WERKS MATKL FROM TABLE MARA WHERE MATNR = 'ABC' ENDSELECT.

Using the SINGLE keyword to select only one row SELECT SINGLE MARA-WERKS MATKL FROM TABLE MARA WHERE MARA-MATNR = 'ABC'.   Use - between the table name and field name. No ENDSELECT statement when using the SINGLE keyword.

Using the UP TO ROWS clause to limit the number of rows returned SELECT M~WERKS M~MATKL FROM TABLE MARA AS M UP TO 5 ROWS WHERE M~MATNR = 'ABC'. ENDSELECT.  Use ~ instead of - when using a table alias to specify column names.

Using the UP TO ROWS clause to limit the number of rows returned SELECT WERKS MATKL INTO (lv1, lv2) FROM TABLE MARA UP TO 1 ROWS WHERE MATNR = 'ABC'. ENDSELECT.   Use a space to separate the column names in the SELECT clause. Use , to separate the variable names in the INTO clause. The variable names must be defined in the DATA section.

ORDERFIN) FROM PLAF WHERE MATNR = 'ABC' AND PEDTR <> '00000000'. The variable names must be defined in the DATA section.  Possible aggregate functions: o o o o o   MAX MIN AVG SUM COUNT The column name within the aggregate function's brackets must be separated from the brackets by a space. to separate the variable names in the INTO clause. Eg: SUM( COL ) Use . . ENDSELECT.Using Aggregates in the SELECT clause SELECT SUM( GSMNG ) MAX( PEDTR ) INTO (ORDERQTY.

Sign up to vote on this title
UsefulNot useful