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 single

Former Member
0 Likes
1,657

Can I use the following select single.

Select single kunnr from kna1 where kunnr = kunrg.

Is this statement okay

12 REPLIES 12
Read only

Sm1tje
Active Contributor
0 Likes
1,324

Select single kunnr into lv_kunnr from kna1 where kunnr = kunrg.

BTW: What is kunrg? Is that a range?

Edited by: Micky Oestreich on May 13, 2008 9:39 AM

Read only

GauthamV
Active Contributor
0 Likes
1,324

hi,

try this.

select single kunnr from kna1 into table it_kna1.

if u want specific kunnr thn select data by giving condition.

this will give u one kunnr record from kna1.

reward if hlpful.

Read only

Former Member
0 Likes
1,324

HI

USE THIS

SELECT SINGLE KUNNR INTO KNA1-KUNNER FROM KNA1

WHERE

KUNNR = KUNRG.

AND SINCE U R USING SELECT SINGLE SO U HAVE TO AL PRIMARY KEY AND IN KNA1 KUNNER IS THE PRIMARY KEY SO U CAN USE IT

CHEERS

Snehi Chouhan

Edited by: snehi chouhan on May 13, 2008 9:43 AM

Read only

Former Member
0 Likes
1,324

Hi MN,

try this code,

DATA wa_kna1 TYPE kna1.

PARAMETERS: p_kunn TYPE kna1-kunnr.

SELECT SINGLE * FROM kna1 INTO wa_kna1 WHERE kunnr = p_kunn.

Regards

Adil

Read only

Former Member
0 Likes
1,324

Your select seems to be ok

But use select single with specfiying full primary keys else it gives a performance

problem

Also u can use

select upto 1 rows

Read only

Former Member
0 Likes
1,324

hi this is not ok..bcoz there is no field kunrg in the table kna1 and the statement is not accessible with out into stetement....

parameters:kunnr like kna1-kunnr.

data:v_kunnr type kunnr.

Select single kunnr from kna1 into v_kunnr where kunnr = kunnr .

regards,

venkat

Read only

Former Member
0 Likes
1,324

kunrg is an input field of an RFC with structure str.

str-kunrg has data element kunrg and domain domain kunnr.

Then is the following statement valid.

Select single kunnr from kna1 where kunnr = kunag

Read only

0 Likes
1,324

hi i hope it doesnt work with out the into clause..

regards,

venkat

Read only

0 Likes
1,324

Hi MN!!

Select single kunnr from kna1 where kunnr = kunag

if u write above statement it gives syntax error as field list without into clause is nt allowed.

u will have to mention either

Select single * kunnr from kna1 where kunnr = kunag

or

Select single kunnr from kna1 into wa_kna1 where kunnr = kunag.

kindly reward if helpful.

Read only

Former Member
0 Likes
1,324

Hello,

This statement will not work correctly. You have to provide into clause, since you have mentioned the field list (kunnr).

1. Select single * from kna1 where kunnr = kunrg. - True

2. Select single kunnr from kna1 where kunnr = kunrg. - False

3. Data : wa_kunnr type kunnr.

Select single kunnr from kna1 into wa_kunnr

where kunnr = kunrg. - True

Reward if helpful,

Regards,

Lijo

Read only

Former Member
0 Likes
1,324

Hi

data: lv_kunnr like kna1-kunnr.

Pass value to knurg and define the same.

Select single kunnr into lv_kunnr from kna1 where kunnr = kunrg.

Award points if helpful

Read only

Former Member
0 Likes
1,324

Your statement is incorrect as you have not used a work area to fetch kunnr.So, the correct statement would be :

Select single kunnr into w_kunnr from kna1

where kunnr = kunrg.

If you don't specify a particular column in your select statement, then you do not need to give the work area separately.In that case,

you could have used the following select :

Select single * from kna1

where kunnr = kunrg.

Reward if useful.

Regards,

Nidhi Shroff