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
944

Hi,

I have one problem in following coding.

the condition is like that

select-options: s_kunnr for kna1-kunnr,

s_name1 for kna1-name1.

if not s_kunnr is initial.

perform kunnr_data.

else.

perform name1_data.

endif.

if not s_kunnr is initial.

select * from kna1 into corresponding fields of table lt_kna1 for all entries in s_kunnr where kunnr = s_kunnr-low.

endif,

form kunnr_data.

*under this subroutine there are some condition & we are appending multiple entries in s_kunnr.

endform.

*actually we are getting problem in above select statement.

*suppose we have 50 entries in s_kunnr then what I have to use in where condition so that it will fetch all the records based s_kunnr(rembember s_kunnr having 50 entries).

10 REPLIES 10
Read only

Former Member
0 Likes
915

select * from kna1 into corresponding fields of table lt_kna1 for all entries in s_kunnr where <b>kunnr in s_kunnr</b>.

Read only

former_member632991
Active Contributor
0 Likes
915

Hi,

use

select * from kna1 into corresponding fields of table lt_kna1 for where kunnr in s_kunnr.

Regards,

Sonika

Read only

Former Member
0 Likes
915

just use kunnr in s_kunnr.

regards

shiba dutta

Read only

Former Member
0 Likes
915

Hi Neha,

Declare an <b>internal table of type kna1-kunnr</b>.

use this internal table to <b>fill multiple enties</b> instead of s_kunnr.

Now use select * from dbtab <b>for all entries</b> in itab_kunnr where............

Hope this helps,

Pragya

Read only

0 Likes
915

Hi Kishan,

If I used the mentioned select statment I am getting error "the where condition does not refer to the FOR ALL ENTRIES table."

Could you please suggest me?

Read only

0 Likes
915

select * from kna1 into corresponding fields of table lt_kna1 where kunnr in s_kunnr.



s_kunnr-- is  not a internal table.

just write down ur requirment i m trying to solve it.

kishan negi

Read only

former_member632991
Active Contributor
0 Likes
915

Hi,

u don't need to write for all entries, it will work without it

select * from kna1 into corresponding fields of table lt_kna1 for where kunnr in s_kunnr.

Regards,

Sonika

Read only

Former Member
0 Likes
915

check this way...

loop at s_kunnr.

select * from kna1 into corresponding fields of table lt_kna1 for all entries in s_kunnr where kunnr = s_kunnr-low.

endloop.

or else...

select * from kna1 into corresponding fields of table lt_kna1 for all entries in s_kunnr where kunnr IN s_kunnr.

Read only

Former Member
0 Likes
915

Dear Neha,

Please correct the following SQL Statement:

if not s_kunnr is initial.

select * from kna1 into corresponding fields of table lt_kna1 for all entries in s_kunnr where kunnr <b>IN</b> s_kunnr-low.

endif.

Regards,

Abir

***********************************

  • Don't forget to award Points *

Read only

Former Member
0 Likes
915

hi neha,

select * from kna1 into corresponding fields of table lt_kna1 for all entries in s_kunnr where kunnr in s_kunnr.

with regards,

suresh babu