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

dynamic query

Former Member
0 Likes
577

i am getting 8 records thru my select query ,now i want to save six records in six different variables via using case statement...

and later i will use all this variables in fetching data from database.

just go thru my codes:

select ATINN ATNAM from CABN into corresponding fields of I_CABN .

so when i_cabn-atnam = 'Z_BP_SOURCE'.

SOURCE = I_CABN-ATINN.

this i want to do 4 another 6 variables

just help

thanks in advance.

4 REPLIES 4
Read only

Former Member
0 Likes
535

See this dynamic query

parameter : p_matnr type mara-matnr.

select single * from mara into wa_mara where (p_matnr).

Reward if useful

Read only

Former Member
0 Likes
535

Hi

declare the 8 varaibles and

after select statement write the case statement and move the fields to these variables

select ATINN ATNAM from CABN into corresponding fields of I_CABN .

case i_cabn-atinn.

when 'Z_BP_SOURCE'.

v_var1 = i_cabn-atnam (or some other field).

when 'ZB_ATYUN'.

v_var2 = i_cabn-atnam .

.....................................

.....................................

endcase.

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

0 Likes
535

thanks problem has solved

Read only

Former Member
0 Likes
535

sample:

data: condition1 type string.

concatenate 'ATINN =' I_CABN-ATINN into condition1.

select * from CABN

where (condition1).