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 populate select-option from TVARV?

Former Member
0 Kudos

Hi experts,

could you tell me how can I populate the select-options or parameters from TVARV table on the easiest or simpliest way?

What are the steps of populating?

1 ACCEPTED SOLUTION

former_member195383
Active Contributor
0 Kudos

declare the selct option or parameter of the type of the field that u want to populate from TVARV.The f4 help will come...by that u can select and populate the select options...

Reward points if useful..

13 REPLIES 13

former_member195383
Active Contributor
0 Kudos

declare the selct option or parameter of the type of the field that u want to populate from TVARV.The f4 help will come...by that u can select and populate the select options...

Reward points if useful..

0 Kudos

Okay, but how will the program know the values from TVARV?

0 Kudos

u will get the F4 help using which u can populate the parameter (say pa_val)

or select option(say so_val).

The program will get the values in pa_val or so_val-high and so_val-low.

0 Kudos

Hi White,

You try writing the code I sent and check on the selection screen. You will get the F4 help automatically. This is because we are refering to the dictionary fields. So, it will have a search help attached to it. From that search help you will get the values.

Please Reward if useful,

Regards,

Swapna.

0 Kudos

Hi White,

You try writing the code I sent and check on the selection screen. You will get the F4 help automatically. This is because we are refering to the dictionary fields. So, it will have a search help attached to it. From that search help you will get the values.

Please Reward if useful,

Regards,

Swapna.

0 Kudos

u can use the function 'F4IF_INT_TABLE_VALUE_REQUEST' for low and high values.

0 Kudos

F4 doesn't work for me : ( Sorry... Did I do something wrong?

Former Member
0 Kudos

Hi White,

First select the field from the table TVARV for which you want select-option or parameter. Then refer this select-option or parameter to the field in TVARV table.

Suppose you want a select-option for NAME field in TVARV Then write as :

select-options :
  s_name for tvarv-name.

If you want a parameter for NAME field in TVARV. Then write as :

parameters :
  p_name like tvarv-name.

If you do this way the system automatically generates the F4 help.

Regards,

Swapna.

Edited by: NagaSwapna Thota on Jul 8, 2008 1:59 PM

0 Kudos

Hello, what if I have some select-option in my TVARV and I want to give the value from TVARV table.

I mean, suppose that I have the following on the selection-screen:

select-option s_bukrs for bkpf-bukrs.

I want assign the value from my TVARV to the select-option s_bukrs. How can I do that?

Former Member
0 Kudos

Also u can create dynamic variant using TVARV table..

For detail steps pl. see this blog...

http://www.saptechnical.com/Tutorials/ABAP/DynamicVariant/TVARV.htm

Regards,

joy.

0 Kudos

Hi,

U can try this.....

DATA: BEGIN OF t_stxh OCCURS 0,

tdname TYPE stxh-tdname,

END OF t_stxh.

DATA: fields LIKE help_value OCCURS 2 WITH HEADER LINE.

PARAMETERS: text_ele LIKE stxh-tdname OBLIGATORY.

INITIALIZATION.

SELECT tdname

FROM stxh

INTO TABLE t_stxh

WHERE tdobject = 'TEXT' AND

tdid = 'ST' AND

tdspras = 'E'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR text_ele.

CLEAR : fields.

REFRESH : fields.

Provide search help to text element

fields-tabname = 'STXH'.

fields-fieldname = 'TDNAME'.

fields-selectflag = 'X'.

APPEND fields.

CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'

EXPORTING

title_in_values_list = 'Text Elements'

titel = 'Text Elements'

IMPORTING

select_value = text_ele

TABLES

fields = fields

valuetab = t_stxh

EXCEPTIONS

field_not_in_ddic = 1

more_then_one_selectfield = 2

no_selectfield = 3

OTHERS = 4.

IF sy-subrc 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Regards,

Aparna Gaikwad

raymond_giuseppi
Active Contributor
0 Kudos

Create a variant for the program, when saving the variant, declare the select-options as a "selection variable", then click on the "selection variable" button, there click on the arrow under "T" and select the key of TVARV to use.

Attach the variant to the transaction.

Take a look at

- [Maintenance of Selection Variables in the TVARV Table|http://help.sap.com/erp2005_ehp_03/helpdata/EN/e4/647237e28e11d29e4f0000e839cd96/frameset.htm]

- [Specifying Selection Variables in the Program Variants|http://help.sap.com/erp2005_ehp_03/helpdata/EN/80/be58397e9d2e06e10000000a114084/frameset.htm]

Regards

Former Member
0 Kudos

Thanks for the answers