cancel
Showing results for 
Search instead for 
Did you mean: 

clear inputfield

Former Member
0 Kudos

Hi,

Created two views, first view having inputfield(vbak-vbeln), Second view havinf table of vbap.

When enter vbeln in first screen and getting corresponding values of vbeln in second screen from table vbap.

When I back to first view through outbound plug of second screen(i,e Back button).

When I am enter different value in first screen but i am getting same information in second screen of previous vbeln.(i.e not getting correct information).

Code as follows

Second screen WDDOINT Method

method WDDOINIT .

DATA lo_nd_vbak TYPE REF TO if_wd_context_node.

DATA lo_el_vbak TYPE REF TO if_wd_context_element.

DATA ls_vbak TYPE wd_this->element_vbak.

DATA lv_vbeln LIKE ls_vbak-vbeln.

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

lo_nd_vbak = wd_context->get_child_node( name = wd_this->wdctx_vbak ).

  • get element via lead selection

lo_el_vbak = lo_nd_vbak->get_element( ).

clear lv_vbeln.

  • get single attribute

lo_el_vbak->get_attribute(

EXPORTING

name = `VBELN`

IMPORTING

value = lv_vbeln ).

DATA lo_nd_vbap TYPE REF TO if_wd_context_node.

DATA lo_el_vbap TYPE REF TO if_wd_context_element.

DATA ls_vbap TYPE wd_this->elements_vbap.

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

lo_nd_vbap = wd_context->get_child_node( name = wd_this->wdctx_vbap ).

  • @TODO handle not set lead selection

IF lo_nd_vbap IS INITIAL.

ENDIF.

  • get element via lead selection

lo_el_vbap = lo_nd_vbap->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_vbap IS INITIAL.

ENDIF.

  • alternative access via index

  • lo_el_vbap = lo_nd_vbap->get_element( index = 1 ).

  • @TODO handle non existant child

  • IF lo_el_vbap IS INITIAL.

  • ENDIF.

  • get all declared attributes

  • lo_el_vbap->get_static_attributes(

  • IMPORTING

  • static_attributes = ls_vbap ).

select * from vbap into table ls_vbap where vbeln = lv_vbeln.

lo_nd_vbap->bind_table( ls_vbap ).

clear ls_vbap.

endmethod.

Thanks,

Asha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Instead of doing the coding in the WDINIT method do the coding in the handler method of the plug.

and after the coding clear the attribute which is bound to the inputfield.

for that you need declare the context in Componentcontroller and map them in both the view.

thanks,

Subhasis.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Asha,

You have written the code in WDDOINIT method thats is why it is not displaying the correct data for second time.

The code written in the WDDOINIT method is executed only for the first time so for the second time when you are trying to display data for some other value it is showing you the same previous data.

So, instead of writing the code in WDDOINIT you create an action for your button( on click of which the next view is called), and write the same code there. This will solve your problem.

Regards

Madhu.

Former Member
0 Kudos

Hi Asha,

Try your code of WDDOINIT of Second Screen in the inbound plug of the second screen.

I hope this will solve your problem.

Regards,

Shweta

Former Member
0 Kudos

Hi asha,

Check the data which you are entering in the input field with the VBAK table.

Regards,

Sravanthi

Pramanan
Active Participant
0 Kudos

Dear asha,

On you Backward navigation invalidate the node lo_nd_vbap.

lo_nd_vbap->invalidate( ).

Former Member
0 Kudos

Hi Asha,

Here you need to convey or retrospect two things:

1. Where does the Node declaration for the INput field exist?

2. Where did you write the code of fetching the IP value entered on the first screen?

The solutions is as follows:

1. Create a common node in the component controller, and use the same node in both the views.

By changing the data in the first view will be reflected in the second view too..

2. Dont write the code in the WDDOINIT of the second view to fetch the data from the first view. It will be only called once in Request/Response Cycle.

3. You better write the code for populating the IP in the second view in the Inbound plug method created for it. This Inbound plug contains a method and do incorporate your code here.

Henceforht you will be able to see the updated IP field value in the second view too.

Hope it helps,

Regards.

Shashikanth. D