SAP NetWeaver Data Source

You can connect to your enterprise SAP instances by using the SAP NetWeaver data source. This article includes information about how to install, set up, and connect to your NetWeaver instance.
calac41
You can connect to your enterprise SAP instances by using the SAP NetWeaver data source. This article includes information about how to install, set up, and connect to your NetWeaver instance.
In this article:
Verify the Prerequisites
Before connecting to your NetWeaver instance, ensure that you know your SAP instance connection information.
Install the JDBC Driver for NetWeaver
If you have installed 
CA Live API Creator
 on Tomcat, install the JDBC driver by copying the 
cdata.jdbc.sap.jar
 JAR file (the JDBC driver) from the 
databaseDrivers
 directory to the 
%{CATALINA_HOME}/lib
 directory. After you have installed the JDBC driver, the NetWeaver data source is available as an option in the connection wizard when creating an API.
The self-contained, single-user version of 
CA Live API Creator
 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
CA Live API Creator
, no additional steps are required to install the JDBC driver.
The limit for the JDBC driver for NetWeaver is 512 bytes per row. 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.
Set up and Configure the JDBC Driver for NetWeaver
The JDBC driver for NetWeaver can connect to SAP using SOAP API or SAP Java Connector (JCo) JAR files. For SOAP API, you must perform extra configuration and enabling of the web services on your SAP system. For JCo JAR files, you must install more JAR files and runtime libraries specific to your platform. You can access the 32 views and seven stored procedures available using the JDBC driver for NetWeaver.
The following procedure describes how to install the JCo files.
  1. Download the appropriate JCo for your installation platform from the SAP Service Marketplace website.
    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 
      CA 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
Prerequisites:
 You know your JDBC connection information.
You can connect to your NetWeaver database using the following methods:
  • (If you have not created your API yet) By creating an API and connecting to a NetWeaver database.
    For more information about how to create your API, see Create your API.
  • (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 create an API and connect to an SAP NetWeaver database.
  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 SAP NetWeaver database.
Customize the Database URL (Location)
You must specify the path to the directory containing the schema files that define the views and stored procedures you want to use in your data source if you want to do the following:
  • Extend the data model with SAP tables or functions.
  • View them in your API.
  • Customize definitions (for example, change a column name, ignore a column, etc.)
The 
Location
 property must point to the folder that contains the schema files. The schema files are 
.rsd
 files for tables and views and 
.rsb
 files for stored procedures. The folder location can be 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
You must deploy the schema files 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 view in SAP. You can create the schema for the tables and BAPI functions that you want to access in your API using the 
createTableSchema
 stored procedure.
Create the Schema for the Tables 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 for the BAPI Functions 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 run this stored procedure outside
CA Live API Creator
 to output a local XML file description of a BAPI function 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 is a list of other BAPIs/function modules examples:
  • SD_SALES_DOCUMENT_READ. Displays sales document data.
  • BAPI_PO_GETDETAIL1. Displays purchase order data.
  • BAPI_CUSTOMER_GETDETAIL1. Displays customer data.
View the Schemas
Prerequisite:
You have created the schema files.
After you view and reload the schema, you can access the data by performing a GET on these views.
For more information about how to reload a schema, see Database Administration.
Perform other Transactions using the JDBC Driver for NetWeaver
You can create/update/delete the transactions data using the transaction code (transaction codes, function modules/BAPIs, etc.) SAP provides.
The following are examples of the transactions you can perform:
  • You can create sales documents which will be stored in VBAK and VBAP tables using the VA41 transaction code.
  • You can create customers which are stored 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 used 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 using the JDBC driver for NetWeaver, see the JDBC driver for SAP documentation website.