RFC lookup using standard Function Module in PI mapping
What to expect?
This blog will help you to get rid of custom function module that we generally ask ABAPer to create to help us to do RFC lookup in PI mapping.
What not to expect?
This blog does not explain end to end steps for parameterized mapping since we already have many blogs on this topic.
Scenario
We have a mapping scenario where we want to fetch table data from SAP system using RFC lookup in PI mapping.
One way is to reach ABAP team and request them to write a custom Function Module for PI mapping but today we will see that how this can be achieved without any custom Function Module to fetch data from standard/custom table.
In other words, we will use standard function module “RFC_READ_TABLE” to fetch data from standard/custom table from SAP system.
Configuring the RFC lookup using standard FM.
Step1. Import the standard Function module “RFC_READ_TABLE” in ESR under your SWCV.
Step2. Go to message mapping conversions function and click on RFC lookup.
Step3. Select the standard RFC “RFC_READ_TABLE” as below:
Step4: Select the required input and output parameters by double clicking on the fields.
Step5. Pass the data as mentioned below:
A – This is the table name from which the data needs to be fetched. This can be standard/custom table name.
B– This function library is to generate the field name that needs to be fetched from the table and pass the required context. Please check the below queue log for more details. All the fields that needs to be fetched should be passed here.
C – This is the field delimiter that will be inserted between the output fields.
D – This is to generate the conditional statement (where clause). Please check queue log below for more details. All the fields can be passed as below to make sure all the required data is fetched from SAP in just one call for complete payload.
E – The output will be populated for all the fields passed in section ( B ) and the output will be separated with delimiter passed in section ( C ).
Queue log
Below is the queue log for all the input parameters and also the output data that has been fetched for table IMPTT and the output data is separated with comma as mentioned in column C. The output will contain all the data in different context for which the condition was true. You may handle the output data as per your requirement.
Now we are done with the configuration of RFC lookup where we will use standard function module to fetch data from SAP system and will not have to get any custom function module created for this task.
Hello,
Thanks for the tutorial. The function library fetchFields is it an UDF? could you please tell me more about this function? Thanks
While I fully understand the appeal of using a function for generic table access and have used it for uncritical scenarios without business exposure in the past, I would just like to point out that there are good reasons why you would typically want to use a BAPI or create a custom function module to access data in your SAP backend, one of the most important being granularity of authorization. RFC_READ_TABLE in particular is not a function I would recommend to anybody for productive use as it is not released to customers undermines common security concepts and comes with a lot of limitations, which you can read about in plenty of blog posts by just googling the name of the function.
I guess there are many important details missing in this blog
like which function library (custom UDF or some standard)?
More details about parameters passed to RFC lookup.
which UDF and parameter passed to value "D"?