2007 Jun 20 6:42 AM
i have to loop thru select option and assign all the values to a variable.
plz help me out
2007 Jun 21 6:30 AM
its moving only high and low value into It_plant tableNOT all the values selected between them and looping only once
Hi Karan,
You can loop at select options and simultaneously move the values to variables
if it is of the type "I" "EQ". i.e. in the form of a range.
This you can do as follows:
report.
tables vbak.
data: begin of t_vbeln occurs 0,
vbeln type vbak-vbeln,
end of t_vbeln.
select-options : s_vbeln for vbak-vbeln.
loop at s_vbeln.
t_vbeln-vbeln = s_vbeln-low.
append t_vbeln.
endloop.
here s_vbeln-low can also be assigned to a variable.
As far as I think, if however, the select options, is of the type I BT ie a value range like 100 to 200, then you have to code a logic with a counter.
Regs,
Sameer
2007 Jun 20 6:44 AM
2007 Jun 20 6:47 AM
Hi Karan,
Do you need to loop at select option and capture these values in any variable.
dat a: l_var type select option filed.
if not s_input[] is initial.
Loop at s_input .
l_var = s_input-low.
endloop.
endif.
reward if helps.
2007 Jun 20 6:45 AM
hi,
try this,
SELECT-OPTIONS s_plant FOR marc-werks .
INITIALIZATION.
s_plant-low = '1000'.
s_plant-high = '2000'.
s_plant-sign = 'I'.
s_plant-option = 'BT'.
APPEND s_plant.
reward points if helpful,
seshu.
2007 Jun 20 6:46 AM
i hav to suplpy all these values to a variable in a function module thru export
Message was edited by:
Karan Chopra
2007 Jun 20 6:47 AM
First get all the records from database table for select option into a table and then loop through that internal table and assign to the variable you want..
or you can do like this..
LOOP AT so_keyfu.
ls_iobj-iobjnm = so_keyfu-low.
APPEND ls_iobj TO lt_iobj.
ENDLOOP.
2007 Jun 20 6:49 AM
i am still not gettin guys ....sry
i am able to loop only once even if i enter 20 values e.g
1 to 20
Message was edited by:
Karan Chopra
2007 Jun 20 6:51 AM
karan,
DATA : v_temp like marc-werks.
SELECT-OPTIONS s_plant FOR marc-werks .
LOOP At s_plant.
move s_plant-low to v_temp .
ENDLOOP.
Don't forget to reward if useful...
2007 Jun 20 6:55 AM
karan,
karan,
DATA : c like marc-werks.
SELECT-OPTIONS s_plant FOR marc-werks .
LOOP At s_plant.
move s_plant-low to v_temp .
call Function 'Name'
export
xcxcx = v_temp.
ENDLOOP.
Note : xcxcx and v_temp should have same data type.
Don't forget to reward if useful...
2007 Jun 20 6:57 AM
Hi Karan,
You can loop at select options and simultaneously move the values to variables
if it is of the type "I" "EQ". i.e. in the form of a range.
This you can do as follows:
report.
tables vbak.
data: begin of t_vbeln occurs 0,
vbeln type vbak-vbeln,
end of t_vbeln.
select-options : s_vbeln for vbak-vbeln.
loop at s_vbeln.
t_vbeln-vbeln = s_vbeln-low.
append t_vbeln.
endloop.
here s_vbeln-low can also be assigned to a variable.
As far as I think, if however, the select options, is of the type I BT ie a value range like 100 to 200, then you have to code a logic with a counter.
Regs,
Sameer
2007 Jun 20 7:15 AM
no it is not looping thru select option
the loop occurs only once even if i enter it for 20 values
2007 Jun 20 7:31 AM
hi,
try with this code.
just copy paste n run.
tables: vbrk.
select-options: s_plant for vbrk-bukrs.
types: begin of ty_plant,
bukrs type vbrk-bukrs,
end of ty_plant.
data: it_plant type standard table of ty_plant,
wa_plant type ty_plant.
at selection-screen.
loop at s_plant.
move s_plant-low to wa_plant.
append wa_plant to it_plant.
clear wa_plant.
move s_plant-high to wa_plant.
append wa_plant to it_plant.
clear wa_plant.
endloop.
regards,
sudha.
reward points if useful.
2007 Jun 20 7:59 AM
Hi Karan,
Forward to my previous answer..
If you want to loop at a select option in which the values are like 1 to 200..
There is NO DIRECT WAY of doing it.
You will have to loop and select s_vbeln-low in a variable. (see my prev post)
then s_vbeln-high in another.
And then put a logic to increment the values in a DO-ENDDO loop.
say it s_vbeln is 10 to 20.
do 10 times low (10) plus 1 (the difference) and move it to variables.
Regs,
Sameer
2007 Jun 21 6:03 AM
2007 Jun 21 6:23 AM
hi,
try with this code.
just copy paste n run.
tables: vbrk.
select-options: s_plant for vbrk-bukrs.
types: begin of ty_plant,
bukrs type vbrk-bukrs,
end of ty_plant.
data: it_plant type standard table of ty_plant,
wa_plant type ty_plant.
at selection-screen.
loop at s_plant.
move s_plant-low to wa_plant.
append wa_plant to it_plant.
clear wa_plant.
move s_plant-high to wa_plant.
append wa_plant to it_plant.
clear wa_plant.
endloop.
regards,
sudha.
2007 Jun 21 6:47 AM
Hi Karan,
U r right .IT will loop only once if u loop at the select option.
What i guess u can do is select ur values not from the select option but from the table to which this select option corresponds.For ex.
###begin of code.
data:itab like mara occurs 0 with header line.
select-option:s_matnr for mara-matnr.
At selection screen.
select matnr
into corresponding fields of itab
from mara where matnr between s_matnr-low and S_matnr-high.
#end of code.
after this i guess u will get ur values in the matnr field of table itab-matnr.
Reward if useful.
Regards,
Abhi
2007 Jun 21 6:30 AM
its moving only high and low value into It_plant tableNOT all the values selected between them and looping only once
2007 Jun 21 6:38 AM
hi,
do like this,
at selection-screen.
select * from <dbtable> into table <itab> where keyfield in s_option.
loop at <itab> into <wa>.
move <wa> to <wa1>.
append <wa1> to <itab1>.
endloop.
here in <itab1> we can find avbl fields from 1 to 20.
reward points if useful,
regards,
seshu.
2007 Jun 21 6:44 AM
Hi,
then take the select option without intervals and do.
copy paste n run.
SELECT-OPTIONS: s_plant FOR vbrk-bukrs no intervals.
TYPES: BEGIN OF ty_plant,
bukrs TYPE vbrk-bukrs,
END OF ty_plant.
DATA: it_plant TYPE STANDARD TABLE OF ty_plant,
wa_plant TYPE ty_plant.
AT SELECTION-SCREEN.
LOOP AT s_plant.
MOVE s_plant-low TO wa_plant.
APPEND wa_plant TO it_plant.
CLEAR wa_plant.
ENDLOOP.
regards,
sudha
2007 Jun 21 6:52 AM
HI karan,
try like this.......
tables: vbrk.
select-options: s_plant for vbrk-bukrs.
types: begin of ty_plant,
bukrslow type vbrk-bukrs,
bukrshigh type vbrk-bukrs,
end of ty_plant.
data: it_plant type table of ty_plant,
wa_plant type ty_plant.
at selection-screen.
loop at s_plant.
move s_plant-low to wa_plant-bukrslow.
move s_plant-low to wa_plant-bukrslow.
append wa_plant to it_plant.
clear wa_plant.
endloop.
regards,
Ruchika
reward if useful...............
2007 Jun 21 6:53 AM
hi sorry......... like this.
tables: vbrk.
select-options: s_plant for vbrk-bukrs.
types: begin of ty_plant,
bukrslow type vbrk-bukrs,
bukrshigh type vbrk-bukrs,
end of ty_plant.
data: it_plant type table of ty_plant,
wa_plant type ty_plant.
at selection-screen.
loop at s_plant.
move s_plant-low to wa_plant-bukrslow.
move s_plant-high to wa_plant-bukrshigh.
append wa_plant to it_plant.
clear wa_plant.
endloop.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |