Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to use select option from table TVARVC

Former Member
0 Kudos

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/

1 ACCEPTED SOLUTION

I042439
Employee
Employee
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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.


Former Member

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

I042439
Employee
Employee
0 Kudos

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