Application Development 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: 

select from db table of 2 values to 2 variables

Former Member
0 Kudos
8,399

Hi,

is there a way, how to select 2 values from a table row to 2 variables?

like:

select single a b

into ex_a

ex_b

from x

where...

Thank you,

Olian

Edited by: Olian Saludew on Aug 7, 2008 3:00 PM

1 ACCEPTED SOLUTION

Former Member
1,938

Like this example you can select as amny you want.

SELECT SINGLE bukrs werks ename btrtl kostl orgeh stell plans persg INTO
    (ls_ee-bukrs, ls_ee-persa, ls_ee-ee_name, ls_ee-btrtl, ls_ee-curr_kostl, ls_ee-orgeh,
     ls_ee-job, ls_ee-plans, ls_ee-persg) FROM pa0001 WHERE
                                                      pernr EQ ls_ee-ee_no AND
                                                      begda LE sy-datum   AND
                                                      endda GE sy-datum.

7 REPLIES 7

Former Member
1,939

Like this example you can select as amny you want.

SELECT SINGLE bukrs werks ename btrtl kostl orgeh stell plans persg INTO
    (ls_ee-bukrs, ls_ee-persa, ls_ee-ee_name, ls_ee-btrtl, ls_ee-curr_kostl, ls_ee-orgeh,
     ls_ee-job, ls_ee-plans, ls_ee-persg) FROM pa0001 WHERE
                                                      pernr EQ ls_ee-ee_no AND
                                                      begda LE sy-datum   AND
                                                      endda GE sy-datum.

naveen_inuganti2
Active Contributor
0 Kudos
1,938

Hi...

Declare f1, f2.... as two seperate variables..

>select single f1 from <table> into f1 where <condition>

>select single f2 from <table> into f2 where <condition>

Thanks,

Naveen.I

Former Member
0 Kudos
1,938

Hi,

Please try this

select single a b into (ex_a, ex_b) from x .....

Pavan

Former Member
0 Kudos
1,938

i think the syntax is select a b into (d,e ) from dbtab.

~PIyush Patil

Former Member
0 Kudos
1,938

DATA wa TYPE spfli.

SELECT carrid connid cityfrom cityto

FROM spfli

INTO (wa-carrid, wa-connid, wa-cityfrom, wa-cityto).

WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.

ENDSELECT.

former_member188829
Active Contributor
1,938

Hi,

Check this Example.

PARAMETERS:p_matnr LIKE mara-matnr.
DATA:wa_matnr LIKE mara-matnr.
DATA:wa_ntgew LIKE mara-ntgew.

START-OF-SELECTION.
  SELECT SINGLE matnr ntgew FROM mara INTO (wa_matnr,wa_ntgew) WHERE matnr = p_matnr.
    WRITE:wa_matnr,wa_ntgew.

Former Member
0 Kudos
1,938

hi.

yes.

select a b from x

into (ex_a , ex_b)

where...