cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP and iXML

Former Member
0 Kudos
144

Does anybody know where to find a small ABAP program to compose a XML file via iXML library?.

Thanks in advance. Guillermo.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

HI,

can anyone send me the complete syntax of CALL TRANSFORMATION? I'm urgently looking for this information, but i can only find notes about creating, testing and debugging xslt-programs.

Rainer

athavanraja
Active Contributor
0 Kudos

The following is taken from ABAP key word documentation.

*********

CALL TRANSFORMATION

Basic form

CALL TRANSFORMATION trans|(name)

[PARAMETERS ...]

[OBJECTS ...]

SOURCE ...

RESULT ...

Extras:

1.... PARAMETERS p1 = ap1 ... | (ptab)

2. ... OBJECTS o1 = ap1 ... | (otab)

3a. ... SOURCE XML sxml

3b.... SOURCE sp1 = ap1 ... | (sptab)

4a. ... RESULT XML rxml

4b.... RESULT rp1 = ap1 ... | (rptab)

Effect

Calling a transformation trans. You specify the transformation trans either directly or as the content of a character-like field name.

Using a transformation, you can transform:

1. XML documents into XML documents

2. XML documents into ABAP program data (data objects and objects)

3. ABAP program data into XML documents

4. ABAP program data into ABAP program data

ABAP program data can be data objects or objects.

A transformation must be available as a repository object, and you maintain it in the Object Navigator of the ABAP Workbench via the path Edit object -> More objects -> XSL Transformation as an XSLT program.

Identical transformation (XML to XML) is supplied by SAP under the name ID. In the case of ABAP after XML, the result of the identical transformation is the canonical representation of ABAP data in an XML document (this is called serialization). In the case of XML after ABAP, you can use the identical transformation to construct ABAP data from the canonical representation in XML (this is called deserialization).

In the case of transformations with source ABAP data, the ABAP data is first transferred to the canonical representation in XML. This XML representation then serves as the source of the specified transformation. In the case of transformations with ABAP data as the result, the system constructs ABAP data from the result of the specified transformation, if this result represents a canonical representation in ABAP.

Addition 1

... PARAMETERS ( p1 = ap1 ... | (ptab) )

Effect

Using the optional addition PARAMETERS, you can pass parameters to the called transformation. pi are parameters defined in the transformation. api are the data objects in the ABAP program that are to be passed. These must be character-like in form. To pass the parameters dynamically, you can use an internal table called ptab of the type ABAP_TRANS_PARMBIND_TAB in the ABAP type group.

Note

The names of the parameters pi must be fully specified in upper case in the XSL transformation.

Addition 2

... OBJECTS ( o1 = ap1 ... | (otab) )

Effect

With the optional addition OBJECTS, you can pass objects references to the called transformation. oi are variables defined in the transformation that can be linked to object references and also allow you to call methods. api are the reference variables to be passed. To pass the parameters dynamically, you can use an internal table otab of the type ABAP_TRANS_OBJBIND_TAB of the type group ABAP.

Note

The names of the variables oi must be fully specified in upper case in the XSL transformation.

Addition 3a

... SOURCE XML sxml

Effect

Specification of the transformation source

Transfer the XML document sxml using addition 3a. The following three possibilities exist for specifiying sxml:

The XML document can be in an ABAP variable sxml of the type STRING or XSTRING or in an internal standard table sxml of the elementary line type C.

For sxml you specify an interface reference variable of the type IF_IXML_ISTREAM that points to an IXML input stream.

For sxml, you specify an interface reference variable of the type IF_IXML_NODE that points to an IXML node set.

Addition 3b

... SOURCE sp1 = ap1 ... | (sptab)

Effect

Specification of transformation source

ABAP data is transformed with addition 3b. The canonical XML representation of the ABAP data is generated and serves as the transformation input.

Use spi to specify the names of the ABAP data objects in XML format. Use api to specify suitable data objects, whose values are displayed in XML format. Instead of in a static parameter list, you can also transfer these dynamically as the content of an internal table with type ABAP_TRANS_SRCBIND_TAB from the type group ABAP.

Addition 4a

... RESULT XML rxml

Effect

Specification of the result of the transformation.

Use addition 4a to transform into the XML document rxml. For the specification of rxml, you have the following three options:

The XML document can be stored in an ABAP variable rxml of the type STRING or XSTRING, or in an internal standard table sxml of the elementary line type C.

For rxml, you specify an interface reference variable of the type IF_IXML_OSTREAM that points to an IXML output stream.

For rxml, you specify an interface reference variable of the type IF_IXML_DOCUMENT that points to an IXML document.

Addition 4b

... RESULT rp1 = ap1 ... | (rptab)

Effect

Specification of the result of the transformation.

Use addition 4b to transform into ABAP data. The prerequisite for this is that the result of the transformation displays ABAP data in canonical XML representation.

Using rpi, you specify the names of the ABAP data objects in XML representation form. Using api, you specify suitable ABAP data objects to which the values are passed in XML representation. These can also be passed dynamically as the content of an internal table of the type ABAP_TRANS_RESBIND_TAB from the ABAP type group instead of in a static parameter list.

Example

data SOURCE type I value 42.

data XML_RESULT type STRING.

call transformation id

source SOURCE = SOURCE

result xml XML_RESULT.

The ABAP field SOURCE is displayed in the canonical XML representation (serialization). The ABAP string RESULT contains the canonical XML representation.

Exceptions

Catchable Exceptions

CX_SY_CONVERSION_BASE64

Cause: Incorrect Base64 format

Runtime Error: CX_XSLT_METH_ERROR

CX_SY_CONV_ILLEGAL_DATE_TIME

Cause: Invalid date or invalid time

Runtime Error: CX_XSLT_METH_ERROR

Regards

Raja

Former Member
0 Kudos

Hi Mr. Raja,

thank you for sending me this documentation. I must look in my library, why i don't have this...

Regards,

Rainer.

Former Member
0 Kudos

Hi Rainer and others,

Could you please mention the logic/code used for converting data from ABAP program to XML file ..or could you send the link in the SAP library with this info.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

starting with Release 6.10, ABAP contains the statement CALL TRANSFORMATION for calling XSLT programs in order to transform ABAP data to XML and vice versa.

As of Release 6.40 you can also call Simple Transformations (ST) for that purpose.

Regards

Horst

Steven_UM
Contributor
0 Kudos

Hi,

Just display the development class where the iXML classes are residing in ... if I recall well there are some programs there which use the class ... Within the SAP Help there is some explanation as well how to use it ...

Hope this helps,

Steven