‎2009 Jan 08 9:10 AM
Hi,
I built DOM tree is there any way to have element values using XPATH. I am maintaing XPATH's in one of Ztables. Appreciate response.
Thanks,
Rao.Mallikarjuna
‎2009 Jan 08 1:06 PM
hi,
the following link can be very useful for the same.
http://www.w3schools.com/XPath/xpath_syntax.asp
hope it helps
‎2009 Jan 09 4:35 AM
Hello Rao
It would be helpful if you had described how you build your DOM tree.
However, on SAP-XI I use the following ABAP class mapping to modify a DOM tree (insert file generation number (FLGN) into an EDI TRADACOM93 invoice message):
METHOD MAP_FLGN.
* define local data
DATA: lo_node TYPE REF TO if_ixml_node,
lo_incode TYPE REF TO if_ixml_node_collection,
lo_child TYPE REF TO if_ixml_node,
*
ld_name TYPE string,
ld_value TYPE string,
ld_rc TYPE i,
ld_error_code type MPG_ERRCODE,
ld_msg TYPE string. " bapi_msg.
DATA: ld_param_name TYPE mpp_paramname,
ld_param_value TYPE string,
ls_record TYPE mpp_dynamic.
...
* NOTE: Structure of S_FIL segment (1st child = FLGN)
** <S_FIL>
** <FLGN>1133</FLGN>
** <FLVN>1</FLVN>
** <FLDT>080617</FLDT>
** <FLID />
** </S_FIL>
" NOTE: MO_DOCUMENT is TYPE REF TO if_ixml_document
* Get node collection of segment S_FIL (TRADACOM message)
CLEAR: lo_incode,
lo_node,
lo_child.
lo_incode = mo_document->get_elements_by_tag_name( mc_segedi_s_fil ).
ASSERT ID zedi
FIELDS 'lo_incode'
CONDITION ( lo_incode IS BOUND ).
lo_node = lo_incode->get_item( index = if_ixml_node=>co_node_xxx ).
lo_child = lo_node->get_first_child( ).
ld_name = lo_child->get_name( ).
ASSERT ID zedi
FIELDS ld_name
CONDITION ( ld_name = mc_flgn ).
* Set new File Generation Number (FLGN) into XML stream
CALL METHOD lo_child->set_value
EXPORTING
value = ld_value
RECEIVING
rval = ld_rc.
IF ( ld_rc NE 0 ).
...
Regards
Uwe
‎2009 Apr 07 6:10 PM
We can use SAP's Proxy Framework intenal classes to do this. Issue is resolved.
Thanks & Regards,
Rao.Mallikarjuna