Skip to Content

Free Programmed Input Help and SALV_WD_TABLE (ALV component)

I've created a Web Dynpro component, that uses the SALV_WD_TABLE component. In the context of the controller, I've a node with a number of elements. I've mapped the controller context to the view context of my compoennt (there is only one view). On one of those elements, I'm using a Freely Programmed Input Help. On others, I've used OVS, and these work fine.

The event handler for the input help component looks like this

  DATA lo_interfacecontroller TYPE REF TO ziwci_b09gc_costcentre_f4 .
  DATA l_costctr TYPE /bic/oilccostctr.

  DATA lo_nd_projects TYPE REF TO if_wd_context_node.

  DATA lo_el_projects TYPE REF TO if_wd_context_element.
  DATA ls_projects TYPE wd_this->element_projects.

  DATA lv_lcresctr TYPE wd_this->element_projects-lcresctr.

* Get selected from F4 value help
  lo_interfacecontroller = wd_this->wd_cpifc_cc_f4_usage( ).
  l_costctr = lo_interfacecontroller->get_selected( ).

* navigate from <CONTEXT> to <PROJECTS> via lead selection
  lo_nd_projects = wd_context->get_child_node( name = wd_this->wdctx_projects ).

* get element via lead selection
  lo_el_projects = lo_nd_projects->get_element( ).

* alternative access  via index
* lo_el_projects = lo_nd_projects->get_element( index = 1 ).

  lv_lcresctr = l_costctr.

* set single attribute
  lo_el_projects->set_attribute(
    name =  `LCRESCTR`
    value = lv_lcresctr ).

L_costctr is set fine. The problem is the lo_el_projects is always null, so I get a dump.

Any ideas?

matt

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Posted on May 05, 2011 at 12:18 PM

    if i understood correctly, project context is bound to ALV.

    and cost center is separate input field where we have done freely programmed f4 help.

    now what i dont see here is filling of context node projects ( with some values ), i guess this is the reason why it is always returning null.. is't it??

    Add comment
    10|10000 characters needed characters exceeded

    • I've resolved it.

      In the SET_VALUE_HELP_LISTENER method on the value help component, the parameter LISTENER has an attribute of f4_context_element. This is the context element from which the value help was triggered.

      I store this in an attribute of the value help component controller, and when I read the selected value, I also return the context.

        DATA lo_interfacecontroller TYPE REF TO ziwci_b09gc_costcentre_f4 .
        DATA l_costctr TYPE /bic/oilccostctr.
      
        DATA lo_el_projects TYPE REF TO if_wd_context_element.
        DATA ls_projects TYPE wd_this->element_projects.
      
      * Get selected from F4 value help
        lo_interfacecontroller = wd_this->wd_cpifc_cc_f4_usage( ).
        lo_interfacecontroller->get_selected( IMPORTING e_costctr  = l_costctr
                                                        er_context = lo_el_projects ). 
      
      * set single attribute
        lo_el_projects->set_attribute( name =  `LCRESCTR`
                                       value = l_costctr ).