‎2008 Jan 14 5:35 PM
Hi,
can anyone please tell me how this select statement works?
SELECT LIPSLFIMG LIPSMATNR LIPSVBELN LIPSVRKME LIKP~KUNNR
LIKPLFART LIKPVBELN LIKPVSBED LIKPVSTEL LIKP~WADAT_IST
KNA1~NAME4
INTO (LIPS-LFIMG , LIPS-MATNR , LIPS-VBELN , LIPS-VRKME , LIKP-KUNNR
, LIKP-LFART , LIKP-VBELN , LIKP-VSBED , LIKP-VSTEL
, LIKP-WADAT_IST, KNA1-NAME4 )
FROM ( LIPS
INNER JOIN LIKP
ON LIKPVBELN = LIPSVBELN
INNER JOIN KNA1
ON KNA1KUNNR = LIKPKUNNR )
What I dont understand is we are selecting some fields and then putting them back in the same fields of the same table? why would we do that?
Thanks in advance.
goldie
‎2008 Jan 14 5:55 PM
Hi Goldie,
The fields mentioned after the SELECT and before INTO are the fields that this SELECT statement will select from the database tables mentioned before the tilde e.g. LIKP~VESTL.
The fields mentioned after INTO and before FROM are the fields of the structures whose name is mentioned before hyphen e.g. LIKP -VESTL.
For this statement to work, you need TABLES statment for all the structure names mentioned in the INTO addition. You also need an ENDSELECT statement which is not mentioned in your post.
Structures are program data objects where the SELECT statement will put the values after selecting them from the database tables in each loop pass of the SELECT...ENDSELECT loop and there is nothing like putting them back in the database tables as you mentioned.
The confusion is created by the same name for a database table and its corresponding structure created by TABLES statement.
Just FYI, TABLES statement is obsolete in ABAP Objects context, so try not to use it.
Hope this helps.
Thanks
Sanjeev
‎2008 Jan 14 5:43 PM
You may want to check the Help Files under Data Declarations (Work Areas orBuffers). You can see your answer there.
‎2008 Jan 14 5:55 PM
Hi Goldie,
The fields mentioned after the SELECT and before INTO are the fields that this SELECT statement will select from the database tables mentioned before the tilde e.g. LIKP~VESTL.
The fields mentioned after INTO and before FROM are the fields of the structures whose name is mentioned before hyphen e.g. LIKP -VESTL.
For this statement to work, you need TABLES statment for all the structure names mentioned in the INTO addition. You also need an ENDSELECT statement which is not mentioned in your post.
Structures are program data objects where the SELECT statement will put the values after selecting them from the database tables in each loop pass of the SELECT...ENDSELECT loop and there is nothing like putting them back in the database tables as you mentioned.
The confusion is created by the same name for a database table and its corresponding structure created by TABLES statement.
Just FYI, TABLES statement is obsolete in ABAP Objects context, so try not to use it.
Hope this helps.
Thanks
Sanjeev