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

LIST BOX

0 Likes
1,693

Hi,

Below is the code that I have used to populate my listboxes. Please help me with the code; how to fetch back the key value from the listbox during runtime.

SELECT ACCNUMBER INTO ACCNUMBER FROM ZTABCSCUSTMASTER WHERE SAPUSER = SY-UNAME.

DROPDOWN-KEY = ACCNUMBER.

DROPDOWN-TEXT = ' '.

APPEND DROPDOWN TO VAL.

ENDSELECT. "ZTABCSCUSTMASTER

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'ACCNO'

VALUES = VAL

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

Thanks

Anand D

1 ACCEPTED SOLUTION
Read only

sharat_chandra
Product and Topic Expert
Product and Topic Expert
0 Likes
1,658

Hi,

Have a look at the program DEMO_DYNPRO_DROPDOWN_LISTBOX, specifically the module user_command_200.

The selected value in the list box is stored in the structure as given in the program.

9 REPLIES 9
Read only

sharat_chandra
Product and Topic Expert
Product and Topic Expert
0 Likes
1,659

Hi,

Have a look at the program DEMO_DYNPRO_DROPDOWN_LISTBOX, specifically the module user_command_200.

The selected value in the list box is stored in the structure as given in the program.

Read only

former_member196299
Active Contributor
0 Likes
1,658

hi Anand ,

I hope you atre getting the value in the list box and able to select the value from the list for your UI filed .

Now you can directly use the field ( STR-FIELDNAME ) used in the UI screen to fetch the value back to the program and use it further .

If you need further information then revert back .

Regards,

Ranjita

Read only

0 Likes
1,658

Hi Ranjitha,

Only the first value is obtained directly using the field ( STR-FIELDNAME ) name on the UI screen. But subsequent values cannot be fetched. i.e. they are blank when we get them directly using screen field names.

Thanks

Anand D

Read only

0 Likes
1,658

Hi Anand ,

May be I understood it in a different way , but if you are able to show the filled listbox in the UI, that means you already have an internal table which has got the values. So you need not fetch back the list from the UI, instead you can use the value filled internal table which you used previously .

If this is not exactly what you want then please be specific on the requirement so that we can figure out the solution ..

Regards,

Ranjita

Read only

0 Likes
1,658

Hi Ranjitha,

Could you please help me with a code snippet for populating and retrieving value from the list box. I need to get the user selected list box value on a button click event. I am fine with any sample code for the above requirement.

Thanks

Anand D

Read only

0 Likes
1,658

Here you go ..

This code sample will make you understand how to fill the listbox and retrieve values from it ..

&----


*& Report ZTRY

*&

&----


*&

*&

&----


REPORT ZTRY.

TYPE-POOLS: VRM.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

NAME = 'PS_PARM'.

VALUE-KEY = '1'.

  • Fill the list with values LINE 1 and LINE 2 .

VALUE-TEXT = 'LINE 1'.

APPEND VALUE TO LIST. VALUE-KEY = '2'.

VALUE-TEXT = 'LINE 2'.

APPEND VALUE TO LIST.

  • Set the dropdown list for the required screen field

CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Hope this is of help .

Regards,

Ranjita ..

Read only

0 Likes
1,658

Thanks Ranjita

Read only

0 Likes
1,658

you are welcome ...

Read only

0 Likes
1,658

Hi,

I have an issue where in i ve to populate the dropdown list at runtime in case of a normal report program (R/3 system). please help me in this regard.

*********Points will be awarded****************