Skip to Content
0
Mar 08, 2013 at 03:29 PM

Filling data in 2 views from event onEnter on InputField

20 Views

Hi,

I am working on a requirement for showing all data from a WBS number in 2 views. As I see it, I have to place my code for both views

in the onEnter event for my inputfield UI Element. However, I have the problem that my WBS number in the inputfield disappears after

hitting Enter. The data is populated ok, though.

Is there an alternative way to this than using the onEnter event for the inputfield ?

If so, I would like to hear and I have attached my code the onEnter event below:

method onactionfind .

* This action is activated on pressing ENTER after entering WBS number

data: node_node_wbs type ref to if_wd_context_node,
elem_node_wbs type ref to if_wd_context_element,
stru_node_wbs type if_input_view=>element_node_wbs .

* navigate from <CONTEXT> to <NODE_WBS> via lead selection

node_node_wbs = wd_context->get_child_node( name = if_input_view=>wdctx_node_wbs ).

* get element via lead selection

elem_node_wbs = node_node_wbs->get_element( ).

* get all declared attributes

elem_node_wbs->get_static_attributes(
importing
static_attributes = stru_node_wbs ).



data: ls_where(72) type c,
lt_where like table of ls_where,
lt_wbs type standard table of zstr_empwbs.


if not stru_node_wbs-pspnr eq ''.
concatenate 'PSPNR = ''' stru_node_wbs-pspnr '''' into ls_where.
append ls_where to lt_where.
endif.

* Search data for WBS

select pernr pspnr sdatum edatum ename
from zhr_empwbs
into corresponding fields of table lt_wbs
where (lt_where).


data:
node_node_alv type ref to if_wd_context_node,
stru_node_alv type if_input_view=>element_node_alv.

*

** Navigate

*
node_node_alv = wd_context->get_child_node( name = if_input_view=>wdctx_node_alv ).

* Bind data to node table
node_node_alv->bind_table( lt_wbs ).

* Handling af "header" data info for WBS number

data: context_node type ref to if_wd_context_node,
ld_pspnr type prps-pspnr,
wa_userdet type if_input_view=>element_node_wbs.

* Retrieve value of webDynpro field

context_node = wd_context->get_child_node( name = 'NODE_WBS').
context_node->get_attribute( exporting name = 'PSPNR'
importing value = ld_pspnr ).

if not ld_pspnr is initial.
select single post1
from prps
into corresponding fields of wa_userdet
where pspnr = ld_pspnr.
endif.



* Populate webDynpro field(s)

context_node = wd_context->get_child_node( name = 'NODE_WBS').
context_node->bind_structure( wa_userdet ).







**



endmethod.