Skip to Content

Modifying Custom R Component from Client-Side to Server-Side Execution

A Custom R Component that was created to be executed locally within SAP Predictive Analysis on your desktop, can be modified so that the component is executed server-side with SAP HANA data. This document explains how.


You may know that any Custom R Component is executed either

  • locally on the SAP Predictive Analysis computer (client-side)
  • or on the R-Server if you are connected to SAP HANA data and have RServ set up (server-side)

Any Custom R Component can be used only for one kind of execution, either client-side or server-side. An underlying configuration that is stored in an XML file for each component determines the component's execution type.


As you can only create a new component when connected to the data source, SAP Predictive Analysis automatically creates the right kind of component. If you are connected to SAP HANA, the component will be executed server-side. If you are working with other sources or you have downloaded the data from SAP HANA, then the component will be configured for client-side execution.


So how can you change how an existing component is executed? If the component is not too complex, you could quickly connect to the desired data source (HANA connected versus any other connectivity option) and recreate the component.


However, if the component is very complex this won’t be fun. Instead you can change a few XML parameter of the model and the component will behave as desired. The following parameters influence where the component is executed.

Client-Side:

EntryValue
PAES_COMPONENT_INSTANCE_PARENTd97042bc-9032-4f64-9861-13513001069f
classNamecom.sap.pa.script.component.RScriptComponent
ExecutionModeoutDB
hasVisualization[either false or true]


Server-Side:

EntryValue
PAES_COMPONENT_INSTANCE_PARENTb3ad6608-ab13-40c7-8bf0-aad035a9e6d9
classNamecom.sap.pa.script.component.InDbRScriptComponent
ExecutionModeinDB
hasVisualizationfalse

Each component is stored in a local folder, which includes a file with the R code and the XML configuration file. On Windows 7 these files are stored in

C:\Users\[YourUserName]\SAP Predictive Components\RScript

There you will find a subfolder for each Custom R Component. Find the component you want to change and adjust the XML accordingly. For the modification you can either use an XML editor or just plain notepad. After the modification just restart SAP Predictive Analysis and the changes should be picked up.

You could also create a second version of the component, so you have the logic available for both client-side and server-side mode. In that case just

  • Create a duplicate of the Component folder in the RScript folder
  • Rename the new folder to something meaningful
  • Within the new component's XML set the uid element to the new folder name
  • Modify the other above XML entries
  • Restart SAP Predictive Analysis

Usual precaution applies of course. Please make sure to keep a backup of the original folder before any modification. Also, please note that Technical Support might ask you to reproduce any problems in a component that was created from scratch in the editor within SAP Predictive Analysis.

Thanks go to  Ashok Kumar KN who had shared the XML differenes between the components.

No comments