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 get the entry in second list box on selecting value in first listbox

Former Member
0 Kudos

Hi experts,

I am new in HR-ABAP field and i am creating custom infotype. with two listbox.

two list box are :

first list box is

TITLE and fixed values are MR and MIss.

second listbox is

TITLE1 and fixed values are MALE and FEMALE.

I want :

when i will select MR in first listbox so automatically MALE should come in second listbox.

and when i select 'Miss' then FEMALE should come in second list box.

Please solve this issue.

5 REPLIES 5

Kiran_Valluru
Active Contributor
0 Kudos

Hi.,

Assign Function Code to List box, then in PAI check the function code and set the value accordingly.

check marcin's reply in this thread for reference :

also check DEMO_DYNPRO_DROPDOWN_LISTBOX Standard program. then you will get an idea how to do it.,

hope this helps u.,

Thanks & Regards,

Kiran

Former Member
0 Kudos

REPORT ztest_94test.

TYPE-POOLS vrm .

TYPES: BEGIN OF vrm_value,

key(40) TYPE c,

text(80) TYPE c,

END OF vrm_value,

vrm_values TYPE vrm_value OCCURS 0.

PARAMETERS: p_title TYPE char12 AS LISTBOX

VISIBLE LENGTH 40 USER-COMMAND sel ,

p_title1(40) AS LISTBOX VISIBLE LENGTH 40 LOWER CASE.

DATA :lv_name TYPE vrm_id.

DATA : lwa_value TYPE vrm_value,

lt_list TYPE vrm_values.

AT SELECTION-SCREEN.

IF sy-ucomm = 'SEL' AND NOT p_title IS INITIAL.

CLEAR :p_title1.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF p_title IS INITIAL.

REFRESH :lt_list.

lwa_value-key = 'MR'.

lwa_value-text = 'MR'.

APPEND lwa_value TO lt_list.

lwa_value-key = 'MISS'.

lwa_value-text = 'MISS'.

APPEND lwa_value TO lt_list.

lv_name = 'P_TITLE'.

*Set the drop down list

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = lv_name

values = lt_list.

ENDIF.

IF p_title1 IS INITIAL AND NOT p_title IS INITIAL .

REFRESH :lt_list.

IF p_title EQ 'MR'.

lwa_value-key = 'MALE'.

lwa_value-text = 'MALE'.

APPEND lwa_value TO lt_list.

ENDIF.

IF p_title EQ 'MISS'.

lwa_value-key = 'FEMALE'.

lwa_value-text = 'FEMALE'.

APPEND lwa_value TO lt_list.

ENDIF.

lv_name = 'P_TITLE1'.

  • Set the drop down values

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = lv_name

values = lt_list.

ENDIF.

Hope this will be helpful.

Regards

Aravind.

0 Kudos

Thx Arvind,

but i want to use it in module pool programming so please tell me in detail how i will i use in module pool.

0 Kudos

Hi,

For module pool,

In the screen attributes : give the some function code and select the list box option for both the fields.

In PBO..

Write the at selection screen out put logic.

In PAI.

Between chain and end chain write the at selection screen logic..

hope this will be helpful..

Regards

Aravind.

0 Kudos

Hi,

Place two i/0 fields(title, title1) in the screen and select drop down field as listbox.Give some function code SEL1 for title field. and place the below code in the PBO of the screen.

MODULE STATUS_0100 OUTPUT.

SET PF-STATUS '100'.

  • SET TITLEBAR 'xxx'.

DATA :title type char12,

title1 type char12.

TYPE-POOLS vrm .

TYPES: BEGIN OF vrm_value,

key(40) TYPE c,

text(80) TYPE c,

END OF vrm_value.

DATA :lv_name TYPE vrm_id.

DATA : lwa_value TYPE vrm_value,

lt_list TYPE vrm_values.

IF sy-ucomm = 'SEL1'.

clear :title1.

endif.

IF title IS INITIAL.

REFRESH :lt_list.

lwa_value-key = 'MR'.

lwa_value-text = 'MR'.

APPEND lwa_value TO lt_list.

lwa_value-key = 'MISS'.

lwa_value-text = 'MISS'.

APPEND lwa_value TO lt_list.

lv_name = 'TITLE'.

*Set the drop down list

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = lv_name

values = lt_list.

ENDIF.

IF title1 IS INITIAL AND NOT title IS INITIAL .

REFRESH :lt_list.

IF title EQ 'MR'.

lwa_value-key = 'MALE'.

lwa_value-text = 'MALE'.

APPEND lwa_value TO lt_list.

ENDIF.

IF title EQ 'MISS'.

lwa_value-key = 'FEMALE'.

lwa_value-text = 'FEMALE'.

APPEND lwa_value TO lt_list.

ENDIF.

lv_name = 'TITLE1'.

  • Set the drop down values

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = lv_name

values = lt_list.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

Its working.

Regards

Aravind.