cancel
Showing results for 
Search instead for 
Did you mean: 

Know what field I'm changing

Former Member
0 Kudos

Hi all,

I put in several Input fields the same Action in the event OnEnter.

How I can know within the method by which field has been called?

another question:

if I have a table and I have also an action in the event onEnter, how do I know which line and wich field is being modified?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Husalban,

I put in several Input fields the same Action in the event OnEnter.

How I can know within the method by which field has been called?

-> Check Parameters of the WDEVENT to find what field triggers the ENTER event.

if I have a table and I have also an action in the event onEnter, how do I know which line and wich field is being modified?

-> you have to use context change log to find out. Check this: [Context Change Log (Recording User Entries)|http://help.sap.com/saphelp_rc10/helpdata/en/ae/f95e42ff93c153e10000000a1550b0/content.htm]

Hope it helps!

Duy

ChrisPaine
Active Contributor
0 Kudos

Your onEnter action has two standard parameters (if these do not already exist you can add then by choosing your action in the "Actions" tab and clicking the "Parameter from UI Event" button.

These two parameters are ID and CONTEXT_ELEMENT.

ID refers to the Id of the UI element that has triggered the actions - so if you have different fields triggering the same action you will see a different value in this field.

CONTEXT_ELEMENT refers to the context element of the attribute that is bound to and shown in the table/ form.

by querying these two standard parameters you can easily find which UI element was used to trigger the action, and which row of a table or row-repeater was triggered.

Hope that helps,

Chris

Answers (3)

Answers (3)

Former Member
0 Kudos

Finally I put a CASE statement for the field ID and use the code wizard to get the value.

but, I thought it could be done more easily.

Former Member
0 Kudos

For my table is ok.

But for a Input field the parameter CONTEXT_ELEMENT is empty.

How I can know the value of the attribute whose name is reported in the parameter ID?

I've tried this;

CALL METHOD my_context->enable_context_change_log.

  CALL METHOD my_context->get_context_change_log
  EXPORTING
    and_reset   = ABAP_TRUE
    RECEIVING
      change_list = ls_change_list.

But the change list is always empty...

I've tried this also;

CALL METHOD wd_context->get_attribute
  EXPORTING
*    index  = USE_LEAD_SELECTION
    name   = id
  IMPORTING
    value  = lv_value.

But is Dumping... with this reason Attribut XXXX konnte nicht gefunden werden.

Former Member
0 Kudos

Hello,

Am not sure if its possible to know the attribute corresponding to an input field within onEvent action handler.

What you can do is: Suppose you have 3 input fields for which you are using the same action handler.

In the implementation of that handler, get the ID of the input field using the event parameter ID and have a case statement for 3 input fields. At design time itself, you would be knowing which context attribute you had bound to the value of which input field.

So for each input field, read the corresponding context attribute by getting the lead selected element first and reading the attribute value.

Hope this helps!

Regards,

Srilatha M

Former Member
0 Kudos

Thanks !