11-08-2007 4:13 PM
Hi,
I have a PNP LDB selection screen. Also I have an extra Key Date field at bottom ( apart from the std period selection ) , which is defined by me.If i enter some value in a particular field say, Action Type, I need to make my Key Date field an input field. But if the user does not enter any value in Action Type, then the Key Date field has to be grayed out. Right now what happens is , after i input something to Action Type, I need to press 'Enter' key to make the Key date active.
I am looping the screen in At sel screen o/p. But , I dont want to press enter key. The moment i type something into Action type field, I need the other field to be active, just like the case of radiobuttons.Is ther any way out for this? Pls help....
Thanks in advance...
Mahesh
11-08-2007 4:31 PM
Your settings for the grey/ungrey field is perfact with pressing the ENTER key...
You must keep in mind that ABAP is event language... so, you must raise some event to make it work.. right now, your are raising the event by pressing the ENTER... so, if you want to achieve the grey/ungrey than you need to press some key to process your code...
Regards,
Naimesh Patel
11-08-2007 4:31 PM
Your settings for the grey/ungrey field is perfact with pressing the ENTER key...
You must keep in mind that ABAP is event language... so, you must raise some event to make it work.. right now, your are raising the event by pressing the ENTER... so, if you want to achieve the grey/ungrey than you need to press some key to process your code...
Regards,
Naimesh Patel
11-08-2007 11:18 PM
It's more that we're dealing with "block mode" communication from the GUI to the app server, so data only travels from the user to the program when some function is selected.
So there is a way if you were to set up your Action Type as a listbox (and assuming you are on a recent SAP release)... as per the example below. This ties a user command into the change of a listbox setting - this example is for fun only of course, but if listbox1 is changed then the date opens, and if listbox2 is changed, it locks again.
Hope this helps.
Jonathan
report zlocal_jc_sdn_listbox_ucomm.
type-pools:
vrm.
data:
g_unlock type sap_bool.
parameters:
p_bukrs1 like t001-bukrs as listbox visible length 15
user-command zcc01,
p_bukrs2 like t001-bukrs as listbox visible length 15
user-command zcc02,
p_date like sy-datum.
initialization.
perform listbox_values_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.
*
* Toggle lock / unlock
*
loop at screen.
if screen-name = 'P_DATE'.
if g_unlock is initial.
screen-input = '0'.
else.
screen-input = '1'.
endif.
modify screen.
endif.
endloop.
endform. "at_selection_screen_output
*&---------------------------------------------------------------------*
*& Form at_selection_screen
*&---------------------------------------------------------------------*
form at_selection_screen.
case sy-ucomm.
when 'ZCC01'. "CC 1 changed
g_unlock = 'X'.
when 'ZCC02'. "CC 2 changed
g_unlock = ' '.
endcase.
endform. "at_selection_screen
*&---------------------------------------------------------------------*
*& Form listbox_values_fill
*&---------------------------------------------------------------------*
form listbox_values_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 = 'London'.
append l_value to lt_value.
l_value-key = '2000'.
l_value-text = 'New York'.
append l_value to lt_value.
l_value-key = '3000'.
l_value-text = 'Canberra'.
append l_value to lt_value.
call function 'VRM_SET_VALUES'
exporting
id = l_id
values = lt_value.
*
* And re-use the list for listbox 2
*
l_id = 'P_BUKRS2'. "name of variable in screen
call function 'VRM_SET_VALUES'
exporting
id = l_id
values = lt_value.
endform. "listbox_values_fill