Skip to Content
Technical Articles
Author's profile photo Snehal Wankhade

Exploring SAP Profitability and Performance Management’s Remote Function Adapter – External Function Type

SAP Profitability and Performance Management (abbreviated as “PaPM” in this blog further)  Remote Function Adapter (RFA) function provides automated communication capabilities to other application and systems. Remote Function Adapter comes with different function types to set-up communication and posting. These vary from:

  • Posting of Finance AP, AR, GL entries
  • Calling external R script procedure
  • Calling HANA stored procedure
  • Integration scenario with SAP SD for creation of Sales Order, Inquiry or Quotation
  • Replicating CO Master Data
  • And External Function for calling remote NetWeaver function or a Web service

In this blog I am sharing one example to showcase the configuration of Remote function Adapter Function’s “External Function” type and its execution.

System Set-up:

Let’s assume that Database Connection and RFC destination is already in place as per Post Installation Steps Guide. (Ref. – )



Consider a scenario where we are running Allocations in PaPM system and want to post the results of allocations to SAP S/4HANA®. There is standard BAPI BAPI_ACC_MANUAL_ALLOC_POST available in SAP to Post Manual Cost Allocation. As this BAPI is not covered in standard Function Types of Remote Function Adapter, let’s configure RFA’s External Function to meet this requirement.

Steps in SAP PaPM:

It is assumed allocation function is already set up, activated and allocation results are available as output of this function. (The detailed steps for setting up Allocations Cycle is beyond Scope of this blog.)

  1. In the Modeling Environment, select Allocation function from the panel and click on Function Attribute


The function Attributes pop- up will appear. Navigate to Runtime Attribute tab and note down DDIC Table Name (this will be required in SAP S/4HANA system steps)

  1. Add Function in the environment in right node– Select Type as Remote Function Adapter, Enter Function ID, Description. You can keep remaining fields as defaults or as per your requirement.

Click OK.

Inside RFA function ZTRFA, select Remote Function Adapter Type as “External Function”. Enter RFC Connection where this External Function Belongs to. Select the function Name which you will be creating in SAP S/4HANA System (If External function is already available in the remote system, you can select the function from the search help provided with the Function Name field in PaPM)

Input Tab –

Select the Allocation Function whose results need to be posted in SAP S/4HANA as Input Function.

In Rules Tab –

Unlike other RFA types Rules tab in External Function Type does not contain mapping of the fields. Here there are 2 section provided, Template and Statement.

Template will give you construct of the remote function as catering to Input function provided in Input Tab. Note here, the function is Importing IS_AL and IT_DATA as importing parameters. IT_DATA is table of type DDIC objected created for Allocation Function (ZSNDM), containing fields from Allocation function in addition to some standard Technical Fields. Also, there is Changing section, where logs can be populated back to PaPM from SAP S/4HANA system. This is optional and can be included on need to need basis.

Statement will give source code of the FM created/available in SAP S/4HANA as selected in header. (At present we have not yet created FM in SAP S/4HANA, hence statement section is blank)

For a time being save the function, we will come back to this function activation once we complete the SAP S/4HANA steps.


Steps in SAP S/4HANA System:

Following steps need to be performed in SAP ERP or SAP S/4HANA system where remote function belongs to.

  1. Create table type of type DDIC table of Allocation Function. Use the DDIC table noted from previous steps for line type reference. Activate the table type.

       2. Create Function Module ZFM_POST_ALLOCATION

Add Importing Parameter IS_AL and IT_DATA as per Template generated in Remote Function adapter. For IT_DATA select associated type as table type created in previous step. Refer below screenshot.

Add changing parameters as CT_MSG, to get the logs of the BAPI execution back to PaPM.

The source code section can be modified/coded for meeting different requirements. Some example including but not limited to:

  • to call standard BAPI which is not provided out of box as RFA type in PaPM (this blog covering this)
  • to call a process chain on remote SAP BW system for Data Transfer requirement
  • Complex calculation coding which are not available as standard in PaPM

During Execution of Remote function Adapter function, the data from Allocation will be made available in this FM under IT_DATA. Which can be used for any of above development.


Sample Source Code Construct for calling Post Manual Allocation (BAPI_ACC_MANUAL_ALLOC_POST)


*"*"Local Interface:

* Data Declaration and Code to read it_data, 
* and map the fields to the BAPI's Import Paramaters as per Import, Export 
and tables

      doc_header = ls_header
      doc_no     = lv_docno
      doc_items  = lt_items[]
      return     = lt_return[].

* Code for Transaction commit as per need basis based on BAPI execution

* Code to Populate return messages from BAPI execution to CT_MSG, so that 
logs can be taken back to PaPM for analysis



Once Source code is written as per requirement. Activate the Function Module. Do not forget to create this FM as Remote Enabled Module from Attributes tab.


Back to SAP PaPM System:

In the environment navigate to the RFA created earlier. Click on Edit and Activate the RFA function. Once activated you will notice, the statements section in the Rules tab which was blank earlier now populated with the Source Code we written in the SAP S/4HANA system Function Module.


Now our RFA is ready for execution run and post the output of Allocation Function to SAP S/4HANA. For executing select the RFA and click on Run. Based on the source code in the Function Module you will get the results of ct_msg table in the execution Logs.

Results for the Post Manual Cost Allocation BAPI




So this way , we have seen the configuration and development steps for Remote Function Adapter External Function type. This functionality can be utilized in multiple business requirement where other function types have challenges. With this set up now you should be able to create wrapper for any of standard BAPIs, any Remote Function call, calling SAP BW(or SAP BW/4HANA) Data Transfer Process Chains and running complex calculation in an ABAP environment.




Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Michelle Crapo
      Michelle Crapo

      I like it.  Step by step is always welcome.  Are you using this on-premise or in the cloud?  I have not used a PaPm system.  It's interesting that you don't mark it as a remote function call.

      Author's profile photo Snehal Wankhade
      Snehal Wankhade
      Blog Post Author

      Thanks Michelle. I am using on-premise system for this, actually this is host agnostic. Marked it as RFC now.

      Author's profile photo Shyamnath Janardhanan
      Shyamnath Janardhanan

      Well explained and neatly documented, found it very useful. Thank you!

      Author's profile photo Xavier Mathivanan
      Xavier Mathivanan
      Fantastic Snehal. Very well explained. Great article!
      Author's profile photo Placido Pignataro
      Placido Pignataro

      Hi, thank you so much for this blog. But do you know if it is always necessary to create a custom BAPI and a custom table for this? For example I would like to use BAPI_PRICES_CONDITIONS but it looks like I can't just call the BAPI. I need to create a Z copy and then create the Z table as you did. It works, but I guess there should be a way to call a standard BAPI directly from PAPM without the need of any Z objects. Any comments would be much appreciated. Thanks! 🙂

      Author's profile photo Ravi Kolapalli
      Ravi Kolapalli

      Well explained Snehal. Can you please explain " do we need to activate /NXI/ services on the ECC system as I couldn't find /NXI/TP1AL structures when creating the FM. Please assit? Thanks