Skip to end of banner
Go to start of banner

SAP Execute

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

On this Page

Snap type:Write
Description:

This Snap executes the configured SAP business API (BAPI) given input data, if any, and returns an output document that contains the results of the execution. The BAPI input schema and output schema are provided to correctly map data into the SAP BAPI.

Expected upstream Snaps: Field can be mapped using an upstream Mapper Snap, which will allow the mapping of fields or values to the field that are available on the selected service object.

Expected downstream Snaps: The Snap will output one document for every BAPI execution, hence any document processing Snap can be used down stream.

Expected input: Document that conforms to the input view schema of the Snap. The input view schema is provided to an upstream Mapper Snap based on the selected service object.

Expected output: Document which represents the record structure of the retrieved BAPI output definition. Each record is represented as one document on the output view.


SAP BAPIs do not enforce standard error messaging, so error views of Snaps that immediately follow the SAP Execute Snap should be set to discard the error data and continue. Otherwise, your pipeline will not run.

SAP BAPIs for Integration

BAPI technology in SAP is based on import and export parameters that determine what must be provided (import) and what will be returned (export). BAPI's can be tested in the SAP client via transaction code SE37.

Import parameters contain data to be transferred from SnapLogic to the BAPI. Specific values must be provided as import parameters in order for the BAPI to execute and return the desired data.This is the data stream which will be provided in the input view of the SAP Execute Snap. 

Export parameters contain data to be transferred from the BAPI back to SnapLogic, which is returned back in the output view of the SAP Execute Snap. The data returned back can be of the following types:

  • S = success message
  • E = error message 
  • W = warning message 
  • I = information message 
  • A = termination message (abort)

The list of BAPI's in a particular SAP client will vary depending on the level of customization, however an exhaustive set is delivered as standardized BAPI's which provide basic functions and can be used to read and write or change data for most SAP Business Objects. 

BAPIs for Reading Data

The following BAPIs provide you with read-only access to data in the associated business object:

  • GetList - With the BAPI GetList, you can select a range of object key values, for example, company codes and material numbers.
  • GetDetail - The BAPI GetDetail uses a key to retrieve details about an instance (one specific occurrence) of a business object and returns this data to the calling program. Then this information is reported back to the calling program.
  • GetStatus - The BAPI GetStatus is used to query the status of an SAP Business Object, for example, the processing status of a sales order. This BAPI is used only for displaying the status of an object and does not retrieve full details like the BAPI GetDetail.
  • ExistenceCheck - The BAPI ExistenceCheck checks whether an entry exists for an SAP Business Object, for example, whether the customer master has been created.  

BAPIs for Creating or Changing Data

The following BAPIs can create, change or delete instances of a business object:

  • Create or CreateFromData - The BAPI Create or CreateFromData creates an instance of an SAP Business Object, for example, a purchase order.
  • Change - The BAPI Change changes an existing instance of a SAP Business Object, for example, a purchase order.
  • Delete and Undelete - The BAPI Delete deletes an instance of an SAP Business Object from the database, for example, a purchase order. The BAPI Undelete removes a deletion flag. 
  • Add<sub-object> and Remove<sub-object> - The BAPI Add<sub-object> adds a sub-object to an existing object instance and the BAPI and Remove<sub-object> removes a sub-object from an object instance.


Prerequisites:

Have the SAP BASIS administrator setup the user to be used in the appropriate SAP clients with certain set of authorizations. To execute a BAPI as part of your application program, the users of your application must have the appropriate authorizations set up in their respective master records. The documentation provided with the BAPI contains information about the required authorizations. 

Any attempts to execute a BAPI that fail as a result of insufficient authorization are reported back to the calling application.

Support and limitations:Works in Ultra Task Pipelines.
Account:

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Configuring SAP Accounts for information on setting up this type of account.

Views:
Input

This Snap has at most one input view. A provided input view lets you pass data as input to the BAPI call. The document attributes will be matched to the SAP BAPI metadata, any matching attribute will be provided to the BAPI program at execution, any non-matching attribute will be ignored.  The attributes can be tabular and structured or scalar. An SAP Execute API call is made for each document. If SAP Execute has no input document, SAP Execute calls the BAPI with no input data.

Only some BAPIs may be able to process without input - see your BAPI documentation as to whether or not your BAPI will correctly process with no input data.
Output

This Snap has exactly one document output view. The sdocuments are being populated using the result data of each BAPI call for each document passed into SAP Execute. If SAP Execute has no input document, only one output document result will be created. 

ErrorThis Snap has at most one error view and produces zero or more documents in the view.

Settings

Label*

Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

BAPI List configuration

Use this field set to configure the list of BAPIs to return.

BAPI List config key


Specify a key to configure the BAPI list that is being returned.

BAPI List config value


Define a value to configure the BAPI list that is being returned. 

See object types at http://wiki.scn.sap.com/wiki/display/ABAP/List+of+BAPI's

BAPI*


Specify the business application interface (BAPI) on the SAP server to be executed. This is the ABAP name. The full list of all BAPI's can be viewed by clicking the suggest values icon.


Default value: [None
Example: BAPI_MONITOR_GETLIST


Start stateful call sequence

Use this check box to create a stateful session for calling one (or more) BAPIs using this Snap (and other downstream Snaps).

Make sure to select this check box for the Snap where you define your first BAPI call in the Pipeline. Do not select the Commit after BAPI execute check box for this Snap, to extend the stateful session and call more BAPIs using this Pipeline (downstream to this Snap).

'Sequence' implies that the output from a BAPI call is needed for the next BAPI call to run.

Default value:  Not selected


Commit after BAPI execute


Use this check box in any downstream Snap to mark the end of the stateful session, started upstream of this Snap using Start stateful call sequence check box, and commit when no exception is raised; otherwise, the BAPI controls the commits.

Make sure to select this check box for the Snap where you define your last BAPI call in the Pipeline. Do not select the Start stateful call sequence check box for this Snap.

Do not select both Start stateful call sequence and Commit after BAPI execute check boxes for all other BAPI calls between the first and the last calls in the sequence. For example, Second BAPI call in a 3-call sequence; Second, Third, and Fourth BAPI calls in a 5-call sequence.

Default value:  Not selected


Date conversion format


Format to convert string input values into SAP date/datetime fields. The format string using the same syntax as the Java SimpleDateFormat class.  If blank, then no conversion will be performed and an error will be generated by SAP client when an input view string is mapped to SAP date/datetime field.

Example: yyyyMMdd

Default valueyyyyMMdd

Output DateTime as Text

Select to output date and time as a String data type instead of a DateTime object.

Default value: Not selected

Error handling

This property lets you define the error handling. If any error paths and their error values match a corresponding value in the output document, then the document is routed to the error view (if enabled), or the Snap fails (if error view is disabled).

Error pathError value
 $RETURN[*].TYPE E

Any newly created SAP Execute Snaps will add the default value above to provide a default for error handling.
Any existing SAP Execute Snaps can be modified if needed to add default error handling.

The Snap will not by default fail/route anything to the error view if the RETURN[*].TYPE value is 'E' in case the error handling is undefined


Max request attempts*



The maximum number of SAP connection attempts in case of a failure.

When 0 is entered, the Snap tries for infinite times for the connection. 

Default value: 3

Request retry interval

The time in seconds to wait before retrying the request. 

Default value: 5
Route errors

Writes configuration errors to the error view. If the error is non-recoverable, especially connection errors such as exception handling would be routed to the error view with relevant information.

Default value: Not selected

Reload Function Metadata

Select this checkbox to reload the metadata (latest schema) for the current BAPI function before executing the BAPI function.

Loading of metadata may take a while depending on the network speed.


Snap execution

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Examples


The following examples include: one to retrieve data successfully, one to insert data successfully in SAP using the applicable BAPI, one to show an error.

 SAP Execute to retrieve data successfully

In the first example we will read a list of all sales orders in SAP by Sales Organization and Customer using BAPI_SALESORDER_GETLIST and then split the data by Sales Order # (SD_DOC), format the data to Excel and ultimately write the data to SLDB.

We will start with a JSON Generator Snap which provides Customer and Organization ID which is input for the Mapper Snap where we map the relevant details such as CUSTOMER_NUMBER and SALES_ORGANIZATION to prepare as your input data.

The SAP Execute Snap is configured to use  BAPI_SALESORDER_GETLIST.  I have renamed the Snap "SAP Execute - BAPI" for the purposes of this example. 


The results are returned from SAP, which match the input criteria (Sales Organization and Customer).



Next, we split the data by Sales Order using a JSON Splitter. The JSON Splitter can use the SALES_ORDERS path to split the incoming document into individual output documents for each sales order and then write the results to an Excel file using Excel Formatter.

 SAP Execute to insert data successfully

We create an actual sales order in the second example. We use the following JSON as the input to the BAPI_SALESORDER_CREATEFROMDAT2 BAPI.

[
    {
        "ITM_NUMBER": "1",
        "ORDER_HEADER_IN": {
            "SALES_ORG": "3020",
            "DIVISION": "00",
            "DISTR_CHAN": "30",
            "DOC_TYPE": "TA",
            "PURCH_NO_C": "000004454"
        },
        "PARTN_NUMB": "0000003041",
        "PARTN_ROLE": "AG"
    }
]

Then we map the input into the schema for the BAPI_SALESORDER_CREATEFROMDAT2 BAPI .

The image below shows the SAP Execute Snap configuration:

The execution returns the RETURN attribute (and others) which shows the status. TYPE: 'S' indicates a success and provides additional messages.

 Error Handling of the Snap

Errors are identified in a BAPI as type "E" in the RETURN message. If the BAPI is not able to process the data provided in the input, the message returned should indicate  the corrective action required as in the following example from BAPI_SALESORDER_CHANGE. 

 Sequence of BAPI calls in a Pipeline

The following Pipeline demonstrates a sequence of 3 BAPI calls on service notifications using an SAP instance.

Download this Pipeline.


In this example Pipeline, a Mapper (Feed Notification Data) is used to prepare the sample attributes for the notification.

The output displays the notification attributes.

We are using three SAP Execute Snaps to call the following BAPI functions in that sequence.

  1. BAPI_SERVNOT_CREATE : To create a service notification using Create Svc Notification Snap.

  2. BAPI_SERVNOT_SAVE : To save a service notification using SAP Execute Snap.

  3. BAPI_TRANSACTION_COMMIT: To execute external commit when using BAPIs using Save Svc Notification Snap.

SAP Execute Snap to call BAPI_SERVNOT_CREATE and create an SAP
service notification.
SAP Execute Snap to call BAPI_SERVNOT_SAVE and save the SAP
service notification.

  • Select the Start Stateful Call Sequence check box to indicate the  
    beginning of the BAPI sequence.
  • Do not select the Commit after BAPI execute check box.
  • Do not select both the checkboxes in this Snap, as this BAPI is
    an intermediate call in the BAPI sequence.
Mapper Snap to extract the notification number from the saved notification.

SAP Execute Snap to call BAPI_TRANSACTION_COMMIT and commit
 transaction (save service notification).

JSON Formatter Snap to format the output after committing
the transaction.

  • Do not select the Start Stateful Call Sequence check box.
  • Select the Commit after BAPI execute check box in this Snap to 
    indicate the end of the BAPI sequence.

File Writer Snap to write the formatted output into a file New_BAPI_Seq_PL_Output.JSON

Downloads

  File Modified


See Also

Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
February 2024main25112 StableUpdated and certified against the current SnapLogic Platform release.
November 2023435patches24068 Latest
  • Enhanced the SAP IDoc Listener and SAP IDoc Document Listener Snaps with a new Halt on SAP error checkbox for better error-handling capability. Select this checkbox to enable the listener to interrupt and halt processing in case of an error from SAP.

  • Removed the unnecessary spring-core dependency from the SAP Snap Pack.

November 2023main23721 StableUpdated and certified against the current SnapLogic Platform release.
August 2023main22460 StableUpdated and certified against the current SnapLogic Platform release.
May 2023

433patches22386

 Latest

Fixed an issue with the SnapLogic SAP Accounts that caused issues when connection pools were exhausted. The minimum value allowed for the Connection pool capacity is now 0 so you can disable the connection pooling.

May 2023

main21015 

Stable

Upgraded with the latest SnapLogic Platform release.

February 2023main19844 StableUpgraded with the latest SnapLogic Platform release.
November 2022431patches19026 Latest

The SAP IDoc Listener Snap now handles the data event from the SAP instance as expected.

November 2022main18944 StableUpgraded with the latest SnapLogic Platform release.
October 2022430patches18854 Latest

The SAP IDoc Read and SAP IDoc Write Snaps do not display the error messages when the IDoc Read BAPI Name field is empty or wrong as a default value IDOC_READ_COMPLETELY is now assigned to the empty field, otherwise, the Snap considers the specified name.

4.30 Patch430patches17344

 

Latest

The SAP Execute Snap is now equipped to send the actual content of the incoming byte arrays (in binary types like XString) instead of their transformed String values.

August 2022main17386 StableUpgraded with the latest SnapLogic Platform release.
4.29 Patch429patches16637 Latest
  • Fixed an issue with the SAP IDoc Write Snap where the Snap wrote the same TID, Document_number, and so on for the different output documents though the I_DOCNUM array contained all the document numbers that are returned from SAP table. Now, the Snap writes different TID, Document_number for different output documents along with the I_DOCNUM array that contains all the document numbers.
  • Fixed an issue with SAP Execute and SAP IDoc Write Snaps where the output preview did not include the original document.
4.29 Patch

429patches16113

 Latest

Fixed an issue with SAP Execute Snap where the Snap incorrectly handled connection exceptions for 104-JCO_ERROR_SYSTEM_FAILURE. Previously, the Snap captured only the output document without the error. Now, the Snap correctly captures both the output and error.

4.29main15993 StableUpgraded with the latest SnapLogic Platform release.
4.29main15993 StableUpgraded with the latest SnapLogic Platform release.
4.28main14627 Stable
  • Upgraded the Java Native Library used by the SAP Java Connector (JCo) to version 3.1.

    Breaking change for Pipelines containing Snaps from the SAP Snap Pack with Java Native Library

    This upgrade may cause your existing Pipelines to break if they contain Snaps from the SAP Snap Pack. You must manually upgrade your SAP Java Connector (JCo) Native Library to version 3.1.4 for these Pipelines to run successfully. See SAP Configurations for more information.

4.27 Patch427patches13992 Latest
  • Enhanced the SAP Execute Snap to support nested tables or structure data in the import parameters.
  • Upgraded the Java Native Library used by the SAP Java Connector (JCo) to 3.1.4 version.

4.27 Patch427patches12999 Latest

Enhanced SAP RFC ListenerSAP IDoc Listener and SAP IDoc Document Listener Snaps with a new field set Advanced JCo Server Properties that allows you to configure Java Connector (JCo) server-related attributes.

4.27

main12833

 

Stable

Upgraded with the latest SnapLogic Platform release.
4.26main11181 StableUpgraded with the latest SnapLogic Platform release.
4.25 Patch425patches10571 Latest

Renamed the RFC Listener Snap as SAP RFC Listener Snap. 

4.25main9554
 
Stable

Introduced the SAP RFC Listener Snap that facilitates Remote Function Calls (RFCs) between two SAP systems. The Snap simulates an RFC server and listens to the incoming RFC calls infinitely. Subsequently, the Snap generates output documents either from the import parameters or triggers a child Pipeline. Business applications can use the RFC mechanism to communicate and exchange information (in predefined formats) with other systems.

4.24main8556
StableUpgraded with the latest SnapLogic Platform release.
4.23main7430
 
StableUpgraded with the latest SnapLogic Platform release.
4.22 Patch 422patches7378 Latest

Enhances the SAP Execute Snap to process the structure that contains nested Table Type fields in the output document by recursively parsing them into a Map or a List set.

4.22 Patch 422patches6796 Latest

Fixes the JCO_ERROR_REQUEST_CANCELLED (connection is closed) error in SAP Execute Snap that occurs even when the session is active after 10 minutes.


4.22 Patch 422patches6601 Latest

Enhances SAP Execute and SAP IDoc Write Snaps by introducing the following fields:

  • Reload Function Metadata: To get latest schema.
  • Reload Metadata and Validate: Allows clearing the JCo Metadata cache on the plex node before each validation.
4.22 Patch 422patches6597 Latest

Enhances the SAP Execute Snap by introducing the following two fields:

  • Commit Timeout (sec): Creates a session to call BAPI and commit.
  • Session ID: Identifies specific sessions for all the Snaps that are in a stateful call sequence.
4.22main6403
 
Stable
  • Enhances the Snap Pack to support SNC-based authentication in SAP Accounts and the execution of BAPI call sequences in a Pipeline.
    • The SAP Accounts, SAP JCo Account and SAP Load Balanced JCo Account, can be used to extend connection security with an additional layer of Secure Network Communications (SNC) configuration by passing advanced JCo parameters.
    • Updates the SAP Execute Snap with the ability to execute a sequence of BAPI calls within the same Pipeline and session. Sequence implies that the output from a BAPI call is needed for the next BAPI call to run.
4.21snapsmrc542

 

Stable

Enhances the SAP Execute Snap to add a new field, Output date time as Text, which enables you to output date and time as a String data type instead of a DateTime object.

4.20 Patchsap8811 Latest

Updates the SAP IDoc Write Snap with the following:

  • Fixes the stack overflow error that occurs while retrying to write the IDoc to the SAP server. 
  • Adds inbound success codes to the default value which otherwise only indicates the IDoc being created.
  • Enhances the error messages for a better user experience.
4.20snapsmrc535
 
StableUpgraded with the latest SnapLogic Platform release.
4.19snaprsmrc528
 
StableUpgraded with the latest SnapLogic Platform release.
4.18snapsmrc523
 
StableUpgraded with the latest SnapLogic Platform release.
4.17ALL7402
 
Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515
 
Latest

Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.

4.16snapsmrc508
 
StableUpgraded with the latest SnapLogic Platform release.
4.15snapsmrc500
 
StableUpgraded with the latest SnapLogic Platform release.
4.14snapsmrc490
 
StableUpgraded with the latest SnapLogic Platform release.
4.13

snapsmrc486

 
StableUpgraded with the latest SnapLogic Platform release.
4.12

snapsmrc480

 
Stable
  • Added the retry connection and error routing mechanism to the SAP Execute, SAP iDOC Read, SAP iDOC Write, SAP iDOC Document Listener and SAP iDOC Listener Snaps.
  • Updated the SAP Account with Enable trace property to analyse the connection related errors.
4.11 Patch sap4514 Latest

Addressed an issue with the SAP iDoc Listener and iDoc Document Listener Snaps where the pipeline takes a longer time to stop while performing a manual trigger. 

4.11 Patch sap4342 Latest
  • SAP IDoc Write Snap now supports IDoc Extension type.
  • SAP Self-service/on-demand ability to clear IDoc metadata cache.
4.11snapsmrc465
 
StableUpgraded with the latest SnapLogic Platform release.
4.10

snapsmrc414

 
Stable

Added SAP account to connect to a message server, SAP Load Balanced JCo Account.

4.9 Patch sap3246 Latest
  • Added SAP account to connect to MSHOST (JCo Load Balanced account).
  • Addressed an issue with SAP BAPI call appending duplicate fields to object
  • SAP Execute: Support for "table-type" fields added
  • Addressed an issue in SAP Execute: Changing parameter metadata not imported
4.9 Patch sap3233 Latest

Addressed an issue with SAP Execute failing to call BAPI with integer request parameter

4.9snapsmrc405
 
Stable

Introduced the SAP IDoc Document Listener Snap in this release.

4.8

snapsmrc398

 
Stable

Info tab added to accounts.

4.7

snapsmrc382

 
StableUpgraded with the latest SnapLogic Platform release.
4.6snapsmrc362
 
StableUpgraded with the latest SnapLogic Platform release.
4.5.1

snapsmrc344

 
StableUpgraded with the latest SnapLogic Platform release.

  • No labels