You are here: Working with Service Definition Tool > Create a SAP Service

Creating a SAP Service

Kony Studio allows you to access and use the external SAP services using the custom SAP Connector. A service that uses a custom SAP connector is a SAP service.

You must load the required Business Application Programming Interface (BAPI) functions to define a SAP service. The BAPI files contain the SAP methods and functions. These methods have the logic defined that is required for a service. A BAPI is remotely enabled function module since it can be invoked from remote programs like standalone JAVA programs, web interface.

Single Sign-on Feature

SAP offers several mechanisms for authenticating users. If you have many systems in your system landscape, then a single sign-on (SSO) environment can help to reduce the number of passwords that users have to remember. SSO eases user interaction with the many systems, components, and applications available to the user. Once the user is authenticated to the portal, they can use the portal to access different systems without having to repeatedly enter their user information for authentication.

There will be a Login and Logout services for SAP Connector irrespective of SSO or non-SSO. You do not have to pass any credentials for BAPI services. Middleware stores the authentication details in session after successfully executing log-in service.

If you provide authentication details for each BAPI services, middleware will take care of that and should work as expected to maintain backward compatibility.

Note: Prior to Release 5.6, for all non-SSO BAPI service calls, you had to pass the authentication details through request parameters.

If user sends credentials through request parameters, middleware uses the details, If it does not find details from request parameter, it will read from the service definition file provided by the user from IDE. If it does not find in both places, it will display error message "Please provide SAP server username as request parameter.."

If SSO server / SAP server details are not valid, you will get an error code in response. The following table provides the error code information:

Error code Error message for log purpose Error message for client or end user
8702 Exception occurred in SAP system, while processing BAPI function module. Exception occurred in SAP system, while processing BAPI function module.
8703 JCO Exception occurred SAP System Connection Related Errors. (Not provided by the Dev Team).
8710 sapserverfile config value is missing in service config. SAP server properties are missing from server configuration.
8711 Provide username as a request parameter. Please provide SAP server username as request parameter.
8712 Provide password as a request parameter. Please provide SAP server password as request parameter.
8713 SAP Server connection property file is missing. SAP server properties are missing for connecting to SAP system.
8716 Unable to find the user session User session not found. Log in to use the services.
8717 Problem in getting the SSO Token - Either User/Password/SSO Token/Certificate is not specified for <sap host> Either User/Password/SSO Token/Certificate is not specified for : <sap host>
8718 Loggout failed due. No user logged in the current session Session Expired or User needs to be logged in, to perform log out!
8719 Problem with network connection, while connecting to given SAP system Problem with network connection, while connecting to given SAP system <Host>
8720 SSO Token does not exist in the session. SSO Token does not exist in the session.
8721 Exception occurred in connecting to : <sap host> Problem while connecting to SAP System : <sap host>
8722 Please provide username and password as a request parameters. Please provide username and password as a request parameters.


In case of expiry, an error code is received in response (no expiry notification) and user has to relog-in again. General expiry time is 10 mins (you can configure from SAP server level).

Note: In case of SSO, middleware ignores username and password from request headers and continues with the same session that is logged in earlier. If there is no associated login session, an error message is shown to the user "User session not found. Please login first in order to use the services".

The supported SAP Servers versions are SAP ECC5, SAP ECC 6.

Configuring the SAP environment for Kony Studio

To configure SAP Environment for IDE:

  1. Copy the following files from SAP installation and place them in:

    • For Windows - <JDK_Installation_Path>/jre/ lib/ext folder:
    • For Mac OS X - System/Library/Java/Extensions folder:



    Note: If you have a Windows OS, copy the sapjco3.dll file. If you have a Linux or Unix environment, copy the file.

    Important: On Mac OS X:

    • Set the permission for these files using the command chmod 777 Sapjco*.
    • This service only works on Oracle JDK 1.7 version.
    • Edit the eclipse.ini file and add the below code into the file:

  2. Modify the config.ini file and add the following line at the end of the file:


    This file is available at <Eclipse_Installation_Path>/configuration.

  3. Restart Eclipse.

To configure SAP for middleware

  1. Ensure that you remove the comment for the following lines in the web.xml file present in the WEB-INF folder of middleware.war.

    <!-- remove the comment for SAP connector enabled




  2. To run SAP on a Linux server, you have to copy and sapjco3.jar in the <JDK_Installation_Path>/jre/ lib/ext folder.

Creating a SAP Service

To create a SAP service, follow these steps:

  1. Go to Applications view.
  2. Right-click the application and select Open Service Definition > SAP Services or press Ctrl + Shift + Y. The SAP Service Definition Editor appears.
  3. Right-click the SAP Servers folder and select Add Server. The SAP Server Details dialog appears.

    Note: You can also add a SAP service using the Enterprise Explorer View. Right-click the SAP Servers folder and select Add Server. The SAP Server details screen appears.

  4. In the Connection tab, enter the following information:
    • Application Server. The application server IP address.
    • System Number. The SAP system number.
    • Client ID. The SAP Client ID. The default is based on the SAP server configuration.
    • Kony Studio captures log in details for SAP ABAP Server. With SSO, you has to select an option SSO or non-SSO login. For SSO Login, you has to provide portal hostname and port. Kony Studio generates properties files with SSO details.

      In Login Information section, select either of the option:

      • Non-SSO Login.To use normal sign on feature, select Non-SSO Login and provide user name and password to connect to the server.

      • SSO Login.To use single sign on feature, select SSO Login and provide the following details:

        • Portal Host. Enter SAP Portal server IP address.
        • Portal Port. Enter SAP Portal server port address.
        • User Name. Enter the name for the server login.
        • Password. Enter the password for the server login.
  5. In the Advanced tab, enter the following:
    • SAPRouter String: Enter the address of the SAP router that is used to connect to a provider system.
    • Connection CPIC Trace Level: Enter the trace level which you want to set. Available options are:
      • -1: Usage of the global CPIC trace level.
      • 0: no CPIC trace.
      • 1: minimal CPIC trace.
      • 2: full CPIC trace.
      • 3: full CPIC trace including data.
    • To enable tracing on the RFC destination, select the RFC Trace checkbox.

    • Peak Connection Limit: Enter the maximum number of simultaneous connections that should be active.
    • Pool Capacity: Enter the maximum number of idle connections to be kept open.

  6. In the Security tab, enter the following:
    • To enable Secure Network Connection, select the Enable SNC checkbox.
    • sncNameR3: Enter the SNC name of the User Management Engine (UME).
    • sncQOPR3: Select a value between 1 and 9 to indicate the SNC level of security.
    • sncLib: Enter the path to library that provides the SNC service.

  7. Click Connect.

    You can view the added server and its corresponding business objects under the SAP Server folder.

    Note: If you are getting unsatisfied link error add argument "-Djava.library.path = <JDK_Installation_Path>/jre/lib/ext/"under -vmargs in eclipse.ini file

  8. Expand each node to view the child nodes of each Business Object. The child nodes of each parent node are loaded when you click on the node. The on-demand loading of each child prevents UI freeze. The Progress View displays the progress of each loading operation.
  9. Select a BAPI function, to view the corresponding input and output parameters.

    The BAPI functions have input parameters of the following datatype:

    • Collection: Is a table consisting of multiple parameters where each parameter is displayed as a column in the right pane. To view the parameters of the collection in the left pane, expand the <Collection name>.

      You can add values for each parameter(column) in the rows provided below the parameter. You can add rows using the icon. To delete a row, select the row and click . You can move the row values of each parameter using the up and down arrows provided.

      Note: The parameters in the collection are displayed as an alphabetically sorted tree in the left pane. In the Right pane, the parameters are displayed according to the usage in the BAPI function. Scroll left or right to view all the parameters.

    • Record: A record consists of a list of parameters. To view the parameters that are a part of a record, expand the record. You can see the datatypes assigned to each parameter in the left pane. Assign corresponding values for each parameter in the Value column in the right pane.

    • Parameter: A parameter can be of the datatype string, number, or date. All the parameters of a BAPI function are displayed on the top most area in the right pane. If a BAPI function consists of records as well, the parameters of the BAPI function which are not a part of the record are displayed below the record. In a BAPI function without records, the parameters appear on the top.

  10. You can additionally specify:

    1. Preprocessor Class - Specifies the Preprocessor file name.
    2. Postprocessor Class - Specifies the Post Processor file name.

      Note: For more information on Preprocessor and Post Processor, see the section Preprocessor/Post Processor.

  11. After specifying all the input parameters of the BAPI function, press Execute to view the output parameters.

    The Input and Output Parameters of the BAPI function can be viewed by click the Input or Output Tabs present at the bottom of the right pane

  12. Select a BAPI function, right-click, and select Add to Selected to add the method to the Selected BAPI Functions folder for a specified server.

    The Add to Selected option appears only if the BAPI function has already been loaded. The selected services are used by the device when the application is launched.

  13. You can also perform the following additional actions:
    • Right-click a created SAP server and Disconnect or view the Properties configured for that server.
  14. Click Generate Service Definition icon to generate a Service Definition File.


    • The service definition file generated is specific to SAP services and appears under services in the Applications View.
    • Also, properties file is created with the system name. For example, This property file includes all connection-related parameter details.
    • From Release 5.6, file will not contain user information like username and password. It only contains SAP server and SSO server details.

    A Service Definition file has information common to all the services like the server configurations, wsdl configurations and so on.

    The individual information about each service is present in <service_id>.split files in the split_services folder.

  15. Use the Event Editor to invoke this service.
  16. Map the data elements within the application with this service using the Mapping Editor.
  17. Publish the Service Definition File.
  18. Build the application.
  19. Test the service output on emulators in the similar way you have tested for Web Services.
Copyright © 2015 Kony, Inc. All rights reserved.