SAP NetWeaver Data Source

This article includes information about how to install the JDBC driver for NetWeaver, how to set up and configure the JDBC driver, and how to connect to your NetWeaver instances. With the JDBC driver installed, the NetWeaver data source is available as an option in the connection wizard when creating an API.
lac42
This article includes information about how to install the JDBC driver for NetWeaver, how to set up and configure the JDBC driver, and how to connect to your NetWeaver instances. With the JDBC driver installed, the NetWeaver data source is available as an option in the connection wizard when creating an API.
The maximum row limit for the JDBC driver for NetWeaver is 512 bytes. You can bring back a subset of columns by editing the meta data XML files.
For more information about how to do this, see the SSIS Components for SAP 2016 - Online Help website.
In this article:
 
 
Install the JDBC Driver for NetWeaver
The self-contained, single-user version of 
Layer7 Live API Creator
 that is based on Jetty includes the JDBC driver for NetWeaver. The JDBC driver is located in the 
%JETTY_HOME%/caliveapicreator/lib/ext
 directory. If you have installed this version of 
Layer7 Live API Creator
, no additional steps are required to install the JDBC driver.
If you have installed 
Layer7 Live API Creator
 on another Java container, such as Apache Tomcat, copy the 
cdata.jdbc.sap.jar
 file (the JDBC driver) that is located in the 
databaseDrivers
 directory into the directory that is based on the Java container on which you have installed 
Layer7 Live API Creator
:
Apache Tomcat
Copy the JDBC driver into the 
%{CATALINA_HOME}/lib
 directory
Oracle WebLogic
Copy the JDBC driver to the 
<Your WebLogic Domain Directory>/lib
 directory.
JBoss/WildFly
For more information, see Install on JBoss.
 
IBM WebSphere
Add the JDBC driver to your Web application server.
Using the WebSphere administrative console, create a JDBC provider for the driver in the server.
For more information about how to create a JDBC provider, see the IBM WebSphere documentation.
For more information:
Set up and Configure the JDBC Driver for NetWeaver
The JDBC driver for NetWeaver can connect to SAP using a Simple Object Access Protocol (SOAP) API or SAP Java Connector (SAP JCo) JAR files. If it is connecting using a SOAP API, configure and enable the web services on your SAP system. If it is connecting using SAP JCo JAR files, install the JAR files and runtime libraries that are specific to your platform. The following procedure describes how to set up and configure the SAP JCo files.
With the JDBC driver for NetWeaver installed, set up, and configured, you can access the available views and stored procedures.
Follow these steps:
 
  1. Download the appropriate SAP JCo for your installation platform from the SAP Service Marketplace website.
    SAP JCo 3.0 requires a Java Runtime Environment (JRE) version 1.6, 1.7 or 1.8.
  2. Copy these library files into the following directory: 
    • (The self-contained, single-user version of 
      Layer7 Live API Creator
       based on Jetty) The 
      CALiveAPICreator/lib/ext
       directory.
    • (Tomcat) The 
      tomcat/apache-tomcat-<version>/lib
       directory. 
Platform
SAP JCo files
Unix
 
sapjco3.jar
 and 
libsapjco3.so
 
Windows
 
sapjco3.jar
 and 
sapjco3.dll
 
Mac
 
sapjco3.jar
 and 
libsapjco.jnilib 
 
Connect to a NetWeaver Database
You can connect to your NetWeaver database using the following methods:
  • (If you have not created your API yet) When you create your API.
    For more information about how to create an API, see Creating APIs.
  • (If you have an existing API) By adding a connection to a NetWeaver data source.
    For more information about how to add a connection to a data source, see Database Connectivity.
The following procedure describes how to connect to your NetWeaver database when creating your API.
Prerequisites:
 You know your JDBC connection information and your SAP instance connection information.
Follow these steps:
 
  1. In API Creator, on the APIs page, click 
    Create New API
    .
    The connection wizard opens.
  2. Click 
    Database First
    .
  3. Select 
    SAP NetWeaver
     as the data source type.
  4. Complete the following fields, including the 
    Host
     and 
    Password
     fields, and then click 
    Continue
    :
    Client
     
    The client authenticating to the SAP system.
    System Number
     
    The number by which the target system is defined. Used when setting the Host connection property. The valid range is 0 to 99. In general, this value is 0.
    System Id
     
    The System Id or R3Name of the SAP system is a string with a maximum of three characters. The system ID is often used in load balancing connections, but SAP systems can use it with a dedicated application server.
    Connection Type
     
    The type of connection you are making to SAP.
    Options:
     
    • JCO
       - Select if you are using the 
      sapjco.jar
       file.
    • SOAP
       - Select if you are using SOAP and setting the RFC URL.
    • CLASSIC
       - Select if you are using the 
      librfc32.dll
       file.
    • CLASSIC_UNICODE
       - Select if you are using the 
      librfc32u.dll
       file.
    • NETWEAVER
       - Select if you are using the 
      sapnwrfc.dll
       file.
    Username
     
    This database value accepts double quotes. Use double quotes to accept the value of mixed-case (non-standard) username.
You are connected to the NetWeaver database.
Specify the Path to the Directory Containing the Schema Files
Specify the path to the directory containing the schema files that define the views and stored procedures that you want to use in your data source so that you can do the following:
  • Extend the data model with SAP tables or functions.
  • View the SAP tables or functions in your API.
  • Customize definitions, for example, change a column name or ignore a column.
Point the 
Location
 property to the folder that contains the schema files. The schema files are 
.rsd
 files for tables and views and 
.rsb
 files for stored procedures. You can define the folder location as a relative path from the location of the executable.  
For example, the 
Database URL
 should have the following information:
jdbc:sap:Host=[host];User=[username];Password=[password];Client=[##];ConnectionType=JCO;System Id=[SystemId];System Number=[##];Location=/Users/jdoe/Documents/SAPschema
Deploy the schema files that are generated for your API with other assemblies.
Create Schema Files for Reading SAP Data 
You can create the schema files for the SAP tables and Business Application Programming Interface (BAPI) functions that you want to access in SAP.
Create the Schema Files for the SAP Tables That you Want to Access
You can create the schema for the tables that you want to access in your API using the 
createTableSchema
 stored procedure. The following code snippet shows an example of the syntax to use:
GET CreateTableSchema?arg.Table=KNA1&arg.TableDescription=Customer master data
The following is a list of other SAP table examples:
  • VBAK. Contract header data.
  • VBAP. Contract line item data.
  • EKKO. Purchase order header data.
  • EKPO. Purchase Order line item data.
  • KNA1. Customer master data.
Create the Schema Files for the BAPI Functions That you Want to Access
You can create the schema for the BAPI functions that you want to access in your API using the 
createTableSchema
 stored procedure. The following code snippet shows an example of the syntax to use:
GET CreateFunctionSchema?arg.Function=ISA_SALES_DOCUMENTS_READ&arg.FunctionDescription=ISASalesDocument&arg.ReturnTables=*&arg.SchemaType=View
Or you can output a local XML file description of a BAPI function by running the stored procedure outside of 
Layer7 Live API Creator
 to and place this file in the 
Location
 directory, for example:
GET CreateFunctionSchema Function='ISA_SALES_DOCUMENTS_READ', FunctionDescription='ISA Sales Document', ReturnTables= '*', SchemaType='View'
The following are other example BAPI functions/modules:
  • SD_SALES_DOCUMENT_READ
    Displays sales document data.
  • BAPI_PO_GETDETAIL1
    Displays purchase order data.
  • BAPI_CUSTOMER_GETDETAIL1
    Displays customer data.
Access SAP Data
Prerequisites:
 
  • You have created the schema files.
  • You have reloaded the schema.
    For more information about how to reload a schema, see Database Administration.
Access the data by performing a GET on these views.
Perform other Transactions using the JDBC Driver for NetWeaver
You can create/update/delete the transactions data using the transaction codes and BAPI functions/modules that SAP provides.
For example:
  • You can create sales documents. SAP stores these documents in VBAK and VBAP tables using the VA41 transaction code.
  • You can create customers. SAP stores these customers in KNA1 tables using the XD01 transaction code.
  • You can create custom tables and store or update the data in these tables by writing ABAP code that uses custom and standard SAP transports.
  • You can pass parameters that SAP uses to execute BAPI functions using the provided 
    FunctionCall
     stored procedure:
    GET FunctionCall Function='ISA_SALES_DOCUMENTS_READ',Filter='*',Param= '*',Inputtablename='name',Inputtablecolumn='columns',Inputtablevalue='values',Inputtablerow='rowid'
For more information about how to use the JDBC driver for NetWeaver, see the JDBC driver for SAP documentation website.