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

XML file

Former Member
0 Likes
420

Hello guys,

I ve a XML file, can I upload it into SAP and get all the tags present in the XML file into one single line.

Eg: If i have 10 tags in 10 different lines, can I do something in SAP to get all the 10 tags into a single line?

Regards,

Greg

2 REPLIES 2
Read only

Former Member
0 Likes
364

hi,

try this,

DATA: xml_data TYPE xstring,

lt_xml_data TYPE STANDARD TABLE OF xstring.

APPEND xml_data TO lt_xml_data.

lo_pdfobj->get_data(

IMPORTING

formdata = xml_data ).

  • Convert XML data from XSTRING format to STRING format

DATA: lv_xml_data_string TYPE string.

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'

EXPORTING

im_xstring = xml_data

IMPORTING

ex_string = lv_xml_data_string.

  • Remove NEW-LINE character from XML data in STRING format

CLASS cl_abap_char_utilities DEFINITION LOAD.

REPLACE ALL OCCURENCES OF cl_abap_char_utilities=>newline IN

lv_xml_data_string WITH ''.

  • Make the XML envelope compliant with identity transform

REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'

IN lv_xml_data_string

WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns

:asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.

REPLACE '</data>'

IN lv_xml_data_string

WITH '</asx:values></asx:abap>'.

  • Apply the identity transform and convert XML into ABAP in one step

DATA: wa_VNDBNK type ZVK_VNDBNK VALUE IS INITIAL,

wa_VENDOR type ZHD_VENDOR value is initial,

lv_subrc TYPE sysubrc VALUE IS INITIAL,

lt_messtab TYPE STANDARD TABLE OF bdcmsgcoll,

l_key type SWR_STRUCT-OBJECT_KEY,

l_pack type zhd_vendor-lifnr.

CALL TRANSFORMATION id

SOURCE XML lv_xml_data_string

RESULT Z_VNDBNK = wa_vndbnk.

Regards,

Arunsri

Edited by: Arunsri on Sep 17, 2009 1:00 PM

Read only

Former Member
0 Likes
364

HeY Arun,

Thanks for your reply. Unfortunately this doesnot seem to work. I getting error 'lo_pdfobj Un´known'

regards,

greg