cancel
Showing results for 
Search instead for 
Did you mean: 

ALV with Dynamic context node: not working!

Former Member
0 Kudos

Hi All,

I have a requirement like I have to display three different structures in ALV one at a time.

For this I am dynamically creating nodes and their attributes using add_attribute method.

But I am not able to see ALV in the output.

following is the piece of my code:

DATA: lr_root_info TYPE REF TO if_wd_context_node_info,

lr_stat_info TYPE REF TO if_wd_context_node_info,

ls_attribute TYPE wdr_context_attribute_info.

  • Get meta data info of root context node**************

lr_root_info = wd_context->get_node_info( ).

  • Create node with name 'STA' (without attributes)***

CALL METHOD lr_root_info->add_new_child_node

EXPORTING

name = 'STA'

is_mandatory = abap_false

is_multiple = abap_true

is_mandatory_selection = abap_false

is_multiple_selection = abap_true

is_singleton = abap_true

is_initialize_lead_selection = abap_true

is_static = abap_false

RECEIVING

child_node_info = lr_stat_info.

Attribute 'SL_NO'.

ls_attribute-name = 'SL_NO'.

ls_attribute-type_name = 'STRING'.

ls_attribute-value_help_mode = '0'.

CALL METHOD lr_stat_info->add_attribute

EXPORTING

attribute_info = ls_attribute.

CLEAR ls_attribute.

  • Attribute 'COMPANY'.

ls_attribute-name = 'COMP'.

ls_attribute-type_name = 'char20'.

ls_attribute-value_help_mode = '0'.

CALL METHOD lr_stat_info->add_attribute

EXPORTING

attribute_info = ls_attribute.

CLEAR ls_attribute.

  • Bind data to node*************

CREATE DATA lo_strutab TYPE TABLE OF lty_itabo.

ASSIGN lo_strutab->* TO <tab>.

<tab> = itab_final.

lo_nd_table = wd_context->get_child_node( name = 'STA' ).

lo_nd_table->bind_table( <tab> ).

  • pass context node to ALV

lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).

lo_interfacecontroller->set_data(

r_node_data = lo_nd_table ).

But I do not have clue why its not working. Please let me know if we have to do some mapping to DATA context node ALV in this case.Please suggest me some way.

Thanks in advance.

Regards

Archana

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Archana,

Sorry for the dumb pointer but have you actually embedded SALV_WD_TABLE's TABLE view within your View Container element? Also try going through this [tutorial |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783]which discusses about using ALV with a Dynamic Context Node in Web Dynpro for ABAP. You might stumble across something that you have missed out.

Regards,

Uday

Former Member
0 Kudos

Yes Uday, I have embedded that one. I do not know where I have missed something.

Yes I will try this tutorial. Thanks.

Former Member
0 Kudos

I am getting following error guys.

Note :

The following error text was processed : Invalid operand type for the MOVE-CORRESPONDING statement.

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP

Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP

Method: EXECUTE of program CL_SALV_BS_SERVICE_MNGR_TABLE=CP

Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP

Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP

Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP

Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP

Please let me know why its happening.

Thanks

Archana

uday_gubbala2
Active Contributor
0 Kudos

Hi Archana,

Try going to ST22 and find out about the exact place where you got the error. Just check as to what source & target structures you are using in your MOVE-CORRESPONDING statement. You were earlier saying that your ALV isn't just getting displayed so you must have made some changes to it now to be getting this error. Just pate us the coding that you had tried adding recently.

Regards,

Uday

Former Member
0 Kudos

Hi

I have not added any new code. Its like if I pass one structure its not displaying the ALV. If I pass some other structure its giving me this run time error. Its a big mess I am working on it. In the mean while if you guys find out something please let me know.

Thanks & Regards

Archana

uday_gubbala2
Active Contributor
0 Kudos

Hi Archana,

Instead of adding each attribute 1 by 1 to the dynamic node try creating a dynamic structure. Then pass this structure to the STATIC_ELEMENT_RTTI parameter of add_new_child_node. This way you would be having a valid structure which you can use for binding purpose. Try going through Regina Breuer's coding in this [thread|;. She was trying to help Glenn who was facing the similar problem.

Regards,

Uday

Former Member
0 Kudos

Thanks a lot Uday.Its working fine now with the RTTI struct thing.

Answers (2)

Answers (2)

Former Member
0 Kudos

Refer this [https://www.sdn.sap.com/irj/sdn/nw-ui?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8] [original link is broken];.

Hope it helps!

Regards,

Radhika.

former_member230839
Participant
0 Kudos

Hi Archana,

You need to add the following code also.

l_value type ref to cl_salv_wd_config_table.

l_value = l_ref_interfacecontroller->get_model( ).

Regards,

Anil kumar G

Former Member
0 Kudos

Hi Anil,

I have added the code suggested by you. But still its not working.