cancel
Showing results for 
Search instead for 
Did you mean: 

unable to read value in input field

Murali_Shanmu
Active Contributor
0 Kudos

Hi

I have an input field binded to a context. on the onEnter event I tries to debug and retreive the value the user has keyed in, using get_attribute method. But always it gives me the data passed to the field from model. How do i retrive the values keyed in by the user in that field. onEnter event.

Regards,

Murali.

Accepted Solutions (1)

Accepted Solutions (1)

former_member215843
Active Participant
0 Kudos

Hi Murali,

in general reading the context attribute will return the value the user has entered.

There are 2 possibilities, why it may not work:

1. The user has entered the value somewhere in a table and you retrieve the value from the lead selection. In this case you should pass the correct index.

2. The user has entered wrong data, and your action handler is declared as validation independent. In this case you have no access to the entered value.

Regards, Regina

Murali_Shanmu
Active Contributor
0 Kudos

Hi Regina. Thanks for ur input. I am not using a Table nor am i giving any wrong data. I have pasted my code also above. Please help me out.

Regards,

Murali.

former_member215843
Active Participant
0 Kudos

Hi Murali,

The coding is quite streight forward - I assume generated by the code wizard.

Please check whether you really bind against this attribute in this node.

Then set a breakpoint in the event handler (use the new debugger), switch one tool to the Web Dynpro debugger, and check the values.

Another possibility: Perhaps the code in WDDOBEFOREACTION does change the context attribute and overwrites the user input. If you have any coding there, set a breakpoint there and check the context.

Ciao, Regina

Murali_Shanmu
Active Contributor
0 Kudos

Oops.. It was a mistake from my end. I binded the field to AUSBI at IMPORTING and was tryingto retreive the AUSBI at CHANGING node. Learnt my lesson. Thanks.

Murali.

Answers (1)

Answers (1)

roberto_tagliento
Active Contributor
0 Kudos

Hi, seem strange.

Please put your code.

Murali_Shanmu
Active Contributor
0 Kudos

Hi

This is the piece of code written for onEnter of an Input Field that is binded to my context attribute - AUSBI. It refers to P0002-AUSBI and have mapped it from Component controller.

DATA:

node_changing TYPE REF TO if_wd_context_node,

node_i_p0022 TYPE REF TO if_wd_context_node,

elem_i_p0022 TYPE REF TO if_wd_context_element,

stru_i_p0022 TYPE if_edu_detail=>element_i_p0022 ,

item_ausbi LIKE stru_i_p0022-ausbi.

  • navigate from <CONTEXT> to <CHANGING> via lead selection

node_changing = wd_context->get_child_node( name = if_edu_detail=>wdctx_changing ).

  • navigate from <CHANGING> to <I_P0022> via lead selection

node_i_p0022 = node_changing->get_child_node( name = if_edu_detail=>wdctx_i_p0022 ).

  • @TODO handle not set lead selection

IF ( node_i_p0022 IS INITIAL ).

ENDIF.

  • get element via lead selection

elem_i_p0022 = node_i_p0022->get_element( ).

  • @TODO handle not set lead selection

IF ( elem_i_p0022 IS INITIAL ).

ENDIF.

  • get single attribute

elem_i_p0022->get_attribute(

EXPORTING

name = `AUSBI`

IMPORTING

value = item_ausbi ).

Now , my problem is item_ausbi always shows the value stored in attribute. I am populating value of the attribute using Component controller (referring BAPI). Hence whenevr I debug this code, I always get value coming from model. But i require to capture the value the user modified on the click of 'ENTER' key.

Regards,

Murali.