Skip to Content
Technical Articles
Author's profile photo Katarzyna Leska

SD Mass Data Upload to SAP ERP or S/4 HANA Features Delivered by PaPM’s Remote Function Adapter

I would like to continue our blog series of Remote Function Adapter (RFA) delivered by SAP Profitability and Performance Management. As RFA FI-GL and RFA FI-GL Line items have already been discussed (please refer to Powerful Posting to SAP ERP or S/4 HANA Features Delivered by PaPM’s Remote Function Adapter – Part 1  /  Powerful Posting to SAP ERP or S/4 HANA Features Delivered by PaPM’s Remote Function Adapter – Part 2), let me please introduce the RFA Sales and Distribution (creation of Sales Orders in SAP).

SAP Business Processes Supported by RFA SD in Examples

As SAP Controlling consultant with some integration knowledge, I could imagine to use the RFA Sales and Distribution Function to optimise different invoicing processes, for example reinvoicing, invoicing of delivered services, retro-billing, cross company sales, calculation and posting of provisions of sales representatives and many others.
The big advantage of using SAP Profitability and Performance Management is that it is not limited to just the creation of SD customer orders. It also provides you the ability to use a variety of functions to calculate the values to be invoiced. The process could be connected with other RFA function types like RFA FI-GL, RFA FI-GL Line Items, RFA AP and RFA AR. All of these RFA function types are able to post not only cross company but also cross different clients within SAP System but also cross SAP Systems, once the RFC connections have been established in the correct way.

Retro-billing is a very good example of the usage of combined functions (calculation, RFA FI-GL Posting and RFA SD). By standard SAP process, the calculated rebates are usually posted using a dummy service material in the sales order. From SAP CO-PA (SAP Profitability Analysis) point of view, the information on the level of products sold are missed. Using SAP Profitability and Performance Management’s available functions, it is possible to generate the standard SD orders, and in parallel to post line items with the rebates on the level of SAP CO-PA (SAP Profitability Analysis) / FI profitability segments. This allows us to get also the correct information in the SAP COPA (SAP Profitability Analysis).

Configuration of RFA Sales and Distribution


Database Connection and RFC Destination

As already mentioned in the previous blog posts, written by my colleague, the first requirement would be to establish the RFC connection. The connection can be defined at the Environment level, in the Advanced tab. However, the creation of orders could be addressed to different SAP Systems / Clients ( RFC destinations). In that case the RFC destination should be provided in the Rules. The entry in the rule overwrites the entry in the Environment.

RFA SD Configuration

This is how we configure the RFA function type RFA SD. First, select Sales and Distribution as Remote Function Adapter Type. The RFC Destination is filled automatically based on the RFC connection set up at the environment level, but you can also specify this within the rules tab via component RFC destination. This powerful feature gives you the capability to post to different systems by letting you define more than one RFC destination (control-rfcdest) within the same input function. In our example, we will use the RFC destination defined on the environment level and leave the RFC destination component in the Rules tab blank.

Input Tab / Input Function

The input function for the RFA Sales and Distribution can be a model table/view or result of any other functions such as allocation, calculation, join, derivation, etc. as long as it contains the necessary fields.
The data in input function should contain the fields that need to be mapped to the components of the RFA function. The inputs are validated against standard SAP validation rules and only for items, that pass the validation, the sales order will be created.

In our example we use just a Model Table:

Signature Tab

In the Action section of the Signature tab, add Sales Document number field (for example standard SD field VBELN) so it can be later mapped to one of the output fields. This will allow for the automatically generated document numbers to be returned by SAP to SAP Profitability and Performance Management in the RFA SD function run results. In the run results, it will show these numbers and that would mean that the posting was successful

Rules Tab

The RFA SD function has header components and item components. Some components are marked as mandatory in the function’s configuration, but this is intended only as a guide because as the real validation is done on the SAP-SD side.
The configuration comes down to mapping the fields needed for the creation of the sales order. Before preparing the input, please ensure about the configuration on SAP side, check, what kind of Sales Document Type, Item Category, Condition Type you need to use. Check, which Organisational Units need to be used and if the customer master and material master has been created properly on SAP side.
Please remember, that specific calculation functions, for example. if you want dynamically calculate a posting date, for example the last day of the month derived from month and year, the coding must be included in the input function and not in the RFA Function. But you can still use available predefined functions, like the system date (sy-datum).

In our example, all of the relevant header and line item components have been mapped to the appropriate fields in the input function, except of few components that were intentionally hard-coded with values, to illustrate that the components can be either hard-coded or mapped.

Please pay attention also to a few important rules:

Component Comment
control-sd_type fix ‘SALESORDER’
control-sim_fg ” for real run / ‘X’ for simulation
partner-partn_role Partner Function AG (Sold to Party) / if all other SD Partner Functions are derived regarding the config on SAP side
partner-item_number fix ‘0000’ is for the header
salesdata-salesdocument output -> fix VBELN (sales order number) -> need to be added in tab ‘Signature / Action’

Please see an example of the minimum mapping:

Function Execution

Once the rules have been filled and activated, the RFA SD function can be executed by clicking on the Run button. The results can be seen, including the SAP Sales Document Numbers automatically generated for the postings.


You can verify the results in SAP using transaction code VA03 Displays Sales Documents:

or using transaction SE16N to see the created sales orders in the tables VBAK / VBAP.

When errors occur:

In case, errors occur, please check the log. On the screen below you can see, that the material used in the input function does not exist in specific organisational units in SAP System. In that case, please check your input table and if necessary, correct it or defined the material master on SAP side.

Please remember, that for line items, where no errors occur, the sales orders have been created. You can see the line items with the correct created document by the field ‘Sales document’.

Thanks for taking the time to read my first blog entry and I hope you found it useful.

After reading through the whole blog, you should now be able to perform the Remote Function Adapter to create Sales Orders.

Please like, share and let me know what you think in the comments.

Until next time!



Supporting links:

Remote Function Adapter

Database Connection

RFC Destination

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo chanchal gupta
      chanchal gupta

      Awesome . Thank you for taking time to share 🙂