Application Development and Automation 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: 
Read only

populating Variants in dropdown (values from table)

Former Member
0 Likes
1,006

Hi, I have the requirement of the user must input the name of variant by select from dropdown. The values should be taken from a saptable. On selection screen two fields are present variant and variant description. the values for Variant field VARIANT should populate from table RSVAR which should populate in dropdown field format.Once the variant is selected another field description should also be visible relevant to variant.

can you please suggest me

Message was edited by:

Mirul sharma

Hi, I have the requirement of the user must input the name of variant by select from dropdown. The values should be taken from a saptable. On selection screen two fields are present variant and variant description. the values for Variant field VARIANT should populate from table RSVAR which should populate in dropdown field format.Once the variant is selected another field description should also be visible relevant to variant.

can you please suggest me

Message was edited by:

Mirul sharma

4 REPLIES 4
Read only

Former Member
0 Likes
767

Hi

Welcome to SDN forum

for that Variant field you can create a drop down list with all the possible values using the fun module VRM_SET_VALUES

see the sample code and do accordingly

REPORT zwa_test2.

TYPE-POOLS : vrm.

tables: bkpf.

DATA : values TYPE vrm_values.

DATA : wa LIKE LINE OF values.

PARAMETERS : list_box(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.

PARAMETERS: dd type bkpf-BSTAT user-command abc.

select-options: a for bkpf-bukrs MODIF ID buk.

select-options: b for bkpf-belnr MODIF ID SEL.

at selection-screen output.

If list_box = 2.

loop at screen.

if screen-group1 = 'SEL'.

screen-input = 0.

modify screen.

endif.

endloop.

endif.

INITIALIZATION.

wa-key = '1'.

wa-text = 'Orange'.

APPEND wa TO values.

wa-key = '2'.

wa-text = 'Red'.

APPEND wa TO values.

wa-key = '3'.

wa-text = 'Blue'.

APPEND wa TO values.

wa-key = '4'.

wa-text = 'Gray'.

APPEND wa TO values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'LIST_BOX'

values = values

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

Ref Program: DEMO_DROPDOWN_LIST_BOX

Link:

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

0 Likes
767

Thanks for the code anji reddy. I will try to match my requirement and the given code. I will get back to you on this regard soon. you mentioned a link know that is not showing the contents.. please check it once and give me some reference program.

Read only

Former Member
0 Likes
767

use function module

VRM_SET_VALUES

regards

Giridhar

Read only

Former Member
0 Likes
767

I got the answer. used another function module CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'VARIANT'

PVALKEY = ' '

VALUE_ORG = 'S'

TABLES

VALUE_TAB = LT_VARI

RETURN_TAB = LT_RETTAB

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • to populate the selected item from F4 help

READ TABLE LT_RETTAB INTO LW_RETURN INDEX 1.

IF sy-subrc EQ 0.

L_VAR = LW_RETURN-fieldval.

ENDIF.