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

make it as one select statement!

naveen_inuganti2
Active Contributor
0 Likes
803

Hi..,

See my coding..,

data: customer like kna1-kunnr,
        name like kna1-name1.

parameter: p_filed1 like ztable-filed1

select single kunnr from ztable into customer where filed1 = p_filed1.
 if sy-subrc = 0.
  select single name1 from kna1 into name where kunnr = custmer.
 endif.

So I can pass this name into other parameter(function modules) with out READ and LOOP statements as you know..

Now my question is how can modify above coding with one select statement.

I want name entry in variable only...

Thanks,

Naveen.I

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
761

Hi,

Try to change the piece of code as follows:

select single kna1~name1

into name

from kna1 inner join ztable

on kna1kunnr = ztablekunnr

where ztable~filed1 = p_filed1.

Thanks & Regards,

Navneeth K.

4 REPLIES 4
Read only

Former Member
0 Likes
761

hi..

U can use joins by linking kunnr in name1 field.

Read only

0 Likes
761

Hi..,

Yes, I can join.

But how i can pass name1 into single variable, please get back with sample code..,

Thanks,

Naveen.i

Read only

Former Member
0 Likes
761

Hi,

You did not mention all the fields of the ztable.

So if you have common key fields in both ztable and kna1 then you can Join both the table in single select statement.

Read only

Former Member
0 Likes
762

Hi,

Try to change the piece of code as follows:

select single kna1~name1

into name

from kna1 inner join ztable

on kna1kunnr = ztablekunnr

where ztable~filed1 = p_filed1.

Thanks & Regards,

Navneeth K.