cancel
Showing results for 
Search instead for 
Did you mean: 

How to append a element to a context node?

Former Member
0 Kudos

Hi, exports,

The following is my code:

method SETELEMENTTOSINGLECUSTOM .

***************************************************

*importing:

*ELEM_EE_ADDRESS TYPE REF TO IF_WD_CONTEXT_ELEMENT

*L_SINGLE_ADDR_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT

*L_COUNT TYPE I

*

*Notes:The structure of the ELEM_EE_ADDRESS is the same as *L_SINGLE_ADDR_ELEMENT.

********************************************************

DATA NODE_EE_ADDRESS TYPE REF TO IF_WD_CONTEXT_NODE.

DATA NODE_SINGLE_ADDR TYPE REF TO IF_WD_CONTEXT_NODE.

DATA NODE_SINGLE_COUNT TYPE I.

NODE_EE_ADDRESS = ELEM_EE_ADDRESS->GET_NODE( ).

NODE_SINGLE_ADDR = L_SINGLE_ADDR_ELEMENT->GET_NODE( ).

NODE_SINGLE_COUNT = NODE_SINGLE_ADDR->GET_ELEMENT_COUNT( ).

IF NODE_SINGLE_COUNT NE 0.

NODE_SINGLE_ADDR->REMOVE_ELEMENT( ELEMENT = L_SINGLE_ADDR_ELEMENT ).

if l_count ne 0.

  • APPEND ELEM_EE_ADDRESS TO NODE_SINGLE_ADDR.

  • Now, I want to APPEND ELEM_EE_ADDRESS TO NODE_SINGLE_ADDR, but I don't know how to write the code.

  • The structure of the ELEM_EE_ADDRESS is very large(There are 4000 attributes).

endif.

ENDIF.

endmethod.

Do you give me some some hints?

Thanks a lot.

Best regards,

Tao

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

if you want to replace all the values from your element with other ones

(this is what i can read in the coding)

you do node_single_addr->set_static_attributes( ls_attributes ).

with ls_attributes structure of the same type as your context node,

if you want to add another line to the lines you already have you do

node_single_addr->get_static_attributes_table( importing table = lt_attributes ).

append ls_attributes to lt_attributes.

node_single_addr->bind_table( lt_attributes ).

again ls_attributes with line type of node and lt_attributes table of linetype

grtz,

Koen

Former Member
0 Kudos

Hi, Anuj,

Thank you for your help in advance.

The following is the code that has been modified:

method SETELEMENTTOSINGLECUSTOM .

***************************************************

*importing:

*ELEM_EE_ADDRESS TYPE REF TO IF_WD_CONTEXT_ELEMENT

*L_SINGLE_ADDR_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT

*L_COUNT TYPE I

*

*Notes:The structure of the ELEM_EE_ADDRESS is the same as *L_SINGLE_ADDR_ELEMENT.

********************************************************

DATA NODE_EE_ADDRESS TYPE REF TO IF_WD_CONTEXT_NODE.

DATA NODE_SINGLE_ADDR TYPE REF TO IF_WD_CONTEXT_NODE.

DATA NODE_SINGLE_COUNT TYPE I.

NODE_EE_ADDRESS = ELEM_EE_ADDRESS->GET_NODE( ).

NODE_SINGLE_ADDR = L_SINGLE_ADDR_ELEMENT->GET_NODE( ).

NODE_SINGLE_COUNT = NODE_SINGLE_ADDR->GET_ELEMENT_COUNT( ).

IF NODE_SINGLE_COUNT NE 0 and l_count ne 0.

node_single_addr->set_static_attributes( ELEM_EE_ADDRESS ).

ENDIF.

endmethod.

But when I run the WDA for abap, the error occured:

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

The error occurred on the application server devserver_DEV_00 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WD_CONTEXT_ELEMENT~SET_STATIC_ATTRIBUTES of program CL_WDR_CONTEXT_ELEMENT========CP

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

Method: SETELEMENTTOSINGLECUSTOM of program /1BCWDY/1OHEMN83JFQ07JK6ZI5T==CP

Method: IF_ADDR_LIST_VIEW~SETELEMENTTOSINGLECUSTOM of program /1BCWDY/1OHEMN83JFQ07JK6ZI5T==CP

Method: BINDELEMENTTOSINGLECUSTOM of program /1BCWDY/1OHEMN83JFQ07JK6ZI5T==CP

Method: IF_ADDR_LIST_VIEW~BINDELEMENTTOSINGLECUSTOM of program /1BCWDY/1OHEMN83JFQ07JK6ZI5T==CP

Method: HANDLEFROM_MAIN_DATA_IN of program /1BCWDY/1OHEMN83JFQ07JK6ZI5T==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/1OHEMN83JFQ07JK6ZI5T==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: NAVIGATE of program CL_WDR_CLIENT_APPLICATION=====CP

whether I need change the ELEM_EE_ADDRESS to a line type? If so, How can I get the line_type created by the ELEM_EE_ADDRESS ?

Do you give me some some hints?

Thanks a lot.

Best regards,

tao

Former Member
0 Kudos

Hi, Anuj,

Thank you for your help in advance.

The following is the code that has been modified again:

method SETELEMENTTOSINGLECUSTOM .

***************************************************

*importing:

*ELEM_EE_ADDRESS TYPE REF TO IF_WD_CONTEXT_ELEMENT

*L_SINGLE_ADDR_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT

*L_COUNT TYPE I

*

*Notes:The structure of the ELEM_EE_ADDRESS is the same as *L_SINGLE_ADDR_ELEMENT.

********************************************************

DATA NODE_EE_ADDRESS TYPE REF TO IF_WD_CONTEXT_NODE.

DATA NODE_SINGLE_ADDR TYPE REF TO IF_WD_CONTEXT_NODE.

DATA NODE_SINGLE_COUNT TYPE I.

DATA STATIC_ATTRIBUTES TYPE zhress_p0006..

NODE_EE_ADDRESS = ELEM_EE_ADDRESS->GET_NODE( ).

NODE_SINGLE_ADDR = L_SINGLE_ADDR_ELEMENT->GET_NODE( ).

NODE_SINGLE_COUNT = NODE_SINGLE_ADDR->GET_ELEMENT_COUNT( ).

IF NODE_SINGLE_COUNT NE 0 and l_count ne 0.

ELEM_EE_ADDRESS->GET_STATIC_ATTRIBUTES( importing STATIC_ATTRIBUTES = STATIC_ATTRIBUTES ).

node_single_addr->set_static_attributes( STATIC_ATTRIBUTES ).

ENDIF.

endmethod.

This time, The WDA is running successfully.

Thanks a lot.

Best regards,

tao