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: 

Appending the select option fields into one field

Former Member
0 Kudos

Hi Everyone,

i am one issue, we have two selection fields with same data type. and with those two fields we need to append into one field and select the data from the database using select query....

eg: select-option s_matnr for matnr.

      select-option s_matnr1 for matnr.

now we need to combine the s_matnr and s_matnr1 into either s_matnr or s_matnr1.

select matnr

         into table gt_mara from mara where matnr in s_matnr.

thanks in advance

4 REPLIES 4

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Create a range and merge both ranges (s_matnr and s_matnr1) in r_matnr. For instance,

RANGES: r_matnr FOR mara-matnr.

LOOP AT s_matnr.

  MOVE-CORRESPONDING s_matnr TO r_matnr.

  APPEND r_matnr.

ENDLOOP.

LOOP AT s_matnr1.

  MOVE-CORRESPONDING s_matnr1 TO r_matnr.

  APPEND r_matnr.

ENDLOOP.

Do the select with R_MATNR instead S_MATNR.

It's an idea. I hope this helps you

Regards

Eduardo

former_member209818
Active Contributor
0 Kudos

Hi Meer,

if you need to select data from database for both the Select Options, then instead of clubbing the contends of Select Option into one, you can directly use both of them using a OR condition on the same fields...

- Harshad

Former Member
0 Kudos

u can use select query this way

select * from mara

where ( matnr in s_matnr or matnr in s_matnr1 ).

this will work only if you want to select the data from both the select options

Former Member
0 Kudos

Hi Meer,

tables:mara.

select-options:s_matnr for mara-matnr,

               s_matnr1 for mara-matnr.

start-of-selection.

append lines of s_matnr[] to s_matnr1[].

refresh s_matnr[].

the above code will fix your problem.

Thanks,
Anjan