‎2008 Aug 25 6:55 PM
Hi,
I have populated my listbox on the selection screen using the function module VRM_SET_VALUES.
How do I get the value which is selected from the list box.
Where is the selected value in the listbox stored.
Thanks,
Abhishek
‎2008 Aug 25 6:58 PM
Hi,
This thread answers solves your issue -
Pls check these links on the usage of this FM
http://sap.niraj.tripod.com/id38.html
Regards
Lekha
‎2008 Aug 25 7:15 PM
Hi
there will be a screen field associated with list box rite, that screen field will hold the selected value from drop down
‎2008 Aug 25 7:16 PM
The screen field doesn't hold any value for the selected field. It is blank.
‎2008 Aug 25 7:21 PM
‎2008 Aug 25 7:28 PM
The code I used is:
Another issue is that whenever I select any value in the listbox it is not displayed on the screen. It becomes blank again.
PARAMETERS: p_prin AS LISTBOX VISIBLE LENGTH 30 USER-COMMAND sele.
DATA: i_printers TYPE STANDARD TABLE OF frprlist,
wa_printers TYPE frprlist.
DATA: l_name TYPE vrm_id,
i_list TYPE vrm_values,
l_ctr TYPE i VALUE 0,
wa_value LIKE LINE OF i_list.
CLEAR: wa_value.
Get printers
CALL FUNCTION 'RSPO_FRONTEND_PRINTERS_FOR_DEV'
EXPORTING
device = p_print
TABLES
list = i_printers
EXCEPTIONS
no_list = 1
list_truncated = 2
name_not_found = 3
OTHERS = 4.
IF sy-subrc EQ 0.
Populate to drop down box
l_name = c_prin.
LOOP AT i_printers INTO wa_printers.
l_ctr = l_ctr + 1.
wa_value-key = l_ctr.
wa_value-text = wa_printers-prname.
APPEND wa_value TO i_list.
CLEAR wa_value.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = l_name
values = i_list
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc NE 0.
Do nothing
ENDIF.
ENDIF.
CLEAR: l_name, l_ctr, wa_value, i_list.
‎2008 Aug 25 7:37 PM
pass
l_name = p_prin
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = l_name
‎2008 Aug 25 7:39 PM
ID parameter of the FM VRM_SET_VALUES should contain the name of the field on which you have created list box.
Like:
l_name = 'P_PRIN'.
Regards,
Naimesh Patel
‎2008 Oct 22 5:36 PM
Hi.
I have several list box on my screen without any problem, except that I don't know how to get the selected value from list box (the name of this post)
When I select a value from the list box, what I get it's the value-key, and I need the value-text... How can I get it?
For example:
CLEAR values2.
value2-key = '1'.
value2-text = 'E'.
APPEND value2 TO values2.
value2-key = '2'.
value2-text = 'S'.
APPEND value2 TO values2.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'TBI_DIRECCION_TEM-DS_ORIENT_VIA'
values = values2.
In the program, when I need to get the value, I've found that the field TBI_DIRECCION_TEM-DS_ORIENT_VIA has the value '2' (corresponding to the value-key), and not 'S' (corresponding to the value-text, that's what I need)
How can I get it?
Thanks in advance.
Carolina
‎2008 Oct 22 5:54 PM
Hi Carolina,
Hearty welcome to SDN.
Please go through the site fully so that you can have better idea on how much SDN can help you. Please do give some time to search for some time in SDN before posting any query. Hope you follow from now.
Make the changes in the code as i have shown..
CLEAR values2.
value2-key = 'E'.
value2-text = '1'.
APPEND value2 TO values2.
value2-key = 'S'.
value2-text = '2'.
APPEND value2 TO values2.
Cheers!!
Balu
Edited by: Balu CH on Oct 22, 2008 10:24 PM
‎2008 Oct 22 8:26 PM
Thanks Balu for your advice.
And I guess, I didn't explain myself clearly...
My problem wasn't that I couldn't show the appropiate value on the screen. I needed to show 'S' or 'N', but when I was working with the value selected (S or N), in the field was stored 1 or 2, and I needed the S or N.
But you gave me a good idea (and that was a doubt I had). I changed the code for something like this:
CLEAR values2.
value2-key = 'N'.
value2-text = 'N'.
APPEND value2 TO values2.
value2-key = 'S'.
value2-text = 'S'.
APPEND value2 TO values2.
I'm using value-key to store also the value-text, and when I read the value selected I get the S or the N.
So, thanks very much 😃 I learned so much with the posts that I've found at the SDN.