‎2007 Jun 18 3:56 PM
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
‎2007 Jun 18 4:14 PM
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
‎2007 Jun 19 9:09 AM
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