Application Development 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: 

Simple Transformation source type internal table, Is it possible ?

Former Member
0 Kudos

Dear all,

I have problem that source xml paramter in simple transformation is only have two options. Use string or xstring.

The problem is my xml file size is 5MB and when it uploaded to SAP is become 1100 rows of string format(4096). Is it possible to use internal table passing to Source XML in ABAP simple transformation ?

CALL TRANSFORMATION zbga_transform

SOURCE

XML d_string

RESULT

itab = itab.

Regards

Deny

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Deny

Looking at the ABAP keyword documentation (on ERP 6.0) of CALL TRANSFORMATION I would say that it should work:


Addition 1a 
... SOURCE {XML sxml}|{{bn1 = e1 bn2 = e2 ...}|(stab)} 


Effect 
Source Specification 



Transformation of an XML Document 



When you specify XML sxml, the XML document contained in xsml is transformed, where sxml can have one of the following forms: 

Data object of type string and xstring or as a standard table with flat character-type row type,   " <<< apparently no restriction
Interface reference variable of type IF_IXML_ISTREAM, which points to an iXML input stream (only for XSLT), 
Interface reference variable of type IF_IXML_NODE, which points to an iXML nodeset (only for XSLT), 
Class reference variable of type CL_FX_READER, which points to an XML reader (only for ST). 
...

Regards

Uwe

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos

Hello Deny

Looking at the ABAP keyword documentation (on ERP 6.0) of CALL TRANSFORMATION I would say that it should work:


Addition 1a 
... SOURCE {XML sxml}|{{bn1 = e1 bn2 = e2 ...}|(stab)} 


Effect 
Source Specification 



Transformation of an XML Document 



When you specify XML sxml, the XML document contained in xsml is transformed, where sxml can have one of the following forms: 

Data object of type string and xstring or as a standard table with flat character-type row type,   " <<< apparently no restriction
Interface reference variable of type IF_IXML_ISTREAM, which points to an iXML input stream (only for XSLT), 
Interface reference variable of type IF_IXML_NODE, which points to an iXML nodeset (only for XSLT), 
Class reference variable of type CL_FX_READER, which points to an XML reader (only for ST). 
...

Regards

Uwe

Former Member
0 Kudos

Dear Uwe

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filename

filetype = 'BIN'

IMPORTING

filelength = filelength

TABLES

data_tab = srctab

EXCEPTIONS

OTHERS = 1.

len = filelength.

LOOP AT srctab INTO wa_srctab.

IF len <= line_size. EXIT. ENDIF.

CONCATENATE d_xstring wa_srctab(line_size)

INTO d_xstring IN BYTE MODE.

len = len - line_size.

ENDLOOP.

IF len > 0.

CONCATENATE d_xstring wa_srctab(len)

INTO d_xstring IN BYTE MODE.

len = len - size.

ENDIF.

CALL METHOD cl_fx_reader=>create

EXPORTING

input = d_xstring

RECEIVING

reader = ob_reader.

CALL TRANSFORMATION zbga_transform

SOURCE

XML ob_reader

RESULT

itab = itab.

But still doesn't work.

Regards

Deny

Former Member
0 Kudos

Dear Uwe,

I already solved xml read problem. Previous problem come from

CONCATENATE xmlstr_src wa_srctab(line_size)

INTO xmlstr_src IN BYTE MODE.

when I used 1049 it always uncompleted tag in string but after change to 255 it already work.

here is the complete source

Thanks for your comment

Deny

&----


*& Report YXML_READ

*&

&----


*&

*&

&----


REPORT yxml_read.

PARAMETERS: srcpath TYPE localfile MEMORY ID sxslt_src.

CONSTANTS: line_size TYPE i VALUE 255.

TYPES: t_xmllin_src(255) TYPE x,

t_xmltab_src TYPE STANDARD TABLE OF t_xmllin_src,

tsrclin(4096) TYPE x,

tsrctab TYPE STANDARD TABLE OF tsrclin.

DATA: filelength TYPE i,

srctab TYPE tsrctab,

wa_srctab TYPE tsrclin,

xmltab_src TYPE t_xmltab_src,

xmlstr_src TYPE xstring,

filename TYPE string,

size TYPE sytabix VALUE '99999999',

itab TYPE TABLE OF zrow.

DATA: len TYPE i.

START-OF-SELECTION.

filename = srcpath.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = filename

filetype = 'BIN'

IMPORTING

filelength = filelength

TABLES

data_tab = xmltab_src

EXCEPTIONS

OTHERS = 1.

len = filelength.

LOOP AT xmltab_src into wa_srctab.

IF len <= line_size. EXIT. ENDIF.

CONCATENATE xmlstr_src wa_srctab(line_size)

INTO xmlstr_src IN BYTE MODE.

len = len - line_size.

ENDLOOP.

IF len > 0.

CONCATENATE xmlstr_src wa_srctab(len)

INTO xmlstr_src IN BYTE MODE.

len = len - size.

ENDIF.

CALL TRANSFORMATION zbga_transform

SOURCE

XML xmlstr_src

RESULT

itab = itab.