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: 

Parameter Listbox is not working

anujawani2426
Active Participant
0 Kudos

Hi Everyone,

When i select any country name from listbox it is not reflecting. Only first value of the listbox is showing. Can anyone help me to resolve this issue.

type-POOLs:vrm.
PARAMETERS:
p_land1 as LISTBOX VISIBLE LENGTH 8 USER-COMMAND CMD.
data: it_list type vrm_values,
wa_list like LINE OF it_list.
at SELECTION-SCREEN OUTPUT.
clear: it_list[].
select
DISTINCT
land1
from kna1
into CORRESPONDING FIELDS OF table it_kna1.
if sy-subrc eq 0.
loop at it_kna1 into wa_kna1.
wa_list-text = wa_kna1-land1.
append wa_list to it_list.
ENDLOOP.
endif.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LAND1'
values = it_list
* EXCEPTIONS
* ID_ILLEGAL_NAME = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

You must fill the key with the country code, and you must define P_LAND1 as type LAND1 (country code 3 characters). Visible length is for displaying the text (country name) so you'd better increase the length.

The key corresponds to the value of the screen field, and they should have same type (country code = 3 characters).

The text is just the information displayed (country name in full text).

When you select a value, it will fill P_LAND1 with the key.

5 REPLIES 5

Sandra_Rossi
Active Contributor

You must fill the key with the country code, and you must define P_LAND1 as type LAND1 (country code 3 characters). Visible length is for displaying the text (country name) so you'd better increase the length.

The key corresponds to the value of the screen field, and they should have same type (country code = 3 characters).

The text is just the information displayed (country name in full text).

When you select a value, it will fill P_LAND1 with the key.

0 Kudos

And it is also unnecessary to execute the code at every dynpro round-trip.

It can be moved to INITIALIZATION event, or a check should be added to validate whether the listbox table has been filled.

0 Kudos

Hi Sandra Rossi

Now it's working. When i select country name from listbox it is displaying. But one more issue is facing. Issue is when i select any country name it shows but it disappear within few seconds.

type-POOLs:vrm.
data:n type i value 1.
PARAMETERS:
p_land1 type land1 as LISTBOX VISIBLE LENGTH 8 USER-COMMAND CMD.
data: it_list type vrm_values,
wa_list like LINE OF it_list.
at SELECTION-SCREEN OUTPUT.
clear: it_list[].
select
DISTINCT
land1
from kna1
into CORRESPONDING FIELDS OF table it_kna1.
if sy-subrc eq 0.
loop at it_kna1 into wa_kna1.
wa_list-key = n.
wa_list-text = wa_kna1-land1.
append wa_list to it_list.
n = n + 1.
ENDLOOP.
endif.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LAND1'
values = it_list
* EXCEPTIONS
* ID_ILLEGAL_NAME = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

0 Kudos

The key must be the country code. Sorry to not mention it explicitly -> answer edited.

When you select a value, it will fill P_LAND1 with the key.

0 Kudos

Hi Sandra,

Thanks Sandra. Issue is resolved.