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 stmt

Former Member
0 Likes
856

hi all

can anyone correct me this select stmt

is the where condition is written correctly

shud i also include and condition in where stmt to validate lfa1 table

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

WHERE ebeln = ekko~ebeln.

7 REPLIES 7
Read only

anversha_s
Active Contributor
0 Likes
826

hi,

corrected

, no need of brackets

SELECT ekko~ebeln ekko~lifnr lfa1~name1
INTO CORRESPONDING FIELDS OF TABLE t_lifnr
FROM ekko 
INNER JOIN lfa1 
ON ekko~lifnr = lfa1~lifnr 

WHERE ebeln = parameter_ebeln.

rgds

Anver

Read only

Former Member
0 Likes
826

WHERE ekko~ebeln = pa_ebeln.

Read only

Former Member
0 Likes
826

Hi

The where condition should specify a value from selection screen or with reference to an internal table:

Eg:

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

WHERE ebeln = <b>p_ebeln. "ekko~ebeln</b>. - <b>Parameter</b>

or

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

WHERE ebeln IN <b>s_ebeln. "= ekko~ebeln</b>. - <b>Select-Option</b>

or

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

<b> FOR ALL ENTRIES IN t_output</b>

WHERE ebeln = <b>t_output-ebeln. "ekko~ebeln.</b> - <b>With reference to another internal table</b>

Kind Regards

Eswar

Read only

Former Member
0 Likes
826

There is no need to validate as you already linked lfa1 and ekko. in the where condition you need to specify the and selection screen input.

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

WHERE ebeln = ekko~ebeln.

Rgds,

Hemanth.

Read only

Former Member
0 Likes
826

Hi,

Check selects given below..

if ebeln is a parameter...

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

<b>WHERE ebeln = p_ebeln.</b>

if ebeln is a select option

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

<b>WHERE ebeln IN S_ebeln.</b>

if you are using for all entries...in the seelct you provided its commented...if u use that statement,.

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

<b> FOR ALL ENTRIES IN t_output

<b>WHERE ebeln = t_output-ebeln.</b></b>

reward if helpful..

Rgds,

Ajith

Read only

Former Member
0 Likes
826

hi

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

  • FOR ALL ENTRIES IN t_output

WHERE ekko~ebeln = p_ebeln.

in where condition ekko~ebeln = p_ebeln.

Read only

Former Member
0 Likes
826

hi lakshmi,

it is correct only.

please check this

DATA : BEGIN OF t_lifnr OCCURS 0,

ebeln LIKE ekko-ebeln,

lifnr LIKE ekko-lifnr,

name1 LIKE lfa1-name1,

END OF t_lifnr.

SELECT ekkoebeln ekkolifnr lfa1~name1

INTO CORRESPONDING FIELDS OF TABLE t_lifnr

FROM ( ekko

INNER JOIN lfa1

ON ekkolifnr = lfa1lifnr )

  • INTO TABLE t_lifnr

*FOR ALL entries IN t_output

WHERE ebeln = ekko~ebeln.

regards,