cancel
Showing results for 
Search instead for 
Did you mean: 

ALV not displaying

Former Member
0 Kudos

Hello everyone,

I'm having some difficulties in displaying an ALV, using the component SALV_WD_TABLE. I'm trying to follow the roadbook in one of the exercises provided by SAP. These are the characteristics of my application:

- it has a MAIN_WINDOW with a MAIN_VIEW.

- In the MAIN_VIEW i have a UI element Table, listing all data from node SFLIGHT of 0..n cardinality.

- In component controller, i defined the node SFLIGHT with subnode SBOOK, a singleton subnode of 0..n cardinality.

- I created a supply function to feed SBOOK that works fine (i tested by adding an UI table to list SBOOK results, and the supply function is always called to refresh the data)

- If i try to substitute the SBOOK table by an ALV, following every step provided (using view container, embedding table view of ALV usage, etc.), nothing is displayed.

- If i try to change the external mapping of node DATA from ALV component to SFLIGHT, the parent node, the ALV is displayed. So, it seems that the problem is in the fact that i want to display a subnode (that works fine if i use a table).

- I tried to debug in the supply fuction and i can see that it is only called once now, at initialization. The only difference now is that i deleted the table and added the ALV.

Can anyone give me a hint on how to solve this problem?

Regards,

Centeio

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I suspect that this is to do with the singleton and supply function. sbook would not exists until a sflight is selected.

You can try the following. Remove the external mapping.

Use the set_data method of the alv interface controller (from supply method )

[http://help.sap.com/saphelp_nw73/helpdata/en/49/3e09af347d3ef0e10000000a421937/content.htm|http://help.sap.com/saphelp_nw73/helpdata/en/49/3e09af347d3ef0e10000000a421937/content.htm]

Former Member
0 Kudos

Hello Baskaran,

I tried using set_data in the supply method of node BOOKINGTAB, after binding the node with the data i selected (as i showed in previous post). Code entered as follows:

 
  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  lo_interfacecontroller =   wd_this->wd_cpifc_alv_usage( ).

    lo_interfacecontroller->set_data(
      r_node_data = node      
    ).

But still no luck. Do you have any suggestion where i should put this code? I agree with you that this is a problem created by the fact that i'm using a singleton subnode in my parent node, but this was an exercise in SAP documentation! And there external mapping was used. I wonder if it was ever tested

Regards,

Centeio

PS - I debugged the supply method. Now, with only one UI table for parent node FLIGHTTAB, even after selecting row by row, the method is never called. Am i missing something for automatically summon the supply method correctly?

Edited by: Nuno Centeio on Apr 28, 2011 10:46 PM

Former Member
0 Kudos

Solved it on my own. The singleton subnode needs to have initial data. In the wddoinit method of the component controller i added a "mini-supply" with default values for the selection criteria.

If that doesn't happen, not even the ALV will be displayed!

Thank you all!

Answers (1)

Answers (1)

Former Member
0 Kudos

Not really sure why that would be happening....Can you paste your code so we can have a look?

Former Member
0 Kudos

Hello Josh,

Thank you for your reply. here's the code:

In Component controller, I have node FLIGHTAB with subnode BOOKINGTAB. The supply function is method BOOKINGS_READ:


  DATA ls_flighttab TYPE wd_this->element_flighttab.

  parent_element->get_static_attributes(
    IMPORTING
      static_attributes = ls_flighttab ).

  DATA lt_bookingtab TYPE wd_this->Elements_bookingtab.
  DATA ls_bookingtab LIKE LINE OF lt_bookingtab.

  SELECT * FROM sbook into CORRESPONDING FIELDS OF TABLE lt_bookingtab
    WHERE carrid EQ ls_flighttab-carrid
      AND connid EQ ls_flighttab-connid
      AND fldate EQ ls_flighttab-fldate.

  node->bind_table(
    new_items            =  lt_bookingtab
    set_initial_elements = abap_true ).

As i said, it works fine if i represent the BOOKINGTAB node in a table UI element.

Also in component controller, this is the method to fill node FLIGHTTAB, which is called in the MAIN_VIEW on an action performed by pressing a button. Node FLIGHINFO is of cardinality 1..1 and has selection criteria, with attributes like CARRID, CONNID and FLDATE. In this code i only added CARRID:


  DATA cond(100) TYPE c.
  DATA itab_where LIKE TABLE OF cond.
  DATA itab_flighttab TYPE TABLE OF sflight.
  DATA lo_nd_flightinfo TYPE REF TO if_wd_context_node.
  DATA lo_nd_flighttab TYPE REF TO if_wd_context_node.
  DATA lo_el_flightinfo TYPE REF TO if_wd_context_element.
  DATA ls_flightinfo TYPE wd_this->element_flightinfo.
  DATA lv_carrid LIKE ls_flightinfo-carrid.

  lo_nd_flightinfo = wd_context->get_child_node( name = wd_this->wdctx_flightinfo ).

lo_el_flightinfo = lo_nd_flightinfo->get_element(  ).

  lo_el_flightinfo->get_attribute(
    EXPORTING
      name =  `CARRID`
    IMPORTING
      value = lv_carrid ).

  CLEAR: cond.
  IF NOT lv_carrid IS INITIAL.
    CONCATENATE 'CARRID = ''' lv_carrid '''' INTO cond.
    APPEND cond TO itab_where.
  ENDIF.

  IF NOT itab_where IS INITIAL.
    SELECT * FROM sflight
      INTO CORRESPONDING FIELDS OF TABLE itab_flighttab
      WHERE (itab_where).
  ELSE.
    SELECT * FROM sflight
      INTO CORRESPONDING FIELDS OF TABLE itab_flighttab.
  ENDIF.

  lo_nd_flighttab = wd_context->get_child_node( name = wd_this->wdctx_flighttab ).

  lo_nd_flighttab->bind_table( new_items = itab_flighttab ).

Finally, as i said, i added the ALV component by the book, and it works if i use the parent node FLIGHTTAB. That for me is the weird part!

Thank you for any help,

Centeio