Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

[DOM] Put input value into a new node

Former Member
0 Likes
457

Hey,

trying XI Mapping with ABAP. I want to create a new node filled with the

value of another node. Using the the <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/86/8280db12d511d5991b00508b6b8b11/frameset.htm">XML libary</a> of SAP for this.

First I tried this:

<i>

  • get message content of tag <carrid>

DATA: carrid TYPE REF TO if_ixml_node_collection.

carrid = idocument->get_elements_by_tag_name( 'carrid' ).

...

  • add carrid node to the output document

  • DATA: outcode1 TYPE REF TO if_ixml_node.

  • outcode1 = carrid->get_item( index = 0 ).

  • irc = flight_key->append_child( outcode1 ).

</i>

But this copy node value AND node name, but my new node should be renamed.

Next I tried this:

<i>

DATA: element TYPE REF TO if_ixml_element,

aline value 'AZ'.

element = odocument->create_simple_element(

name = 'AIRLINEID'

value = aline

parent = flight_key ).

</i>

But for value he seems not to accept a variable.

Any ideas how to do this?

thx

chris

2 REPLIES 2
Read only

former_member194669
Active Contributor
0 Likes
391

Hi,

May be like this way.



DATA: element TYPE REF TO if_ixml_element.

Data : l_value           TYPE string.
i_value = 'AZ'.

element = odocument->create_simple_element(
name = 'AIRLINEID'
value = i_value
parent = flight_key ).

aRs

Read only

0 Likes
391

Hey,

of course you have to use "TYPE string" for this. I tried this with

TYPE c and that doesn't work. Thanks for this.

Next problem is to fill this variable with a dynamic value.

l_value = 'AZ' is not a problem, but how to read values from DOM node?

I tried this:

<i>

  • get message content of tag <carrid>

DATA: carrid TYPE REF TO if_ixml_node_collection.

carrid = idocument->get_elements_by_tag_name( 'carrid' ).

Data : t1 type REF TO if_ixml_node.

t1 = carrid->get_item( index = 0 ).

l_value = t1->get_value().

</i>

But he says that format and field lenght are not supported

This is, because I first have to find the text node. How to do this best?

thanks

Message was edited by:

Christian Riekenberg