Syntax for an EXEC Statement

The following section describes grammar specifications for implementing EXEC statements against the .NET Framework Data Provider for mySAP Business Suite. Notice that in several cases, the syntax is somewhat different from Transact-SQL syntax.

EXEC rfc_name {<argument_element>} [ , …n ]  {;}[0,1] [ OPTION disabledatavalidation ]


  • rfc_name specifies the name of the function call to execute.

  • <argument_element> ::= @param_name = [0,1] <const> {[ INPUT | OUTPUT ]}[0,1]

    • param_name specifies the parameter name defined in the function interface.

    • <const> ::= integer | real | string | ? | NULL | xml_element

  • disabledatavalidation option sets the EnableSafeTyping binding property in the underlying SAP adapter. When safe typing is enabled the DATS, TIMS, and NUMC data types are represented as strings. For more information about this binding property, see Working with BizTalk Adapter 3.0 for mySAP Business Suite Binding Properties.

    In the preceding syntax, xml_element can be used to provide input for complex types. The xml element structure will be different for structures and tables. The xml_element for structure resembles the following:

        <FIELDNAME_1 xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">value</FIELDNAME_1>
        <FIELDNAME_2 xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">value</FIELDNAME_2>
    </ PARAM_NAME>
    The xml_element for table resembles the following:

        <STRUCT_NAME  xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">
        <STRUCT_NAME  xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">
    </ PARAM_NAME>
    For example, the XML element for a structure type resembles the following:

           <ACCPFIELD xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">2006</ACCPFIELD>
           <CHARFIELD xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">John</CHARFIELD>               
    Similarly, the XML element for a table type resembles the following:

    <ZZSTRUCTALLTYPES_RFC xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">
    <ZZSTRUCTALLTYPES_RFC xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">

For example statements, see Examples for EXEC Statement.

The following are guidelines for specifying named parameters in EXEC queries:

  • You must specify parameters by naming them (for example, @param_name=value).

    Unnamed parameters are not supported

  • When a parameter is defined using a default value, you can execute the procedure without specifying a parameter.

  • EXEC queries do not support using parameters with the following properties:

    • Nested structures (structures that contain structures as their fields).

    • Nested tables.

    • A table containing a structure.

    • A structure containing a table.

    • A structure or table that has fields with composite string types, for example SSTRING or RAWSTRING.

    The following table lists logical mappings between RFC parameter types and parameter directions when executing an RFC.

    RFC Param Type Query Keyword Parameter Direction

    Import parameters



    Export parameters



    Table parameters



The following are general guidelines for handling parameters:

  • You can specify parameter values either as constants or by using placeholders in the query.

  • When using placeholders in the query, you must create a SAPParameter object and add it to the corresponding command object. You then pass the placeholder name to the constructor; the direction and value depend on the context.

    • For Input parameters, do not specify in the query a keyword for the parameter direction. The value field of the parameter object must be set, or the provider will throw an exception. You must not explicitly set the direction field of the parameter object, because the provider defaults to Input.

    • For other parameters, use the form @paramname=@placeholder and specify the Output keyword explicitly in the query. You must then add a SAPParameter that corresponds with the placeholder and explicitly set the parameter direction to either ParamDirection.Output or ParamDirection.InputOutput, depending on the parameter type.

  • Parameter names and placeholder names are not case-sensitive.

  • Parameter names cannot be repeated in a query unless they have different directions.

  • Placeholder names cannot be repeated in a query.

This section lists the points that you must keep in mind when using the EXEC statement with Data Provider for SAP.

  • For an EXEC statement, the Data Provider for SAP returns TIMS field values as .NET System.DateTime objects.

    For a SELECT statement, the Data Provider for SAP returns TIMS field values as .NET System.TimeSpan objects. For more information about the SELECT statement, see Syntax for a SELECT Statement.