11-14-2007 12:22 PM
Hi ,
I have a table control with a column as a listbox. On the basis of what the user selects from the list, it should accordingly populate some data to show in the F4 help implemented through POV . For this I assigned Fctcode to the listbox .
But whenever I select a value from the list, that particular value does not stay.
I have coded the following in PBO:
loop at it_zmattb into zmattb with control tbcontrol .
MODULE INITIALISE.
endloop.
&----
*& Module INITIALISE OUTPUT
&----
text
----
MODULE initialise OUTPUT.
if g_list[] is initial. "SO THAT LIST does not contain repeating values .
value-key = 1.
value-text = 'Material'.
append value to g_list.
value-key = 2.
value-text = 'Plant'.
append value to g_list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'ZMATTB-TEXT'
values = g_list.
MODIFY IT_ZMATTB FROM ZMATTB INDEX SY-TABIX.
ENDIF.
ENDMODULE. " INITIALISE OUTPUT
Please guide how to implement dynamic values in F4 on a second column according to value selected from Listbox in first column.
Note that I want to use only listbox.
Thanks in advance.
11-15-2007 1:50 AM
You should be able to do it, but you will probably need to assign the listbox a command, so that you can tell the user has selected a new value... I've put in a report example below but the principal should be able to be applied to a table control in a dynpro just fine.
Jonathan
report zlocal_jc_sdn_listbox_link.
type-pools:
vrm.
parameters:
p_bukrs1 like t001-bukrs as listbox visible length 15
user-command zcc01 obligatory,
p_bukrs2 like t001-bukrs as listbox visible length 15
user-command zcc02.
initialization.
perform listbox1_fill.
at selection-screen output.
perform at_selection_screen_output.
at selection-screen.
perform at_selection_screen.
start-of-selection.
format reset.
write: / 'Listbox 1 - you chose:', p_bukrs1.
write: / 'Listbox 2 - you chose:', p_bukrs2.
*&---------------------------------------------------------------------*
*& Form at_selection_screen_output
*&---------------------------------------------------------------------*
form at_selection_screen_output.
perform listbox2_fill.
endform. "at_selection_screen_output
*&---------------------------------------------------------------------*
*& Form at_selection_screen
*&---------------------------------------------------------------------*
form at_selection_screen.
case sy-ucomm.
when 'ZCC01'. "CC 1 changed
clear: p_bukrs2. "as it won't be valid now
when 'ZCC02'. "CC 2 changed
endcase.
endform. "at_selection_screen
*&---------------------------------------------------------------------*
*& Form listbox1_fill
*&---------------------------------------------------------------------*
form listbox1_fill.
data:
l_id type vrm_id,
lt_value type vrm_values,
l_value like line of lt_value.
* Listbox 1:
l_id = 'P_BUKRS1'. "name of variable in screen
l_value-key = '1000'.
l_value-text = 'Australia'.
append l_value to lt_value.
l_value-key = '2000'.
l_value-text = 'England'.
append l_value to lt_value.
call function 'VRM_SET_VALUES'
exporting
id = l_id
values = lt_value.
p_bukrs1 = '1000'. "initial default
endform. "listbox1_fill
*&---------------------------------------------------------------------*
*& Form listbox2_fill
*&---------------------------------------------------------------------*
form listbox2_fill.
data:
l_id type vrm_id,
lt_value type vrm_values,
l_value like line of lt_value.
* Listbox 2:
l_id = 'P_BUKRS2'. "name of variable in screen
case p_bukrs1.
when '1000'. "Australia
l_value-key = '1100'.
l_value-text = 'Canberra'.
append l_value to lt_value.
l_value-key = '1200'.
l_value-text = 'Sydney'.
append l_value to lt_value.
when '2000'. "England
l_value-key = '2100'.
l_value-text = 'Manchaster'.
append l_value to lt_value.
l_value-key = '2200'.
l_value-text = 'London'.
append l_value to lt_value.
endcase.
call function 'VRM_SET_VALUES'
exporting
id = l_id
values = lt_value.
endform. "listbox2_fill
11-15-2007 1:50 AM
You should be able to do it, but you will probably need to assign the listbox a command, so that you can tell the user has selected a new value... I've put in a report example below but the principal should be able to be applied to a table control in a dynpro just fine.
Jonathan
report zlocal_jc_sdn_listbox_link.
type-pools:
vrm.
parameters:
p_bukrs1 like t001-bukrs as listbox visible length 15
user-command zcc01 obligatory,
p_bukrs2 like t001-bukrs as listbox visible length 15
user-command zcc02.
initialization.
perform listbox1_fill.
at selection-screen output.
perform at_selection_screen_output.
at selection-screen.
perform at_selection_screen.
start-of-selection.
format reset.
write: / 'Listbox 1 - you chose:', p_bukrs1.
write: / 'Listbox 2 - you chose:', p_bukrs2.
*&---------------------------------------------------------------------*
*& Form at_selection_screen_output
*&---------------------------------------------------------------------*
form at_selection_screen_output.
perform listbox2_fill.
endform. "at_selection_screen_output
*&---------------------------------------------------------------------*
*& Form at_selection_screen
*&---------------------------------------------------------------------*
form at_selection_screen.
case sy-ucomm.
when 'ZCC01'. "CC 1 changed
clear: p_bukrs2. "as it won't be valid now
when 'ZCC02'. "CC 2 changed
endcase.
endform. "at_selection_screen
*&---------------------------------------------------------------------*
*& Form listbox1_fill
*&---------------------------------------------------------------------*
form listbox1_fill.
data:
l_id type vrm_id,
lt_value type vrm_values,
l_value like line of lt_value.
* Listbox 1:
l_id = 'P_BUKRS1'. "name of variable in screen
l_value-key = '1000'.
l_value-text = 'Australia'.
append l_value to lt_value.
l_value-key = '2000'.
l_value-text = 'England'.
append l_value to lt_value.
call function 'VRM_SET_VALUES'
exporting
id = l_id
values = lt_value.
p_bukrs1 = '1000'. "initial default
endform. "listbox1_fill
*&---------------------------------------------------------------------*
*& Form listbox2_fill
*&---------------------------------------------------------------------*
form listbox2_fill.
data:
l_id type vrm_id,
lt_value type vrm_values,
l_value like line of lt_value.
* Listbox 2:
l_id = 'P_BUKRS2'. "name of variable in screen
case p_bukrs1.
when '1000'. "Australia
l_value-key = '1100'.
l_value-text = 'Canberra'.
append l_value to lt_value.
l_value-key = '1200'.
l_value-text = 'Sydney'.
append l_value to lt_value.
when '2000'. "England
l_value-key = '2100'.
l_value-text = 'Manchaster'.
append l_value to lt_value.
l_value-key = '2200'.
l_value-text = 'London'.
append l_value to lt_value.
endcase.
call function 'VRM_SET_VALUES'
exporting
id = l_id
values = lt_value.
endform. "listbox2_fill