Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select statement!!

Former Member
0 Likes
367

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
346

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

2 REPLIES 2
Read only

Former Member
0 Likes
346

You may want to check the Help Files under Data Declarations (Work Areas orBuffers). You can see your answer there.

Read only

Former Member
0 Likes
347

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