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

Sample code to create a Select ... Into a variable from a custom table?

Former Member
0 Likes
1,999

We've got a custom table called z1 which contain fields of EBELN, EBELP, and f1. Now we know the field f1 value and we would like to use this f1 value to get EBELN and EBELP values and put these values in two corresponding variables.

We would like to use the following code:


Data: vEBELN string,
  vEBELP string.

Select EBELN EBELP from z1 where f1 = 'xx' INTO vEBELN vEBELP.

We know that the above code doesn't work. Would be appreciated if some ABAP experts here to correct/complete the above code and we will give you reward points!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
871

Data: V_EBELN type EKPO-EBELN,,

V_EBELP type EKPO-EBELP.

Select single EBELN EBELP

from z1

into (V_EBELN , V_EBELP )

where f1 = 'xx'.

Thanks,

Srinivas

6 REPLIES 6
Read only

b_deterd2
Active Contributor
0 Likes
871

Your datadeclaration is not correct.

data: lv_ebeln type ebeln.

data: lv_ebelp type ebelp.

Read only

Former Member
0 Likes
871

hi,

Check out in this way ..


Data: VEBELN LIKE z1-EBELN,
         VEBELP LIKE z1-EBELP.

Select EBELN EBELP from z1 INTO (vEBELN, vEBELP) where f1 = 'XX' .
endselect.

Read only

Sm1tje
Active Contributor
0 Likes
871

try this.

Select (EBELN, EBELP) INTO vEBELN vEBELP from z1 where f1 = 'xx' .

Make sure value from f1 is 'xx' and not 'Xx' or 'XX'. Case sensitive.

Read only

former_member194669
Active Contributor
0 Likes
871

Try this way


Select single EBELN EBELP from z1 
        into vebeln vebelp
        where f1 = 'xx'.

Read only

Former Member
0 Likes
872

Data: V_EBELN type EKPO-EBELN,,

V_EBELP type EKPO-EBELP.

Select single EBELN EBELP

from z1

into (V_EBELN , V_EBELP )

where f1 = 'xx'.

Thanks,

Srinivas

Read only

Former Member
0 Likes
871

select single kunnr into wa_final-kunnr2 from vbpa where parvw = 'SP' and vbeln = 'wa_vbak-vbeln'.

temp = wa_final-kunnr2

select single name1 into wa_final-name2 from  kna1 where kunnr = temp .

select single land1 into wa_final-land1 from  kna1 where kunnr =  temp .

can i do like this