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

Problem in XML file Read

Former Member
0 Likes
873

Hi Gurus,

1. In the code, CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD has been used

to uplaod the excel sheet data.

2. After upload,its been tried to convert the uploaded data to XML by following

code.

ixml = cl_ixml=>create( ).

xmlDoc = ixml->create_document( ).

streamFactory = ixml->CREATE_STREAM_FACTORY( ).

iStream = streamFactory->CREATE_ISTREAM_STRING( xmlString ).

iXMLParser = iXML->create_parser( stream_factory = streamFactory

istream = iStream

document = xmlDoc ).

iXMLParser->parse( ).

ixmlDocument = xmlDoc.

3. After creation of xmlDoc its trying to get root element from xml doc by

rootnode = if_ixml_document~get_root_element.

its not returning the root element reference to rootnode.

4. In method cl_ixml_document->if_ixml_document~get_root_element, its calling

below statement

system-call ixml

did 954859521

parameters

cl_ixml=>the_iXML

me

name

rval.

and rval has became null reference.

Could anyone help me to resolve this problem.

Thanks & Regards,

Bhuvana.

6 REPLIES 6
Read only

Former Member
0 Likes
776

Hello Tony,

U can use FM SAP_CONVERT_TO_XML_FORMAT to convert data to XML.

Or u can use some threads related to this FM. So that u can get better idea about this.

Check this link also

REgards,

Vasanth

Read only

0 Likes
776

Hi Vasanth,

I tried the function module and its dumping in the line inside the FM (line no 53)

l_oref_descr_source ?=

cl_abap_typedescr=>describe_by_data( <fs_temp_data> ).

I couldn't proceed. Can u suggest me ?

Thanks.

Read only

athavanraja
Active Contributor
0 Likes
776

do you want to convert the excel file to xml file or read the data in excel and convert that to xml.

if you want to convert excel file to xml (excel xml) the best option is to open the file in excel and saveas xml (excel xml) file.

if you want to just convert the data to xml.

gui_upload to upload excel file and read the data in to itab.

and then

use

call transformation key word to convert itab to xml

Read only

0 Likes
776

I have uploaded my excel file to SAP and converted into xml by the following way.

ixml = cl_ixml=>create( ).

xmlDoc = ixml->create_document( ).

streamFactory = ixml->CREATE_STREAM_FACTORY( ).

iStream = streamFactory->CREATE_ISTREAM_STRING( xmlString ).

iXMLParser = iXML->create_parser( stream_factory = streamFactory

istream = iStream

document = xmlDoc ).

iXMLParser->parse( ).

ixmlDocument = xmlDoc.

when I retrive the root node from ixmldocument its not returning the value in root node. (if_ixml_document~get_root_element. )

I tried call transformation as well. That statement also leeds to dump.

I tried the standard demo program (BCALV_TEST_FULLSCREEN) which is using call transformation. That is also dumping.

Could you please suggest me ?

Thanks

Read only

0 Likes
776

can you post your call transformation code.

(with relevent data declarations)

i dont see call transformation being used in BCALV_TEST_FULLSCREEN

whats the dump message

Read only

0 Likes
776

Hi,

Now I could able to execute the same program. But I couldn't get and node data from the imported file.

1. In the code, CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD has been used

to uplaod the excel sheet data.

2. After upload,its been tried to convert the uploaded data to XML by following

code.

ixml = cl_ixml=>create( ).

xmlDoc = ixml->create_document( ).

streamFactory = ixml->CREATE_STREAM_FACTORY( ).

iStream = streamFactory->CREATE_ISTREAM_STRING( xmlString ).

iXMLParser = iXML->create_parser( stream_factory = streamFactory

istream = iStream

document = xmlDoc ).

iXMLParser->parse( ).

ixmlDocument = xmlDoc.

3. After creation of xmlDoc its trying to get root element from xml doc by

<b>rootnode = if_ixml_document~get_root_element.

name = rootnode->get_attribute( 'name' ).</b>

I am not getting other node data also ?

I couldn't find where I am doing the mistake.

Can any one help me ?