Working with Direct - Automate_Studio - 20.3

Automate Studio with Connect User Guide

Product type
Software
Portfolio
Integrate
Product family
Automate
Product
Automate > Automate Studio
Version
20.3
Language
English
Product name
Automate Studio
Title
Automate Studio with Connect User Guide
Topic type
Overview
Administration
Installation
How Do I
First publish date
2018

This page covers the following topics:

  • Definitions / Details    

  • When to use Direct    

  • Features unavailable in Direct (unless specifically built in by developer)    

  • Differences from Transaction

  • Preparation before using Direct

  • Direct Tips

  • Creating a Direct Script    

  • Direct Best Practices

 

Definitions

  • RFC (Remote Function Call)

    • Standard SAP interface used by third party applications to communicate with SAP

    • Used to execute a function in SAP

    • RFM (Remote-Enabled Function Module) – RFM stands for Remote-Enabled Function Module

    • Call and execute predefined functions

  • BAPI (Business Application Programming Interface) - must be remote enabled

    • A BAPI may be a standard SAP BAPI or a custom BAPI created by an SAP BASIS programming team for internal use

    • A BAPI is an RFC enabled function module that is used to call SAP internal code

    • Standard interface to the business object models in SAP without using an SAP transaction code user interface

    • Returns a collection of errors instead of individual errors

    • Each BAPI corresponds to a specific business object

    • May have related documentation available to explain format, structure, and behavior

       

      Notes:

      • Documentation can be accessed in the Documentation tab inside the Direct Workspace, View, and Map tabs, on the Workspace Ribbon, or via SAP's SE37 transaction.

      • It is very important to understand how the BAPI works to successfully interact with it.

 

When to use Direct

  • The only option to record an SAP transaction requires GUI scripting and there is a requirement to run the script in cases where GUI scripting is not supported - from a Automate server via scheduling or a web form

  • There is no SAP transaction available to handle requirements

  • Performance is a primary requirement (mass uploads, etc.)

  • When there is no way to position on a grid and/or the complexity of automation is too difficult

  • SAP screens present a variable number of popup windows

  • When using BAPI/RFMs are a personal preference

 

 

Features unavailable in Direct (unless specifically built in by developer)

  • Validate & Simulate

    • Workaround – check data or create a Validate/Test Run script

    • Advanced features:  long text, document attachments - (Workaround:  Leverage Automate RFMs)

    • Backup data - (Workaround:  Read data out of SAP prior to update with a BAPI)

    • Debug & Run with Stop on Errors

 

Differences from Transaction

  • SAP messages may be different and multiple messages may be returned

  • Loops are automatically included – editing and reuse of loop ID column possible

  • Case may be important

  • German input may be needed for some BAPIs/RFMs. Examples:

    1. Sold-To - English: “SP”  German: “AG”

    2. Ship-To     - English: “SH” German: “WE”

    3. The BAPI expects the German version

 

 

Preparation for using Direct

  • Find the BAPI/RFM you would like to use – options

    • SAP Community

    • Internet search

    • Query - Create a Query script on the SWOLTV SAP tableAdd like criteria to the ABAPNAME field

      Key Fields:

      1. ABAPNAME (Name of ABAP Function)

      2. DESCRIPT (Name)

      3. SHORTTEXT (Description)

      4. COUNTPARAM (Number of parameters in method)

      5. LOBJTYPE (Object Type)

      6. VERB (Object type component)

  • Verify the BAPI/RFM is remote enabled

  • User must have access to run the BAPI/RFM – permissions are key

  • Test in SE37 (optional)

    1. To select and test a BAPI/RFM from within SAP, user must have access SE37

    2. Test data with the BAPI/RFM using SE37

    3. Note: There may already be prior test data in SE37 you can use as reference

  • Identify required fields

  • Identify the fields you want to use

 

 Direct Tips

  • If you are not able to open standard SAP BAPI/RFM in Direct, check

    1. permissions

    2. if it is remote enabled

  • INPUT STRUCTURES - Data to be transferred to SAP

  • OUTPUT STRUCTURES - Data returned from SAP

  • TABLES - Used for both input and output

  • ImportOthers Table - Import parameters table

    1. Some may be required

    2. Matches the Import tab in SE37

  • ExportOthers Table - Export parameters table

    1. Matches the Export tab in SE37

  • BAPI/RFMs do not include user exits and other customizations present in the corresponding transaction code.  They must be added to a custom BAPI or to the Studio script and/or web form.

  • When selecting fields in the Workspace, the Expert View will automatically have a Loop created around each structure individually. In many cases, multiple structures should be called under a single loop, rather than multiple loops. You can delete the individual loops around structures and instead extend a single loop to cover all structures that need to be repeated.

    1. For example, in the Material Create BAPI, each view automatically starts with it’s own Loop. It is more likely that all the views should be created in a single call, so delete all of the loops except one, and then extend that remaining loop to cover all views.

  • In version 11 and higher, it is possible to flatten the structure of a BAPI by removing all loops, and you can copy and paste entire structures in the Expert View to make multiple call to a structure without a loop. You must select the entire structure, by clicking on the Blue/Green “Screen” line to be able to copy or paste.

  • Look for “X” tables – If you are using a BAPI that will write to SAP, look for tables that where there are two tables named the same except one name ends with an "X".  Not all BAPIs will have these types of tables, but if they exist, understand how to use them. 

    Example – The CONDITIONITEMDATAIN and CONDITIONITEMDATAINX tables in BAPI_CONDITION_CONTRACT_CREATE BAPI

    Map identity/distinct fields - To let the BAPI know which record to update the fields on, look for identity/distinct fields. 

    • Example:  ORDER_KEY, COND_COUNT, and UPDATE_FLAG are key fields in the CONDITIONITEMDATAIN and CONDITIONITEMDATAINX tables

      • These fields should contain the same data in both tables for each record and they can be mapped to the same column in the data template.

    Fields in the “X” table

    • Map a fixed value of "X" for every matching field mapped in the CONDITIONITEMDATAIN table.  Look for:

      • Description = “Updated information in related user data field”

      • Type = CHAR

      • Length = 2

        The X values are to denote which fields you’ll be working with in the corresponding table.  This makes the BAPI more efficient to execute, as there are tons of tables and fields in many BAPIs.

       

Create a Direct Script