02-25-2014 6:38 AM
Hi experts,
can u please guide me how to maintain select-option in TVARVC(Tcode STVARV) and to use this select-option in my program.
i want a loop on this select option in my program.
and do i need to select this entry from table TVARVC before looping.
PS; kindly guide me for maintainng three entries in trasaction STVARV. and in program also.....three entries are directory name.eg. /sapdir/abc/bank/
02-25-2014 7:13 AM
Hi Ankush
maintain entries as follows:
the use the following code:
* Define a range for directory names
data: lr_dir_range type range of char50,
ls_dir_name like line of lr_dir_range.
* Get the Directory Range from TVARVC
select sign
opti
low
high
into table lr_dir_range
from tvarvc
where name = 'DIR_NAME' "The variable name given in STVARV
and type = 'S'. "Select Option
* Now you can either use lr_dir_rangein selct statements or even in loops
* Printing via loop
if sy-subrc = 0 and lr_dir_range is not initial.
loop at lr_dir_range into ls_dir_name.
write: / ls_dir_name-low.
endloop.
endif.
rgds
Modak
02-25-2014 6:53 AM
i am not sure if i understood your requirement Correct
but to have select options in ur program, you can create Ranges
and loop on them
TVARVC already has Selection option . To create entry in TVARVC, go to se16 and you can create your entry there. Transport it to QA and production Boxes.
if you want data from TVARVC, simplly fetch the fields you require in your select query and take it into internal table.
02-25-2014 7:04 AM
Ankush,
Firstly, go with t-code: STVARV and create an entry(means create/update an entry and also click on Include changes entries in transport request) in Selection Options tab in STVARV and save it.
These entries you can see in TVARVC table.
And for fetching entries from that table, Use this:
RANGES: r_char FOR clobjdat-atnam.
SELECT *
FROM tvarvc
INTO TABLE t_tvarvc
WHERE name = 'ZTEST'. " ENTRY NAME WHICH YOU CREATED IN STVARV
IF sy-subrc = 0.
LOOP AT t_tvarvc INTO w_tvarvc.
r_char-sign = 'I'.
r_char-option = 'EQ'.
r_char-low = w_tvarvc-low.
APPEND r_char.
CLEAR r_char.
ENDLOOP.
ENDIF.
This will work for you.
Vivek
02-25-2014 7:13 AM
Hi Ankush
maintain entries as follows:
the use the following code:
* Define a range for directory names
data: lr_dir_range type range of char50,
ls_dir_name like line of lr_dir_range.
* Get the Directory Range from TVARVC
select sign
opti
low
high
into table lr_dir_range
from tvarvc
where name = 'DIR_NAME' "The variable name given in STVARV
and type = 'S'. "Select Option
* Now you can either use lr_dir_rangein selct statements or even in loops
* Printing via loop
if sy-subrc = 0 and lr_dir_range is not initial.
loop at lr_dir_range into ls_dir_name.
write: / ls_dir_name-low.
endloop.
endif.
rgds
Modak