The fist time I looked at SAP XI,
I searched for the best way to
perform value mapping with data from SAP. Today we can use XSLT mapping
at the ABAP core in SAP XI 3.0 with the best solution there is: ABAP
XSLT extensions. In this weblog I will show you how easy it can be done
to use SAP Abap functions in your XSLT.
An XSLT Mapping
Before focussing on the
sap data we will focus on the XSLT
itself. We want to translate source of system A into target structure B.
Source System A:
Target System B
If we compare the XSLT result with
the needed xml for system B, we have
a value mismatch at the tags Title and Country. We will use
SAP XSLT extensions to solve this problem.
A basic SAP XSLT Mapping
When the XSLT mapping is ready, we
can create a XSLT transformation at
the SAP XI Abap core. With transaction XSLT_TOOL we start the
SAP XSLT Editor.
After pushing the
“Create” button, we have to fill out the following
pop-up. It is important to choose ‘XSLT Program’ as
We proceed to the tab
‘SourceCode’ and copy the generated XSLT from our
XSTL tool into de editor field. After this we can activate the
Testing the SAP XSLT Mapping
Before we continue, we have to
test the transformation within SAP. This is important because SAP XSLT
is based on the XSLT 1.0 standard, but SAP didn’t support all
features of the XSLT 1.0 standard at the ABAP stack. SAP has
also added some features of the XSLT 2.0 standard. More info can be
found in SAP XSLT Processor
Reference from SAP help.
Before testing can be done we have
to save the System A xml into a file on our local PC. From
the XSLT Editor we enter the SAP XSLT test tool by pressing the 
button. We can also go directly to the tool starting transaction XSLT.
We have to fill out the source
path of the xml System A file and press the button “View
HTML”. If SAP supports all features of the XSLT,
you will get the same result as in the external XSLT tool.
Now we are ready for the SAP Extensions.
Using SAP XSLT Extensions
In the sap help we found the
We will use these to solve our
We choose as a class
type for an ‘usual ABAP Class’. The instantiation will be ‘public’ and
the class will be marked as ‘final’.
Now we add a public static method
named ‘GETCOUNTRY’ to the class.
We declare the importing and
returning parameters and implement the method.
Use the XSLT Mapping within SAP XI 3.0
Having done all this our XSLT
Mapping program ‘Z_SDN_SYSTEM_A_TO_B’ with SAP XSLT Extensions at the
ABAP engine is ready for use in SAP XI.