cancel
Showing results for 
Search instead for 
Did you mean: 

ALV in Web Dynpro

former_member210563
Participant
0 Kudos

Hi,

I have the following scenario:

I have an old ALV report that creates 2 sets of data for output in each one grid.

Now I am to make the ALV into a WD Component and it gives me problem.

I have defined to nodes NODE_CONT and NODE_RENG.

The context binding is done to each of the 2 structures.

I have defined the ALV Component in the WD component.

There are 2 views called INPUT_VIEW and MAIN. INPUT_VIEW is used for the search field for KUNNR and I have a button

for Search with an attached action method.

In view MAIN I have defined 2 ViewUIelementcontainers CONT1 and CONT2 as matrixheaddata.

Only CONT2 is filled with data and it is the only visible element at test.

The code  for the method  is here:

   METHOD onactionaction_find .

  DATA: node_node_kna1           TYPE REF TO if_wd_context_node,
        elem_node_kna1             TYPE REF TO if_wd_context_element,
        stru_node_kna1             TYPE if_input_view=>element_node_kna1.

  DATA: lt_container  TYPE TABLE OF zstatusplan_container,
        lt_cleaning   TYPE TABLE OF zstatusplan_cleaning.

* navigate from <CONTEXT> to <NODE_kna1> via lead selection
  node_node_kna1 = wd_context->get_child_node( name = if_input_view=>wdctx_node_kna1 ).

* get element via lead selection
  elem_node_kna1 = node_node_kna1->get_element).

* get all declared attributes
  elem_node_kna1->get_static_attributes(
    IMPORTING
      static_attributes = stru_node_kna1 ).


  DATA: ls_where(72) TYPE c,
        lt_where LIKE TABLE OF ls_where,
        lt_kna1 TYPE STANDARD TABLE OF kna1,
        lv_kunnr type kna1-kunnr.

* create where condition
  IF NOT stru_node_kna1-kunnr EQ ''.
    CONCATENATE 'KUNNR = ''' stru_node_kna1-kunnr '''' INTO ls_where.
    APPEND ls_where TO lt_where.
  ENDIF.


  SELECT kunnr
  FROM kna1 INTO TABLE lt_kna1 WHERE (lt_where).

*----------------------------------------------------------------------------*
* Call the original function module for data selections
*----------------------------------------------------------------------------*

  CALL FUNCTION 'Z_WASTEPLAN_NEW'
    EXPORTING
      cust_nbr         = stru_node_kna1-kunnr                   

    TABLES
      status_container = lt_container
      status_cleaning  = lt_cleaning.



  DATA:
    node_node_cont                       TYPE REF TO if_wd_context_node,          "Declaration Container
    stru_node_cont                       TYPE if_input_view=>element_node_cont,   "Declaration Container
    node_node_reng                       TYPE REF TO if_wd_context_node,          "Declaration Cleaning
    stru_node_reng                       TYPE if_input_view=>element_node_reng.   "Declaration Cleaning

** Handle data for Container begin

* Navigate from <CONTEXT> to <NODE_CONT> via lead selection
  node_node_cont = wd_context->get_child_node( name = if_input_view=>wdctx_node_cont ).


* Get data for all declared attributes in the structure for "container"
  node_node_cont->bind_table( lt_container ).

** Handle data for Container end

** Handle data for Cleaning begin

* Navigate from <CONTEXT> to <NODE_RENG> via lead selection
  node_node_reng = wd_context->get_child_node( name = if_input_view=>wdctx_node_reng ).


* Get data for all declared attributes in the structure for "Cleaning"
  node_node_reng->bind_table( lt_cleaning ).

** Handle data for Cleaning end



ENDMETHOD.

Can WD handle that an ALV component has 2 datasets for viewing as I only get data in one of them even though both itabs are filled correctly ?

Thanks for your input.

BR

Peter

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Peter,

If I understand correctly, you want to have two ALVs visible at the same time on view MAIN, with one ALV mapped to NODE_CONT and the other ALV mapped to NODE_RENG. Since you must map each of your nodes to a distinct DATA node within an ALV's interface controller context, you need to have two separate instances of the ALV component usage, one to be used by NODE_CONT and the other to be used by NODE_RENG. I'm not sure from your description if you're trying to map both of your nodes to a single ALV DATA node?

See Step 3.2 in document, .

Cheers,
Amy

former_member210563
Participant
0 Kudos

Hi and thanks for your reply,

In properties of my Component I have defined one "Used Component" with the name ALV_COMP with component = SALV_WD_TABLE = ALV Component.

Should I create one more instance of this for the second dataset ?

amy_king
Active Contributor
0 Kudos

Hi Peter,

Yes, you need two separate instances of the ALV object to display two separate datasets simultaneously.

Cheers,

Amy

Answers (0)