04-09-2009 7:19 AM
Hi Experts,
Can anybody will suggest me how to convert the selection screen values in range table?
I wanted to convert the select option value in range table. Then I have one internal table & in that loop I would like to compare a particular value with this range table.
i.e.
Select option S_DISPO having value 'D01' to 'D05'.
In my internal table ITAB, having field MRP controller field having entries D01, D05, D09, D11.
Now I would like to loop over itab & just wanted to consider only those records which is having values as in select option.
Any suggestion will be highly appriciated.
Thanks,
Neha
04-09-2009 7:29 AM
04-09-2009 7:21 AM
Hi,
use this code
loop at itab into wa where mrp_field in s_dispo.
" processing steps
endloop.
Regards,
Siddarth
04-09-2009 7:21 AM
loop at itab into watab where mrpfield in s_dispo.
Process the steps here
endloop.
Edited by: Jayati Saha on Apr 9, 2009 8:24 AM
04-09-2009 7:29 AM
04-09-2009 7:31 AM
hi
you can convert select option into range by 2 methods:
DATA : l_wa_mwskz LIKE LINE OF r_mwskz.
1 method :
APPEND LINES OF : s_txcd6 TO r_mwskz.
here s_txcd6 is select option
2 method :
l_wa_mwskz-sign = c_i.
l_wa_mwskz-option = c_eq.
l_wa_mwskz-low = c_v0.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v1.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v2.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v3.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v5.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v6.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v7.
APPEND l_wa_mwskz TO r_mwskz.
l_wa_mwskz-low = c_v8.
APPEND l_wa_mwskz TO r_mwskz.
now here r_mwskz[] is the table which has multiple values
it will help u definately
rahul
Edited by: RAHUL SHARMA on Apr 9, 2009 2:31 AM
Edited by: RAHUL SHARMA on Apr 9, 2009 2:32 AM
04-09-2009 7:39 AM
You can hard code the select option table field sign to bt for all values by looping.
loop at so_var.
so_var-sign = 'BT'.
modify so_var transporting sign.
Endloop.
regards,
lalit mohan gupta.
04-09-2009 7:44 AM
You have 2 choices :
1. Either filter the records while selecting from the data base itself :
select * from table into itab where field in s_dispo.
2. Or Select all data and loop at it and filter or select all data and use delete with where clause.
loop at itab into wa where dispo in s_dispo.
endloop.
delete table itab where dispo in so_dispo. " remember to make the option field of the select option to 'E'
However, please note that as far as possible go with the first option, it is better from the performance point of view.
regards,
Advait
04-09-2009 7:53 AM
Hi Neha,
Check the code snippet..
DATA: l_it_tab TYPE TABLE OF ty_tab,
l_wa_tab TYPE ty_tab.
DATA: l_wa_dispo LIKE s_dispo,
l_wa_dispo LIKE s_dispo.
l_wa_dispo-sign = 'I'.
l_wa_dispo-option = 'BT'.
SELECT key1
field1
FROM <table name>
INTO TABLE l_it_tab
WHERE key1 IN s_dispo.
IF NOT l_it_tab[] IS INITIAL.
LOOP AT l_it_tab INTO l_wa_tab.
l_wa_dispo-low = l_wa_tab-field1.
APPEND l_wa_dispo TO s_dispo.
CLEAR l_wa_dispo-low.
ENDLOOP.
ENDIF.
Now you can use S_DISPO as a range table.
Regards,
Sayak
04-09-2009 8:05 AM
04-09-2009 8:15 AM
Hello Neha,
You can always read the select options using READ TABLE statement.
Ex: READ TABLE S_DISPO WITH KEY LOW = ITAB-DISPO.
I think, this will solve your problem.
____________________________________
And if you want to COPY SELECT OPTIONS S_DISPO INTO RANGES R_DISPO, do this:
RANGES: R_DISPO FOR MARC-DISPO.
R_DISPO[] = S_DISPO[] .
Best Regards,
Sasidhar Reddy Matli.