SAP

Know the component and how to use it.

Rodrigo Lara avatar
Written by Rodrigo Lara
Updated over a week ago

IMPORTANT: This documentation has been discontinued. Read the updated SAP documentation on our new documentation portal.

SAP enables SAP connection (RFC only) for requirements dispatch.

Take a look at the configuration parameters of the component:

  • Account: it's necessary to create a BASIC-type account to use the SAP credentials (user and password).

  • SAP Operation: connection method in SAP - the component supports access via RFC or IDOC.

  • Host: hostname of the SAP system - for "IP" and "Port" to be supported, it's necessary to have connectivity via VPN (you can define VPN through SAP Gui).

    To resolve the hostname to an IP address, you must add a mapping entry to the host file of the machine on which the agent is installed.

  • RFC: name of the RFC used to connect with the SAP system - this field is informed by the client (the import parameters of the SAP funtion must be mapped).

  • Language: language to be used in the connection with the SAP system (ex.: "EN" for English).

  • Client ID: SAP Client ID, normally with 3 digits, used to connect with SAP.

  • System Number: normally with 2 digits, used to connect with the SAP system (you can find this information in SAP Gui).

  • Template (XML): template Apache FreeMarker for the SOAP message sent in the request.

  • Enviroment/SystemName/System Id: normally with 3 characters - you can find this information, that comes in a JSON file, in SAP Gui.

  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

             
We recommend you to set GLOBALS for the SAP ENVIRONMENT, as shown below:

  • Globals:

  • environment = SAP environment   

    

See the examples of the items listed, that must be replaced according to your need:

  • [rfc] = RFC name

  • [table] = Table related to RFC

  • [columns] = Table columns

     

USE RECOMMENDATION

Component structure for RFC connections

For RFC connections, use the "SAP Json to RFC" capsule before the SAP component. That way, the call is transformed in the format expected by SAP. This is an example of RFC call syntax inside SAP:

       

Function call (RFC) BAPI_BUPA_ADDRESS_GETDETAIL inside JSON Generator component

{
  "sid": "{{sap-test-sid}}",
  "rfc": "BAPI_BUPA_ADDRESS_GETDETAIL", 
  "importParameters": { 
    "attributes": { 
      "BUSINESSPARTNER": {{ message.BUSINESSPARTNER }}, 
      "VALID_DATE": {{FORMATDATE(NOW(), "timestamp", "yyyy-MM-dd", null , "GMT-3") }} 
    } 
  } 
}

       

For a RFC call, it's important to pay attention to the following points:

  • always inform Sid - field Enviroment/SystemName/System Id previously mentioned.

  • RFC field - can be in the JSON file, as well as informed inside the component. 

  • importParameters - function call inside SAP. Be specific only with the fields that must be filled out in the call.

         

About SAP IDOC             

  • IDOC: means Intermediate Document

  • IDOC Type: has a specific structure, that put into sequence the data transfered from one system to another.

  • IDOC TYPE EXTENSION (optional): specifies the IDOC extension, if it exists, of an IDOC produced by this endpoint.

  • SYSTEM RELEASE (optional): specifies the SAP Basis Release associated, if it exists, to an IDOC produced by this endpoint.

  • APPLICATION RELEASE (optional): specifies the Application Release associated, if it exists, to an IDOC produced by this endpoint. 

   

Component structure for the use of the Template XML field     

See an example of template (XML):

<?xml version="1.0" encoding="ASCII"?> 
<idoc:Document
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:FLCUSTOMER_CREATEFROMDATA01---="http://sap.fusesource.org/idoc/{_YOUR_ENVIRONMENT_}/FLCUSTOMER_CREATEFROMDATA01///"
    xmlns:idoc="http://sap.fusesource.org/idoc"
    creationDate="2015-01-28T12:39:13.980-0500"
    creationTime="2015-01-28T12:39:13.980-0500"
    iDocType="FLCUSTOMER_CREATEFROMDATA01"
    iDocTypeExtension=""
    messageType="FLCUSTOMER_CREATEFROMDATA"
    recipientPartnerNumber="QUICKCLNT"
    recipientPartnerType="LS"
    senderPartnerNumber="QUICKSTART"
    senderPartnerType="LS">
  <rootSegment xsi:type="FLCUSTOMER_CREATEFROMDATA01---:ROOT" document="/">
    <segmentChildren parent="//@rootSegment">
      <E1SCU_CRE parent="//@rootSegment" document="/">
        <segmentChildren parent="//@rootSegment/@segmentChildren/@E1SCU_CRE.0">
          <E1BPSCUNEW parent="//@rootSegment/@segmentChildren/@E1SCU_CRE.0"
              document="/"
              CUSTNAME="Fred Flintstone" FORM="Mr."
              STREET="123 Rubble Lane"
              POSTCODE="01234"
              CITY="Bedrock"
              COUNTR="US"
              PHONE="800-555-1212"
              EMAIL="fred@bedrock.com"
              CUSTTYPE="P"
              DISCOUNT="005"
              LANGU="E"/>
        </segmentChildren>
      </E1SCU_CRE>
    </segmentChildren>
  </rootSegment>
</idoc:Document>     

Important: {YOUR_ENVIRONMENT} must be replaced by your SAP SID.


If it's a single query, you can use the following syntax:

      

Elementary fields/Import Parameters

<?xml version="1.0" encoding="ASCII"?> 
<[rfc]:Request xmlns:[rfc]="http://sap.fusesource.org/rfc/{{global.environment}}/[rfc]" [columns]="20180801" [columns]="20180806" [columns]="050" />

Example:

<?xml version="1.0" encoding="ASCII"?> 
<ABCD_RFC_ORDEM_FATURA:Request xmlns:ABCD_RFC_ORDEM_FATURA="http://sap.fusesource.org/rfc/QAS/ABCD_RFC_ORDEM_FATURA" P_ERDAT_INI="2018-07-01T00:00:00.000" P_ERDAT_FIM="2018-08-01T00:00:00.000" CLIENTE="" VKORG="0010" AUART="" /> 

    

If it's a table query, use this syntax:  

Table fields

<?xml version="1.0" encoding="ASCII"?> 
<[rfc]:Request ">xmlns:[rfc]="http://sap.fusesource.org/rfc/{{global.environment}}/[rfc]"> 
 <[table]> 
  <row> 
   <[columns]>${VBELN}</[columns]> 
   <[columns]>${ABDC}</[columns]> 
  </row> 
 </[table]> 
</[rfc]:Request>


Example:

<?xml version="1.0" encoding="ASCII"?> 
<ABCD_RFC_MATERIAIS:Request ">xmlns:ABCD_RFC_MATERIAIS:Request="http://sap.fusesource.org/rfc/{{global.environment}}/ABCD_RFC_MATERIAIS:Request"> 
 <T_TIPO> 
  <row> 
   <MTART>${type}</MTART> 
  </row> 
 </T_TIPO> 
</ABCD_RFC_MATERIAIS:Request>

 

Input

{
  "body":{
    "type": "S"
  }
}

  • ${type}: variable that must be provided inside a tag "body"

For the variable sapRequestTemplate, it's important to pay attention to these points:

  • the variable name can have the following signs: minus (-), period (.) and colon (:) in any position. But these characters need to be escaped with backslash (\). Otherwise, they'll be interpreted as operators.

  • it might be more convenient to use variables and conversion functions:

<#assign x=42>
${x}
${x?string} <#-- the same as ${x} -->
${x?string.number}
${x?string.currency}
${x?string.percent}
${x?string.computer}

   
Output

42
42
42
$42.00
4,200%
42

Messages flow

      

Input

The component expects a message under any format. However, it will look for a path inside the "modelPath" configuration property.

Output

The output message will be the same as the input message, but replacing the model property according to the template definition (as a string). If there's an error, the "property_error" property will be created on the same level of the original property.

Did this answer your question?