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: 

Triggering Events on List Box dropdown

0 Kudos

Is there any possibility to trigger an event on selection of a particular item of a list-box?

The requirement is to Enable/Disable the fields of a Selection Screen depending on the values of the List-Box Dropdown.

Any pointers to this regard would be helpful.

Regards,

Vasant....

7 REPLIES 7

Former Member
0 Kudos

HI,

refer sample code:

SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-005.

PARAMETERS : p_field TYPE dd03l-fieldname AS LISTBOX

VISIBLE LENGTH 80 OBLIGATORY.

SELECTION-SCREEN END OF BLOCK c.

INITIALIZATION.

*-- Populate List Box

*-- TEMKSV - Legacy Value

wa_value-key = 'TEMKSV'.

wa_value-text = 'Legacy Key'.

APPEND wa_value TO i_value.

CLEAR: wa_value.

*-- Installation

wa_value-key = 'INSTLN'.

wa_value-text = 'Installation'.

APPEND wa_value TO i_value.

CLEAR: wa_value.

  • Setting the selection

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_FIELD'

values = i_value.

CASE p_field.

WHEN 'TEMKSV'.

*-- Delete Object

PERFORM delete_temksv.

WHEN 'INSTLN'.

*-- Delete Installation

PERFORM delete_installation.

endcase.

refer std prg if u need to do the same in Module pool program - RSDEMO_DROPDOWN_LISTBOX

Reward points if this Helps.

Manish

Former Member
0 Kudos

hi Vasanta Kumar,

please use the statement mentioned below to have an action triggered, while selecting a value from list box:

PARAMETERS p_carrid TYPE spfli-carrid 
                    AS LISTBOX VISIBLE LENGTH 20 
                    USER-COMMAND onli 
                    DEFAULT 'LH'.

at selection-screen output.
     if not lv_flag is initial.
           loop at screen.
                  if screen-name = 'the one you want to enable/disable, in CAPS'.
                             screen-input = 0. " to disable or '1' to enable
                             modify screen.
                  endif.
           endloop.
at selection-screen.

if sscrfields-ucomm = 'ONLI'."    (or you can use SY_UCOMM).
    lv_flag = 'X'.
else.
    clear lv_flag.
endif.

Hope this helps,

Sajan Joseph.

0 Kudos

I need the event to be triggered as and when when the option from the dropdown is selected in the report program(something like a radio-button).

The suggestions mentioned here doesnt trigger the event at that particular instant.

Your obsevations regarding this would be helpful.

0 Kudos

Hi there. What you want is not possible as you need to trigger the PAI processing by pressing a button. There is no actual communication between your program and the SAP server becuase your program is in a "rolled out" state. The selection is only happening in your GUI but not yet reflected in your field.

0 Kudos

all you have to do is assign a Function Code to the list box.... this way every time to make a selection in your list box...... PAI gets triggerd...... in pai u can check for the value of the list box and accordingly enable/disable the feilds.

Former Member
0 Kudos

Hey Vasant,

Assign function code for that text field.

and populate values through VRM_SET_VALUES.

then in PAI check for that function code and also the field value.

it means the VRM will set values to that field.

regards

Satish

0 Kudos

ok