08-09-2012 1:18 PM
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
08-09-2012 1:39 PM
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
08-10-2012 11:19 AM
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
08-10-2012 12:33 PM
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
08-10-2012 12:46 PM
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