cancel
Showing results for 
Search instead for 
Did you mean: 

Short dump in WDA

former_member194669
Active Contributor
0 Kudos

Hi,

I have the following scenario, In my WDA i have 2 views 1 is for input values and another one is display contents in ALV.

I have the following code in for a button in the input view, after entering input values and press the button system will display records in the alv.

here is the code in the event ONACTIONACTION_FIND


method onactionaction_find .
  data: node_node_yy72n type ref to if_wd_context_node,
  elem_node_yy72n type ref to if_wd_context_element,
  stru_node_yy72n type if_yy72n_view=>element_yy72n.

  data : r_dcode type range of yy72n-dcode.
  data : r_tbrand type range of yy72n-tbrand.
  data : r_tline type range of yy72n-tline.

  data : r_dcode_wa like line of r_dcode.
  data : r_tbrand_wa like line of r_tbrand.
  data : r_tline_wa like line of r_tline.

  node_node_yy72n = wd_context->get_child_node( name = if_yy72n_view=>wdctx_yy72n ).
  elem_node_yy72n = node_node_yy72n->get_element( ).
  elem_node_yy72n->get_static_attributes(
  importing
  static_attributes = stru_node_yy72n ).
  data: ls_where(72) type c,
  lt_where like table of ls_where,
  lt_yy72n type standard table of yy72n.

  r_dcode_wa-sign = 'I'.
  r_dcode_wa-option = 'EQ'.
  r_dcode_wa-low = stru_node_yy72n-dcode.

  r_tbrand_wa-sign = 'I'.
  r_tbrand_wa-option = 'EQ'.
  r_tbrand_wa-low = stru_node_yy72n-tbrand.

  r_tline_wa-sign = 'I'.
  r_tline_wa-option = 'EQ'.
  r_tline_wa-low = stru_node_yy72n-tline.

  append r_dcode_wa to r_dcode.
  append r_tbrand_wa to r_tbrand.
  append r_tline_wa to r_tline.

  select * from yy72n into table lt_yy72n
       where designcode in r_dcode
         and truebrand in r_tbrand
         and tirelinext in r_tline.
  data:
  node_node_alv type ref to if_wd_context_node,
  stru_node_alv type if_yy72n_view=>elements_yy72n .
  node_node_alv = wd_context->get_child_node( name = if_yy72n_view=>wdctx_yy72n ).
  node_node_alv->bind_table( lt_yy72n )." Dump is coming in this line <<<<<<<

endmethod.

After pressing the button system giving a dump


Error analysis                                                                                
An exception occurred which is explained in detail below.                             
    The exception, which is assigned to class 'CX_WD_CONTEXT', was not caught and         
    therefore caused a runtime error.                                                     
    The reason for the exception is:                                                      
    Number of Elements of the Collection of Node COMPONENTCONTROLLER.1.YY72N              
    Violates the Cardinality.                                                                                

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try this code as per your req;

DATA lo_nd_node_yy72n TYPE REF TO if_wd_context_node.
  DATA lo_el_node_yy72n TYPE REF TO if_wd_context_element.
  DATA ls_node_yy72n TYPE wd_this->element_node_yy72n.
* navigate from <CONTEXT> to <NODE_YY72N> via lead selection
  lo_nd_node_yy72n = wd_context->get_child_node( name = wd_this->wdctx_node_yy72n ).
  data lt_yy72n TYPE wd_this->elements_node_yy72n.
* @TODO handle not set lead selection
  IF lo_nd_node_yy72n IS INITIAL.
  ENDIF.

* get element via lead selection
  lo_el_node_yy72n = lo_nd_node_yy72n->get_element(  ).


* get all declared attributes
  lo_el_node_yy72n->get_static_attributes(
    IMPORTING
      static_attributes = ls_node_yy72n ).


data: ls_where(72) type c,
  lt_where like table of ls_where,
  lt_yy72n type standard table of yy72n.
 
  r_dcode_wa-sign = 'I'.
  r_dcode_wa-option = 'EQ'.
  r_dcode_wa-low = ls_node_yy72n-dcode.
 
  r_tbrand_wa-sign = 'I'.
  r_tbrand_wa-option = 'EQ'.
  r_tbrand_wa-low = ls_node_yy72n-tbrand.
 
  r_tline_wa-sign = 'I'.
  r_tline_wa-option = 'EQ'.
  r_tline_wa-low = ls_node_yy72n-tline.
 
  append r_dcode_wa to r_dcode.
  append r_tbrand_wa to r_tbrand.
  append r_tline_wa to r_tline.
 
  select * from yy72n into table lt_yy72n
       where designcode in r_dcode
         and truebrand in r_tbrand
         and tirelinext in r_tline.

lo_nd_node_yy72n->bind_table( lt_yy72n ).

Now just check one thing, the data node of alv component should be bound to 'node_yy72n'

Hope this time it works.

former_member194669
Active Contributor
0 Kudos

Thanks its working,

My binding to node ALV was wrong.

Answers (1)

Answers (1)

Former Member
0 Kudos

check the cardinality on node_alv. change it to 0..n. If you have mapped the view context to comp controller context then first change the cardinality at component level and then come to the view cotext. Right click on the node and click 'update mapping'. Save and activiate the component.

Hope it works.

former_member194669
Active Contributor
0 Kudos

Thanks for your reply.

After changing the cardinality still i am getting the dump as


Number of Elements of the Collection of Node COMPONENTCONTROLLER.1.YY72N Violates the Cardinality. 

Former Member
0 Kudos

write your code like the template below. Before this you cardinality should be 0..n and the Alv data node should be bound to this node...the one which you are using bind_table.

DATA lo_nd_detail TYPE REF TO if_wd_context_node.
  DATA lo_el_detail TYPE REF TO if_wd_context_element.
  DATA ls_detail TYPE wd_this->element_detail.
*   navigate from <CONTEXT> to <DETAIL> via lead selection
  lo_nd_detail = wd_context->get_child_node( name = wd_this->wdctx_detail ).
  DATA: li_detail TYPE wd_this->elements_detail.


  SELECT * FROM spfli INTO TABLE li_detail.

  lo_nd_detail->bind_table( li_detail ).

You should bound the data property of alv compoenent to node_detail (node).

former_member194669
Active Contributor
0 Kudos

it didn't worked.

I have changed the cardinality & selection , still giving same dump.

Anyway thanks for your help.