I had a requirement in which I had to send a mail to the PO creator whenever the PO is rejected.
The PO is rejected in SRM server and the xml message which flows to XI consist of the PO details along with the PO number and the rejection indicator.
After the xml message reaching XI, based on the rejection indicator I had to trigger a mail to the PO creator.
I had the PO number with me using which I had to find the email id of the creator from R/3.
RFC is written in R/3 which find the email id of the creator given the PO Number.
RFC Function module: ZGETBUYER_EMAILID
Then a class is created in XI (named Z_GETBUYEREMAILID) having a method (GETBUYEREMAILID).
In the method I have remotely called the RFC function module created in R/3. As shown below.
Then goto transaction XSLT_TOOL and create the transformation. (ZPOREJECT)
Above is the XSLT-ABAP code that gets the PO creator email id from R/3 based on the PO number and assigned it to the ‘TO’ field of mail XSD.
Create the Interface mapping in XI where you specify this XLST-ABAP mapping program.