Select into corresponding is used to get data from a database table into a user defined internal table or work area without specifying the list of fields.
Syntax: SELECT * FROMAs per SAP standards select into corresponding statement is not advisable as it affects the performance of an application because it has to compare each field with database.
INTO CORRESPONDING FIELDS OF TABLE .
Example using select into corresponding
The below example explains how to use select into corresponding statement to get data into a database table with out specifying list of fields in select statement.
REPORT ZSAPN_SELECT_CORRESPONDING. TYPES : BEGIN OF TY_MARA, "USER DEFINED TYPE WITH FOUR FIELDS MATNR TYPE MARA-MATNR, MTART TYPE MARA-MTART, MBRSH TYPE MARA-MBRSH, MEINS TYPE MARA-MEINS, END OF TY_MARA. DATA : IT_MARA TYPE TABLE OF TY_MARA . "INTERNAL TABLE FOR USER DEFINED TYPE DATA : WA_MARA TYPE TY_MARA . "WORK AREA FOR USER DEFINED TYPE SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA UP TO 50 ROWS. LOOP AT IT_MARA INTO WA_MARA. WRITE :/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MBRSH, WA_MARA-MEINS. "DISPLAY OUTPUT ENDLOOP.