cancel
Showing results for 
Search instead for 
Did you mean: 

ON_ALV_INSERT to control standard button for insert row in ALV comp

former_member210563
Participant
0 Kudos

HI,

I have an event-handler named ON_ALV_INSERT. I want to fill a value for PSPNR in my NODE_ALV.

The value is PSPNR and it should be read from my other node named NODE_WBS. It contains a WBS number.

The ON_ALV_INSERT has been created in NODE_ALV, so how can I fill the value from PSPNR from NODE_WBS ?

Here is my ON_ALV_INSERT event-handler:

method ON_ALV_INSERT .

* Control the event of "INSERT ROW"

  FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.
  DATA isempwbs TYPE REF TO zhr_empwbs.

  LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.
    isempwbs ?= <wa_row>-r_value.
    IF isempwbs->pspnr IS INITIAL.
      data:
        node_empwbs TYPE REF TO if_wd_context_node,
        elem_empwbs TYPE REF TO if_wd_context_element,
        stru_empwbs TYPE wd_this->element_node_alv.

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

      node_empwbs = wd_context->get_child_node( name = wd_this->wdctx_node_alv ).

* alternative access  via index
      elem_empwbs = node_empwbs->get_element( index = <wa_row>-index ).
      elem_empwbs->set_attribute(

        EXPORTING
          value = ???????  pspnr   "<---- Here I want PSPNR from NODE_WBS
          name  = 'PSPNR' ).

    ENDIF.

  ENDLOOP.





endmethod.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

instead of reading single attribute use whole line structure

1. in CTRL+F7 wizard select node not attribute select read radio button READ press enter you will get line structure as exporting parameter if method

  get_static_attributes .

   * get all declared attributes
      elem_empwbs->get_static_attributes(
        IMPORTING
          static_attributes = ls_elem_empwbs ).

2. now you will get whole line structure you can change this structure and again bind it with element using method SET_STATIC_ATTRIBUTES

   CALL METHOD elem_empwbs->set_static_attributes
*  EXPORTING
*    static_attributes = ls_elem_empwbs
    .

Answers (0)