SAP Tutorials Blog

 

 


"SINGLE addition

"Here, all fields of a single row a read. Specifying an

"asterisk * indicates that all fields are to be read.

"Alternatively, you can list all the fields separated by comma.

"Note that if the selection covers more than one row, e. g. in case

"of a non-unique WHERE clause, one of these rows is included in

"the result.

SELECT SINGLE FROM dbtab

  FIELDS *

  WHERE ...

  INTO @struc.        "Existing structure of dbtab's row type


"Reading a selected set of fields of a single row

SELECT SINGLE FROM dbtab

  FIELDS comp1, comp2, comp3

  WHERE ...

  INTO @DATA(struc2).    "Structure declared inline


"Alternative syntax without the FIELDS addition

"Here, the CORRESPONDING FIELDS OF addition is used. Only the content of

"columns that have identically named components in the target data object

"is assigned.

SELECT SINGLE comp1, comp2, comp3       "Selected set of fields

  FROM dbtab

  WHERE ...

  INTO CORRESPONDING FIELDS OF @struc.  "Existing structure


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com