Using the statementsap:call-external, you can perform ABAP calls with any number of return values from within an XSLT program.
These calls can take place both at the instance level of ABAP classes and at the class level itself. In the first case, therefore, instance methods are used; in the second, on the other hand, class methods are used.
Calling instance methods is performed according to the following syntax:
<sap:call-external name="prefix:localname" method="instanceMethod">
<sap:callvalue param="inParam1" select="expression"/>
<sap:callvalue param="inParam2" select="expression"/>
<sap:callvariable param="exParam1" name="varName1" type="xslType"/>
<sap:callvariable param="exParam2" name="varName2" type="xslType"/>
The statementsap:call-external can be at any position in the XSL source code where xsl:call-template is also allowed otherwise.
Calling an instance method requires the specification of an object name that identifies an ABAP object and the name of the method to be called.
Both sub-statementssap:callvalue and sap:callvariable are required for passing parameter values.
Conversion of the typesnumber and node-set, for example, into the corresponding ABAP values is performed according to the following scheme:
The values returned from the method call are bound to XSLT variables using the sub-statementsap:callvariable. Here the attribute param specifies the ABAP parameter name from the method definition. The attribute name, on the other hand, identifies the corresponding XSLT variable. In addition, the attribute type can be used to assign the resulting values to a particular XSLT type. Otherwise, the standard conversion is used.
Data of type C(1) is converted by default into an XSLT string. However, ifboolean is specified explicitly in the attribute type, the conversion is into XSLT boolean, accordingly.
Generally speaking, ABAP objects can also be specified as parameters.
Note that ABAP parameters of the type "changing" can be passed both using
When the class methods are called, the attributename is replaced by class. The value for class must be specified accordingly with the name of the ABAP class, and the value for method with the name of the required class method.
<sap:call-external "className" method="clasMethod">
The following example demonstrates an access to the R/3 database with which additional data is output for a selected flight connection. The call takes place using the class method GET_DETAIL for the class CL_FLIGHT_INFO.
The information received is bound to the corresponding XSLT variables (duration, distance, unit, ...) using sap:callvariable.
<sap:call-external "CL_FLIGHT_INFO" method="GET_DETAIL">
<sap:callvalue param="AIRLID" select="string($carr/@code)"/>
<sap:callvalue param="CONNID" select="string(@code)"/>
<sap:callvalue param="FLDATE" select="string(departure/date)"/>
<sap:callvariable param="FLIME" name="duration"/>
<sap:callvariable param="DIST" name="distance" type="number"/>
<sap:callvariable param="UNIT" name="unit"/>
<sap:callvariable param="PLTYPE" name="planetype"/>
<sap:callvariable param="SEATSM" name="seatsmax"/>