Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of ContentsmaxLevel2exclude

In this article

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

Snap type:WriteDescription:

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.

Note

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

Note

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, you must have the appropriate authorizations set up in 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.

Note
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 documents 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

You can use this Snap to execute the SAP Business API (BAPI) with the given input data. The BAPI input schema and output schema must correctly map data into the SAP BAPI.
Image Added

Info
iconfalse
titleSAP BAPIs for Integration

BAPI technology in SAP is based on import and export parameters that determine the parameters that must be provided (import) and parameters to be returned (export). You can test the BAPI's in the SAP client through transaction code SE37.

Import parameters contain data to be transferred from SnapLogic to the BAPI. Specific values must be provided as import parameters for the BAPI to execute and return the desired data.
Export parameters contain data to be transferred from the BAPI back to SnapLogic. The data returned 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 varies 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: Select a range of object key values, for example, company codes and material numbers.
  • GetDetail: Retrieve details of an instance (one specific occurrence) of a business object and returns this data to the calling program. This information is reported back to the calling program.
  • GetStatus: 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: 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: Creates an instance of an SAP Business Object, for example, a purchase order.
  • Change: Changes an existing instance of a SAP Business Object, for example, a purchase order.
  • Delete and Undelete: 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>: Adds a sub-object to an existing object instance and the BAPI and Remove<sub-object> removes a sub-object from an object instance.

Snap Type

SAP Execute Snap is a Write-type Snap.

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, you must have the appropriate authorizations set up in 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.

Limitations and Known Issues

None.

Support for Ultra Pipelines

Works in Ultra Pipelines

Snap Views

TypeFormatNumber of ViewsExamples of Upstream and Downstream SnapsDescription
InputDocument
Min: 0
Max: 1
  • Mapper

Document that conforms to the input view schema of the Snap. The document attributes are matched to the SAP BAPI metadata, and the matching attributes are provided to the BAPI program at execution, and any non-matching attributes are ignored.
The attributes can be tabular and structured or scalar. The Snap makes an API call for each document. If there is no input document, the Snap calls the BAPI with no input data.

Note
Only some BAPIs may be able to process without input. Refer to your BAPI documentation for the BAPIs that correctly processes with no input data.


OutputDocument
Min: 1
Max: 1
  • JSON Splitter
  • Mapper
  • Any document processing Snap


Document which represents the record structure of the retrieved BAPI output definition. The documents are populated using the result data of each BAPI call for each document passed into this Snap. If the Snap has no input document, only one output document result is created. 

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. Learn more about Error handling in Pipelines.
The available options are:

  • Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Note

SAP BAPIs do not enforce standard error messaging, so error views of Snaps that are downstream of the SAP Execute Snap should be set to Discard Error Data and Continue. Else, your Pipeline will fail to run.


Snap Settings

Field Name

Field Type

Description

Label*


Default ValueSAP Execute
Example:
SAP BAPI Create Orders

String

Specify a unique and meaningful name for the Snap.


BAPI List configuration



Use this field set to configure the list of BAPIs to return. This field set contains the following fields.

BAPI List config key

Specify


Default Value:OBJECTTYPE
ExampleRELEASED_FUNC

Dropdown list

Select a key to configure the BAPI list that is being

returned.

returned. The available options are:

  • OBJECTTYPE
  • SHOW_RELEASE
  • BAPIS_POTENTIAL
  • BAPIS_NEW
  • BAPIS_OLD
  • RELEASED_BAPI
  • RELEASED_FUNC
BAPI List config valueString

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)

. Learn more about object types.


BAPI*

Default Value: N/A
Example:
BAPI_MONITOR_GETLIST


String/Expression/Suggestion

Specify the 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

 


Start Stateful Call Sequence


Default ValueDeselected

Checkbox

Select this checkbox to create a stateful session for calling one (or more) BAPIs

using this Snap (and other downstream Snaps)

.

Note

A Session ID is required if you want to create a stateful call sequence.


Info

Ensure to select this checkbox for the Snap where you define your first BAPI call in the Pipeline. Do not select the Commit after BAPI execute checkbox 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

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

Info

Ensure to select this checkbox for the Snap where you define your last BAPI call in the Pipeline. Do not select the Start stateful call sequence checkbox for this Snap.

Do not select both Start stateful call sequence and Commit after BAPI execute checkboxes 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

a BAPI call is needed for the next BAPI call to run.


Commit after BAPI execute


Default ValueDeselected


Checkbox

Select this checkbox to end the stateful session and commit when no exception is raised; else, the BAPI controls the commits.

Info

Ensure to select this checkbox for the Snap where you define your last BAPI call in the Pipeline. Do not select the Start Stateful Call Sequence checkbox for this Snap.

Do not select both Start Stateful Call Sequence and Commit after BAPI execute checkboxes 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.


Session ID


Default Value: [None]
Example
:xyz987

String/Expression

Specify the string to identify a specific session.

All Snaps in a specific stateful call sequence must be in the same session ID, and there should be only call sequence running in a session at a time. If you do not provide any session ID, the Snap runs in its own session.


Date conversion format


Default ValueyyyyMMdd
ExampleyyyyMMdd


String/Expression

Specify the format to convert string input values into SAP date/datetime fields

. The format string uses the same syntax as the Java SimpleDateFormat class. If left blank

in SimpleDateFormat.
If you do not specify any value, then no conversion is

performed

done and

an error is generated by

the SAP client displays an error when an input view string is mapped to SAP date/datetime field.


Output date time as Text

Default

value

Value

yyyyMMdd
Example: yyyyMMdd
Output DateTime as Text

Deselected

Checkbox

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

Default value: Not selected


Error handling



Use this field set to define error path and values for handling errors. 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)

or the Snap fails (if error view is disabled).

If you do not define the error handling, the Snap will not by default fail or route anything to the error view if the RETURN[*].TYPE value is 'E'.


Error path

Error value $RETURNMax request attempts*


Default 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

Example$RETURN[*].TYPE

String/Expression

Specify the error path to which the errors should route.


Error value

Default ValueE
Example: R

String/Expression

Specify the value for the error.


Max request attempts*

Default Value: 3
Example
:5



Integer

Specify the maximum number of SAP connection attempts to make in case of a failure.

When you specify 0, the Snap makes infinite connection attempts. 


Request retry interval

Default value: 5
Example:

3

5

Request retry interval
Integer

Specify the time in seconds to wait before retrying the request.


Route errors

Default value:

5

Deselected

Route errors
Checkbox

Select this checkbox to write configuration errors to the error view. If the error is non-recoverable, the errors (especially connection errors such as exception handling

would be

) are routed to the error view with relevant information.


Reload Function Metadata

Default value:

Not selectedReload Function Metadata

 Deselected

Checkbox

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

Note

Loading of metadata may take

a while

some time depending on the network speed.

Multiexcerpt include macroname


Snap Execution

pageSOAP Execute


Default valueExecute only
Example
Validate & Execute

Dropdown list

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute


Examples


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

Expand
titleSAP 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. 

Image Modified


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


Image RemovedImage Added


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.


Expand
titleSAP 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.

Code Block
[
    {
        "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.



Expand
titleError 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. 


Expand
titleSequence 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

Image Removed

Downloads
_PL_Output.JSON

Image Added


Downloads

Note

Important Steps to Successfully Reuse Pipelines

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.


Attachments
uploadfalse
oldfalse
patterns*.slp, *.zip

See Also



Insert excerpt
SAP Snap Pack
SAP Snap Pack
nopaneltrue

Related Content