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 conversion

Former Member
0 Likes
1,268

Hello Abapers,

I am trying to convert some field values of certain tables to xml format.It is coming correctly for one table.When i am trying for two or more tables the xml file is breaking in the middle.I tried adjusting the size of internal table which holds the file.But its not working. I am using CALL TRANSFORMATION syntax for converting to xml format.Please help me out in solving this issue.

Thanks ,

Helma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,117

Hi,

Are you getting any exception ? If you are getting any one among the below mentioned exceptions then you need to check the data present in your source internal table.

The following data objects cannot be serialized and trigger a treatable exception:

Data objects of type n, whose current content does not exclusively consist of numbers.

Data objects of type p, whose current content does not represent a valid packed number.

Data objects of type d and t, whose current content contains leading or trailing blanks and, at the same time, uses the separators ("-" or ":") according to ISO-8601 for the presentation.

Data reference variables pointing to data objects, whose data type has only a technical name.

Data reference variables pointing to data objects that were not created with CREATE DATA are treated as initial reference variables during the serialization.

So, please check your source data and do the modifications as per your requirement.

Hope this information may help in resolving your issue.

Kind Regards,

Raghavendra Kulkarni.

9 REPLIES 9
Read only

Former Member
0 Likes
1,118

Hi,

Are you getting any exception ? If you are getting any one among the below mentioned exceptions then you need to check the data present in your source internal table.

The following data objects cannot be serialized and trigger a treatable exception:

Data objects of type n, whose current content does not exclusively consist of numbers.

Data objects of type p, whose current content does not represent a valid packed number.

Data objects of type d and t, whose current content contains leading or trailing blanks and, at the same time, uses the separators ("-" or ":") according to ISO-8601 for the presentation.

Data reference variables pointing to data objects, whose data type has only a technical name.

Data reference variables pointing to data objects that were not created with CREATE DATA are treated as initial reference variables during the serialization.

So, please check your source data and do the modifications as per your requirement.

Hope this information may help in resolving your issue.

Kind Regards,

Raghavendra Kulkarni.

Read only

0 Likes
1,117

Thank you for your prompt reply."Invalid at the top level of the document " this error is coming up while opening the file.But in my internal table two tables are getting filled.

Read only

0 Likes
1,117

Hi,

Let us try in this way, as you have mentioned that while working with one internal table you could able to achieve the required XML. So, why cant move all the information present in one or more internal table into single internal table and try doing the transformation.

Hope, this may help in resolving the issue.

Kind Regards,

Raghavendra Kulkarni.

Read only

0 Likes
1,117

Hi ,

I have already tried this way.But the problem is that we cannot differentiate the table name and fields.Since we are passing everthing into one internal table and converting into xml.

Regards,

Helma

Read only

Former Member
0 Likes
1,117

Hello,

1.Fetch al the fields into an iternal table.

2.As said you have multiple tables.

3.So loop at the table and call the call transaformation.

4.You also have 2 FMs "DOM-->Which is used to create the Dom object.

5.The FM "DOm_XML" is used to conevert to xml files.

6.please check if the table name has "/" in it,if it does then the XML files doest generate.

Read only

0 Likes
1,117

Hi Vadanalav,

In the internal table the xml version is coming up like this.First, table name then corresponding fileds again it ends with \ table name. If \ comes up in table name can we use the function module DOM_XML ?

Read only

0 Likes
1,117

Hi,

After your call transformation use the below code.

CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
    EXPORTING
      i_string         = xml_out
      i_tabline_length = 100
    TABLES
      et_table         = xmltable

Adjust i_tabline_length according to your requirement and check.

Cheers,

Raja.D

Read only

0 Likes
1,117

Hi,

Instead of that function module i am using this function module.I think there is no much difference between both.

CALL FUNCTION 'SCMS_STRING_TO_FTEXT'

EXPORTING

text = out4

  • IMPORTING

  • LENGTH = lv_length

TABLES

ftext_tab = itab1.

But still i tried your suggestion also it is not working.

Read only

Former Member
0 Likes
1,117

Hi,

Thanks for everyone who helped me out by giving various suggestions.Finally i found out the solution.

In CALL TRANSFORMATION syntax itself i am passing all the tables like this :

CALL TRANSFORMATION ('ID')

SOURCE tab = itab_tcurt[] tab1 = itab_t556b[] tab2 = itab_t555b[]

RESULT XML xml_out1.

CALL FUNCTION 'SCMS_STRING_TO_FTEXT'

EXPORTING

text = xml_out1

  • IMPORTING

  • LENGTH = lv_length

TABLES

ftext_tab = itab1.

Then this itab1 i am downloading.