Integration with Other Applications > Info*Engine Adapters > SAP Adapter Guide > SAP Webject Library > Execute-RFC
  
Execute-RFC
Description
This webject is used to execute a given Remote Function Call (RFC) or BAPI function module
Syntax
<ie:webject name="Execute-RFC" type="ACT">
<ie:param name="ATTRIBUTE" data="[attribute | class.attribute]"/>
<ie:param name="AUTOCOMMIT" data="[true | false]"/>
<ie:param name="CONNECTION_ATTEMPTS" data="attempts"/>
<ie:param name="CONNECTION_ATTEMPT_INTERVAL" data="interval"/>
<ie:param name="DBUSER" data="dbuser_name"/>
<ie:param name="FIELD" data="[field | class.field]"/>
<ie:param name="GROUP_OUT" data="group_out"/>
<ie:param name="INSTANCE" data="instance"/>
<ie:param name="PASSWD" data="dbpassword"/>
<ie:param name="RFC" data="value"/>
<ie:param name="SESSION_ID" data="$(<value>[]session_id[])"/>
</ie:webject>
Parameters
Required
Select
Optional
INSTANCE
ATTRIBUTE
RFC
AUTOCOMMIT
CONNECTION_ATTEMPTS
CONNECTION_ATTEMPT_INTERVAL
DBUSER
FIELD
GROUP_OUT
PASSWD
SESSION_ID
ATTRIBUTE
Specifies the requested export parameters. An export parameter can represent a simple parameter, an attribute of a structure, or a column of a table. If the ATTRIBUTE parameter is to represent a table or structure, then use a period to separate the identifiers - for example, as in “MATNRSELECTION.MATNR_HIGH”. In this example, we want to get the parameter ‘MATNR_HIGH’of the table ‘MATNRSELECTION’. This parameter is optional.
AUTOCOMMIT
Specifies whether the auto-commit functionality should be enabled or disabled. If the value is set to true and the execution of a given RFC is successful, then the adapter internally executes an RFC named “BAPI_TRANSACTION_COMMIT”. However, if the execution of a given RFC is not successful, then the adapter internally executes an RFC named “BAPI_TRANSACTION_ROLLBACK”. If the value is set to false, then after a given RFC is executed, the adapter does not executes either of the RFCs “BAPI_TRANSACTION_COMMIT” or “BAPI_TRANSACTION_ROLLBACK”. The default value for this parameter is true. This parameter is optional.
CONNECTION_ATTEMPTS
Defines the maximum number of times to attempt establishing a connection to an adapter before returning an error. The default value is 1. This parameter is optional.
If multiple INSTANCE parameter values are specified, the value of CONNECTION_ATTEMPTS defines the maximum number of times to iterate through the list of adapter instances.
CONNECTION_ATTEMPT_INTERVAL
Defines the amount of time, in seconds, to delay between connection attempts. The default value is 60 seconds. This parameter is optional.
If multiple INSTANCE parameter values are specified, the value of CONNECTION_ATTEMPT_INTERVAL defines the number of seconds to wait between the attempts to iterate through the entire list of adapter instances.
DBUSER
Specifies the user name to use when authenticating to the SAP system. If this parameter is specified in this webject, the webject value takes precedence over any value specified in the credentials mapping settings or in the adapter LDAP entry. If this parameter is not specified here, it must be specified in the credentials mapping settings or in the adapter LDAP entry. For more information about credentials mapping, see the section Credentials Mapping. This parameter is optional.
FIELD
Specifies the requested import parameters. An import parameter can represent a simple parameter, a column of a table, or an attribute of a structure. If the FIELD parameter is to represent a table or structure, then use a period to separate the identifiers. For example, by setting FIELD as “MATNRSELECTION.MATNR_HIGH=z,” the parameter ‘MATNR_HIGH’ of the table ‘MATNRSELECTION’ is set to ‘z’.
The order of FIELD parameters representing a table is significant because the order of parameters is used to demarcate rows. A recurrence of the first FIELD parameter for a particular table signifies a new row. See the following example:
<PARAM NAME="FIELD" DATA="ITEM_DATA.IDNRK=MATERIAL-A"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.MENGE=22"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.POSNR=0100"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.POSTP=L"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.IDNRK=MATERIAL-B"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.MENGE=1"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.POSNR=0200"/>
<PARAM NAME="FIELD" DATA="ITEM_DATA.POSTP=L"/>
The first four values are associated with one row. The second four values, due to the recurrence of the ITEM_DATA.IDNRK specification, are associated with a second row.
It is important to understand the parameter constraints for the desired function module. Specifying data for a field which exceeds the field length may cause the webject to fail. This parameter is optional.
GROUP_OUT
Identifies the group returned by the webject. The group would typically contain the data that the user has requested through the ATTRIBUTE parameter. This parameter is optional.
* 
Currently there is a limitation with using the Display-Table webject after the usage of the Execute-RFC webject. In order to use the Display-Table webject after using the Execute-RFC webject, the user needs to specify either simple parameters, attributes of one structure, or columns of one table in the ATTRIBUTE parameters in order to view the data appropriately.
INSTANCE
Specifies the name of the adapter that executes the webject. Adapter names are defined when the adapter is configured for use in your Info*Engine environment. This parameter is required.
PASSWD
Specifies the password to use when authenticating to the SAP system. If this parameter is specified in this webject, the webject value takes precedence over any value specified in the credentials mapping settings or in the adapter LDAP entry. If this parameter is not specified here, it must be specified in the credentials mapping settings or in the adapter LDAP entry. For more information about credentials mapping, see the section Credentials Mapping. This parameter is optional.
RFC
The name of the Remote Function Call to execute. This parameter is required.
SESSION_ID
Specifies the identifier of the session in which the webject is executed. This parameter is required in order to execute this webject in a transaction.
The user may specify a value for this webject parameter as shown below:
<ie:param name="SESSION_ID" data="$(<value>[]session_id[])"/>
The above syntax makes use of dynamic parameter value substitution, where <value> is the value provided by the user for the webject parameter GROUP_OUT in the Start-Transaction webject that was used to start the given transaction.
* 
If the GROUP_OUT parameter is not specified in the Start-Transaction webject, then the user needs to explicitly provide the value for SESSION_ID parameter.
Example
1. This example searches for RFCs whose names begin with “RFC_” by executing RFC_FUNCTION_SEARCH.
<%@page language="java" session="false" errorPage="IEError.jsp"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<html>
<head><title>Execute-RFC Webject</title></head>
<body bgcolor="#ABCDEF">
<h2>Execute-RFC "RFC_FUNCTION_SEARCH"</h2>

<ie:webject name="Execute-RFC" type="ACT">
<ie:param name="INSTANCE" data="sapAdapter"/>
<ie:param name="RFC" data="RFC_FUNCTION_SEARCH"/>
<ie:param name="FIELD" data="FUNCNAME=RFC_*"/>
<ie:param name="FIELD" data="LANGUAGE=E"/>
<ie:param name="ATTRIBUTE" data="FUNCTIONS.FUNCNAME"/>
<ie:param name="ATTRIBUTE" data="FUNCTIONS.GROUPNAME"/>
<ie:param name="ATTRIBUTE" data="FUNCTIONS.APPL"/>
<ie:param name="ATTRIBUTE" data="FUNCTIONS.HOST"/>
<ie:param name="ATTRIBUTE" data="FUNCTIONS.TEXT"/>
<ie:param name="GROUP_OUT" data="RFC-FUNCTIONS"/>
</ie:webject>

<ie:webject name="Display-Table" type="DSP"/>

</body></html>
2. This example fetches the details associated with a given material by executing BAPI_MATERIAL_GET_DETAIL.
<%@page language="java"session="false"errorPage="IEError.jsp"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core"prefix="ie"%>
<html>
<head>
<title>Execute-RFC Webject</title>
</head>
<body bgcolor="#ABCDEF">
<h2>Execute-RFC "BAPI_MATERIAL_GET_DETAIL</h2>

<ie:webject name="Execute-RFC" type="ACT">
<ie:param name="INSTANCE" data="sapAdapter"/>
<ie:param name="RFC" data="BAPI_MATERIAL_GET_DETAIL"/>
<ie:param name="FIELD" data="MATERIAL=T-FT100"/>
<ie:param name="FIELD" data="PLANT=1100"/>
<ie:param name="ATTRIBUTE" data="MATERIAL_GENERAL_DATA.MATL_DESC"/>
<ie:param name="ATTRIBUTE" data="MATERIAL_GENERAL_DATA.MATL_TYPE"/>
<ie:param name="ATTRIBUTE" data="MATERIAL_GENERAL_DATA.IND_SECTOR"/>
<ie:param name="ATTRIBUTE" data="MATERIAL_GENERAL_DATA.CREATED_ON"/>
<ie:param name="ATTRIBUTE" data="MATERIAL_GENERAL_DATA.CREATED_BY"/>
<ie:param name="GROUP_OUT" data="RFC-FUNCTIONS"/>
</ie:webject>

<ie:webject name="Display-Table" type="DSP"/>

</body>
</html>
Inputs:
The import parameters in this example are simple parameters named MATERIAL and PLANT, and these are set to values T-FT100 and 1100 respectively. These should both exist in SAP at the time of executing the webject. The PLANT import parameter is an optional one.
Outputs:
The export parameters are:
MATERIAL_GENERAL_DATA.MATL_DESC
MATERIAL_GENERAL_DATA.MATL_TYPE
MATERIAL_GENERAL_DATA.IND_SECTOR
MATERIAL_GENERAL_DATA.CREATED_ON
MATERIAL_GENERAL_DATA.CREATED_BY
The table output is:
MATERIAL_GENERAL_DATA
The column outputs are:
MATL_DESC
MATL_TYPE
IND_SECTOR
CREATED_ON
CREATED_BY
The table can have multiple columns and you can choose the export parameters by specifying the column names as needed.
3. This example creates a BOM in SAP by executing CSAP_MAT_BOM_CREATE:

<%@page language="java" session="false" errorPage="IEError.jsp"%>
<@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<html>
<head>
<title>Execute-RFC Webject</title>
</head>
<body bgcolor="ABCDEF">

<h2> Execute-RFC "CSAP_MAT_BOM_CREATE" </h2>

<ie:webject name="Execute-RFC" type="ACT">
<ie:param name="INSTANCE" data="sapAdapter"/>
<ie:param name="RFC" data="CSAP_MAT_BOM_CREATE"/>
<ie:param name="FIELD" data="MATERIAL=MATERIAL1"/>
<ie:param name="FIELD" data="BOM_USAGE=1"/>
<ie:param name="FIELD" data="FL_COMMIT_AND_WAIT=X"/>
<ie:param name="ATTRIBUTE" data="BOM_NO"/>
<ie:param name="GROUP_OUT" data="OUTPUT"/>
</ie:webject>

<ie:webject name="Display-Table" type="DSP"/>

</body>
</html>
Inputs:
One of the import parameters in this example is a simple parameter named MATERIAL, which is set to the value MATERIAL1. It should exist in SAP at the time of executing the webject. All three parameters in the example (including BOM_USAGEand FL_COMMIT_AND_WAIT) are required parameters. Refer to the documentation associated with RFC execution for details.
Outputs:
BOM_NO is the export parameter.
* 
The adapter CD has certain other examples of the Execute-RFC webject. These execute BAPIs and RFCs such as:
BAPI_DOCUMENT_CHANGE
BAPI_DOCUMENT_CREATE
BAPI_DOCUMENT_DELETE
BAPI_MATERIAL_GET_LIST
BAPI_MATERIAL_SAVEDATA
BAPI_ROUTING_CREATE
CCAP_ECN_CREATE
CSAP_MAT_BOM_READ