SAP ST TT CALL-METHOD INSTANCE
Get Example source ABAP code based on a different SAP table
ARTICLE
Syntax
[writer = 'writer_para']
[reader = 'reader_para'] >
[<(><<)>tt:with-parameter [s-|d-]name='para1'
[ref='node1'|val='val1'|var='var1'] />
<(><<)>tt:with-parameter [s-|d-]name='para2'
[ref='node2'|val='val2'|var='var2'] />
...]
<(><<)>/tt:call-method>
Effect
Using this variant of the
You can use
Method execution, parameter passing, and optional attributes are subject to the same conditions as
Example
The following transformation calls an instance method
xmlns:tt='http://www.sap.com/transformation-templates'>
<(><<)>tt:root name='ROOT'/>
<(><<)>tt:parameter name='OPAR' ref-type='cls'/>
<(><<)>tt:variable name='result'/>
<(><<)>tt:template>
<(><<)>tt:call-method s-name='convert' var='OPAR'>
<(><<)>tt:with-parameter name='input' ref='ROOT'/>
<(><<)>tt:with-parameter name='result' var='result'/>
<(><<)>/tt:call-method>
<(><<)>Result>
<(><<)>tt:write var='result'/>
<(><<)>/Result>
<(><<)>/tt:template>
<(><<)>/tt:transform>
The following is an example of a calling ABAP program:
DATA oref TYPE REF TO cls.
DATA text TYPE string VALUE '1 2 3'.
DATA exc TYPE REF TO cx_st_call_method_error.
CREATE OBJECT oref.
TRY.
CALL TRANSFORMATION ...
SOURCE root = text
PARAMETERS opar = oref
RESULT XML xml_string.
cl_abap_browser=>show_xml( xml_string = xml_string ).
CATCH cx_st_call_method_error INTO exc.
...
ENDTRY.
A reference to an object of the required class is transferred with the addition
The method
result = input.
REPLACE ALL OCCURRENCES OF ` ` IN result WITH `-`.
ENDMETHOD.
The result of the transformation is as follows: