‎2007 Sep 20 1:11 PM
dear gurus,
I need a help for select option
Suppose in select option i am getting a value low as 10 and high as 20.
i need to move all those which lies from 10 - 20 into an internal table.
if there is only low
i need only that particular value to internal table
Is this is possible if so how?
regards
senthil
‎2007 Sep 20 1:19 PM
check for low is value and high
then use in select field in select_options
or high is initial
then use field in select_options.
Main logic is to check low and high values.
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 20 1:16 PM
hi,
try this.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr.
SELECTION-SCREEN:END OF BLOCK blk1.
SELECT matnr mtart matkl meins
INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara
<b>WHERE matnr IN mat.</b>
by this,
if u have only low value than also it will work.
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Dhwani shah
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 20 1:40 PM
hi thanx for all u replies
I dont want to use select statement..
i want to have all the values before the select statemnt in internal tables
Is it possible ?
Regards
senthil
‎2007 Sep 20 1:50 PM
‎2007 Sep 20 1:19 PM
check for low is value and high
then use in select field in select_options
or high is initial
then use field in select_options.
Main logic is to check low and high values.
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 20 1:19 PM
‎2007 Sep 20 1:21 PM
Hi,
if it is number then we can do
now get the difference
of low and high
it will be 10 in your case..
do 10 times.
if sy-index = 1.
itab-field = s_valu-low.
append itab.
elseif sy-index = 10.
itab-field = s_valu-high.
append itab.
else.
itab-field = s_value-low + sy-tabix.
append itab.
endif.
enddo.
you have to modify this code according to your requirement
this is just a reference that how can go further
regards,
Venkatesh
‎2007 Sep 20 1:24 PM
hi ,
jest give the field in the select option syntax.
in that we ve two input fields,
first input field for low value and another one high value....
thanks,
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 20 1:26 PM
Hi,
Use the below code.
DATA: v_num1(2) TYPE n.
SELECT-OPTIONS: s_num FOR v_num1.
DATA: BEGIN OF itab OCCURS 0,
num(2) TYPE n,
END OF itab.
IF NOT s_num-low IS INITIAL AND
NOT s_num-high IS INITIAL.
WHILE s_num-low LE s_num-high.
itab-num = s_num-low.
APPEND itab.
s_num-low = s_num-low + 1.
ENDWHILE.
ELSEIF NOT s_num-low IS INITIAL.
LOOP AT s_num.
itab-num = s_num-low.
APPEND itab.
ENDLOOP.
ENDIF.
LOOP AT itab.
WRITE:/5 itab-num.
ENDLOOP.
Message was edited by:
Velangini Showry Maria Kumar Bandanadham
Message was edited by:
Velangini Showry Maria Kumar Bandanadham
‎2007 Sep 20 1:40 PM
hi senthil,
i wrote the code for ur requirement i tested it it is working fine. plase see the below code and debug it .
TABLES: vbak.
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
END OF t_vbak.
DATA: i_vbak TYPE STANDARD TABLE OF t_vbak.
DATA: wa_vbak TYPE t_vbak.
DATA: BEGIN OF it_final OCCURS 0,
low TYPE vbak-vbeln,
END OF it_final.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
LOOP AT s_vbeln WHERE option = 'BT' OR OPTION = 'EQ' AND sign = 'I'.
IF ( s_vbeln-low IS NOT INITIAL ) AND ( s_vbeln-high IS NOT INITIAL ).
SELECT vbeln FROM vbak INTO TABLE it_final
WHERE vbeln IN s_vbeln.
ELSEIF s_vbeln-low IS NOT INITIAL AND s_vbeln-high IS INITIAL.
SELECT vbeln FROM vbak INTO TABLE it_final
WHERE vbeln IN s_vbeln.
ENDIF.
ENDLOOP.
thanks,
maheedhar
‎2007 Sep 20 1:51 PM
hi thanx for the effort
as i have mentioned i dont want to use select statement to get the output.
Regards
senthil
‎2007 Sep 20 3:27 PM
Hi,
I understud ur requirement as u r giving a value range or a single value in select-option and u need those values in an internal table.rt?
For that wat u can do is:
data:begin of it_value occurs 0,
matnr like mara-matnr,
end of it_value.
select-options:s_matnr for mara-matnr.
select matnr from mara into table it_value where matnr in s_matnr.
The above code will work if it is a DDIC field.
Now u want a n int value like as u said b/n 10 and 20 which may be of type int.
then:
data:begin of it_value occurs 0,
val type int4,
end of it_value.
data:wa_value like line of it_value.
select-options:s_matnr for int4.
loop at s_matnr.
wa_value-val = s_matnr-low.
append wa_value to it_value.
endloop.
thanks
‎2007 Sep 20 3:38 PM
Hi,
Instead of move the values into internal table, why do not you create a ranges for it.
If you are comfortable with this, please use the below code :
select-options : belnr for bsis-belnr.
ranges : gr_belnr for bsis-belnr.
initialization.
gr_belnr-sign = 'I'.
gr_belnr-option = 'BT'.
gr_belnr-low = belnr-low.
gr_belnr-high = belnr-high.
append gr_belnr.
clear gr_belnr.
And use this ranges whereever you required.
Thanks,
Sriram Ponna.