SAP

With the SAP adapter you can connect IYOPRO to your SAP.

Check and adjust the entries in the IYOPRO.SAP.config so that you have the correct destinations and their required parameters.

Example for the entries of the config:

Comma separated list of known destination names
<add key="destinations" value="T11,T12"/>
Parameters of the T11 destination as required
<add key="T11_USER" value="<USERNAME>"/>
<add key="T11_PASSWD" value="<PASSWORD>"/>
<add key="T11_CLIENT" value="500"/>
<add key="T11_LANG" value="DE"/>
<add key="T11_ASHOST" value="<IP address>"/>
<add key="T11_SYS_NR" value="01"/>

ConnectionManager

public class ConnectionManager

 Methods

RfcDestination GetDestination(string name)

Get config parameters for the specified destination name

RfcDebugger

public class RfcDebugger

 Properties

bool CallFailed

Indicates whether the call failed

 Methods

RfcDebugger(IRfcFunction func)

The constructor

string Call(RfcDestination dest, bool escapeResultForSQL = true, Encoding encodingToUse=null)

Returns log data as xml

Exception GetCallException()

Returns the call error if an exception occured

Example

This example gets the IP address as well as the log data of a specified function of a given destination.

#IYOPRO.Backend
import clr
clr.AddReferenceToFileAndPath(Session.GetAdapterPath("IYOPRO.SAP"))
from IYOPRO.SAP import *

dest = ConnectionManager.GetDestination("T11")

func = dest.Repository.CreateFunction("RFC_SYSTEM_INFO")
func.Invoke(dest)
si = func.GetStructure("RFCSI_EXPORT")

print "SI.RFCIPADDR", si.GetValue("RFCIPADDR")
print result:
SI.RFCIPADDR ...

ALTERNATIVE

func = dest.Repository.CreateFunction("RFC_SYSTEM_INFO")
logger = RfcDebugger(func)
logdata = logger.Call(dest, True)
si = func.GetStructure("RFCSI_EXPORT")

print "SI.RFCIPADDR", si.GetValue("RFCIPADDR")
print logdata
print result:
SI2.RFCIPADDR ...
<?xml version="1.0" encoding="utf-16"?>
<RfcCallDump Timestamp="2021-07-02T11:53:29.1387114+02:00" FunctionModule="RFC_SYSTEM_INFO">
  <Destination AppServerHost="..." AppServerService="" Client="500" Language="DE" MessageServerHost="" MessageServerService="" Name="T11" SAPRouter="" SystemId="" SystemNumber="01" User="RFC_PLMDEV" />
  <PreCall>
    <Function Name="RFC_SYSTEM_INFO">
      <IMPORTING />
      <EXPORTING>
        <Parameter Name="CURRENT_RESOURCES" Type="INT4" Length="4" Value="0" />
        <Parameter Name="FAST_SER_VERS" Type="INT4" Length="4" Value="0" />
        <Parameter Name="MAXIMAL_RESOURCES" Type="INT4" Length="4" Value="0" />
        <Parameter Name="RECOMMENDED_DELAY" Type="INT4" Length="4" Value="0" />
        <Structure Name="RFCSI" Type="STRUCTURE">
          <Field Name="RFCPROTO" Type="CHAR" Length="3" Value="" />
          <Field Name="RFCCHARTYP" Type="CHAR" Length="4" Value="" />
          <Field Name="RFCINTTYP" Type="CHAR" Length="3" Value="" />
          <Field Name="RFCFLOTYP" Type="CHAR" Length="3" Value="" />
          <Field Name="RFCDEST" Type="CHAR" Length="32" Value="" />
          <Field Name="RFCHOST" Type="CHAR" Length="8" Value="" />
          <Field Name="RFCSYSID" Type="CHAR" Length="8" Value="" />
          <Field Name="RFCDATABS" Type="CHAR" Length="8" Value="" />
          <Field Name="RFCDBHOST" Type="CHAR" Length="32" Value="" />
          <Field Name="RFCDBSYS" Type="CHAR" Length="10" Value="" />
          <Field Name="RFCSAPRL" Type="CHAR" Length="4" Value="" />
          <Field Name="RFCMACH" Type="CHAR" Length="5" Value="" />
          <Field Name="RFCOPSYS" Type="CHAR" Length="10" Value="" />
          <Field Name="RFCTZONE" Type="CHAR" Length="6" Value="" />
          <Field Name="RFCDAYST" Type="CHAR" Length="1" Value="" />
          <Field Name="RFCIPADDR" Type="CHAR" Length="15" Value="" />
          <Field Name="RFCKERNRL" Type="CHAR" Length="4" Value="" />
          <Field Name="RFCHOST2" Type="CHAR" Length="32" Value="" />
          <Field Name="RFCSI_RESV" Type="CHAR" Length="12" Value="" />
          <Field Name="RFCIPV6ADDR" Type="CHAR" Length="45" Value="" />
        </Structure>
        <Parameter Name="S4_HANA" Type="CHAR" Length="1" Value="" />
      </EXPORTING>
      <CHANGING />
      <TABLES />
      <EXCEPTIONS />
    </Function>
  </PreCall>
  <Call DurationInSeconds="0.000494" Status="Success" />
  <PostCall>
    <Function Name="RFC_SYSTEM_INFO">
      <IMPORTING />
      <EXPORTING>
        <Parameter Name="CURRENT_RESOURCES" Type="INT4" Length="4" Value="10" />
        <Parameter Name="FAST_SER_VERS" Type="INT4" Length="4" Value="1" />
        <Parameter Name="MAXIMAL_RESOURCES" Type="INT4" Length="4" Value="11" />
        <Parameter Name="RECOMMENDED_DELAY" Type="INT4" Length="4" Value="0" />
        <Structure Name="RFCSI" Type="STRUCTURE">
          <Field Name="RFCPROTO" Type="CHAR" Length="3" Value="011" />
          <Field Name="RFCCHARTYP" Type="CHAR" Length="4" Value="4103" />
          <Field Name="RFCINTTYP" Type="CHAR" Length="3" Value="LIT" />
          <Field Name="RFCFLOTYP" Type="CHAR" Length="3" Value="IE3" />
          <Field Name="RFCDEST" Type="CHAR" Length="32" Value="..." />
          <Field Name="RFCHOST" Type="CHAR" Length="8" Value="..." />
          <Field Name="RFCSYSID" Type="CHAR" Length="8" Value="..." />
          <Field Name="RFCDATABS" Type="CHAR" Length="8" Value="..." />
          <Field Name="RFCDBHOST" Type="CHAR" Length="32" Value="..." />
          <Field Name="RFCDBSYS" Type="CHAR" Length="10" Value="..." />
          <Field Name="RFCSAPRL" Type="CHAR" Length="4" Value="750" />
          <Field Name="RFCMACH" Type="CHAR" Length="5" Value=" 390" />
          <Field Name="RFCOPSYS" Type="CHAR" Length="10" Value="Linux" />
          <Field Name="RFCTZONE" Type="CHAR" Length="6" Value=" 3600" />
          <Field Name="RFCDAYST" Type="CHAR" Length="1" Value="X" />
          <Field Name="RFCIPADDR" Type="CHAR" Length="15" Value="..." />
          <Field Name="RFCKERNRL" Type="CHAR" Length="4" Value="753" />
          <Field Name="RFCHOST2" Type="CHAR" Length="32" Value="..." />
          <Field Name="RFCSI_RESV" Type="CHAR" Length="12" Value="" />
          <Field Name="RFCIPV6ADDR" Type="CHAR" Length="45" Value="..." />
        </Structure>
        <Parameter Name="S4_HANA" Type="CHAR" Length="1" Value="" />
      </EXPORTING>
      <CHANGING />
      <TABLES />
      <EXCEPTIONS />
    </Function>
  </PostCall>
</RfcCallDump>