Skip to main content
Skip table of contents

Function block/method definitions (X4 SAP JCo 3)

Read in this page how to assign an X4 process to RFC/BAPis within the SAP listener.

Within a specific XML document (e. g. <X4>/X4DB/0/jco_method_def.xml) you can assign via the JCo 3 Server  a corresponding X4 process for further processing for each function block (method), which is addressed by the SAP host.

XML structure for the SAP listener configuration

The SAP listener configuration file <X4>/X4DB/0/saplistener.xml references for each JCo 3 Server instance an XML document with function block/method definitions. Here, you can create any number of <method> elements within the root element <definitions> by following this pattern:

HTML/XML
<method>
  <name>Function block/method name</name>
    <wait_for_result>Boolean value</wait_for_result>
    <class>de.softproject.integration.sapjcoserver.requesthandlers.
           WorkflowStarter</class>
    <properties>
      <property name="workflowname">Path to the X4 process</property>
      <property name="userID">User folder within the X4DB</property>
      <property name="raw">Boolean value</property>
    </properties>
</method>

The following applies for each function block/method definition:

  • The element <name> contains the name of the function block (method) called by SAP; The placeholder * represents all other function blocks, for which no explicit function block has been defined. Moreover, transaction handlers can be defined here (see below).

  • Within the element <wait_for_result> you can configure whether SAP should wait for the result (false), or the function block/method call should be made asynchronously (true).

  • The element <class> specifies the used class, which is stored for the processing of the function block or method (by default de.softproject.integration.sapjcoserver.requesthandlers.WorkflowStarter for starting X4 processes); Within the child elements of <class> you specify the corresponding properties in an element <property>.

For the X4 process starter class, the following properties are specified:

  • workflowname: Path to the X4 process, which takes over the processing of the function block/method call

  • userID: Repository user folder containing the X4 process

  • raw: Process IDoc in raw format (true) or (false)

Compatibility notes

In older function block/method definitions you may find additional details within the elements <type> and <property name = "languageID">. They have no function and may be omitted therefore.

Note:

When migrating to JCo 3, please note that the attribute name within the element <property> was capitalized under JCo 2. However, under JCo 3 the attribute is lowercase.

Transaction handler for IDocs and BAPI calls

In X4 SAP JCo 3, the transaction handling has been integrated within the method definition. For processing incoming IDocs and BAPI calls, you can define a commit handler and a rollback handler and assign them to an X4 process by specifying within one of the method definitions the following values in the element <name>:

  • IDOC+COMMIT: End IDoc transaction (Commit)

  • IDOC+ROLLBACK: Cancel and reset IDoc transaction (Rollback)

  • BAPI+COMMIT: End BAPI transaction (Commit)

  • BAPI+ROLLBACK: Cancel and reset BAPI transaction (Rollback)

Global handler

If no specific handler applies, you can define a global handler, by entering an asterisk (*) within the element <name> in the method definition.

Example

In the following example the X4 process save_idoc.wrf is called for the function block (method) ORDERS05 and data in the IDoc raw format is provided for the downstream processing. In addition, a BAPI commit handler and a global handler are defined without an assigned X4 process.

HTML/XML
<method>
  <name>ORDERS05</name>
    <wait_for_result>false</wait_for_result>
    <class>de.softproject.integration.sapjcoserver.requesthandlers.
           WorkflowStarter</class>
    <properties>
      <property Name="workflowname">Project/Folder/ProcessIDoc.wrf</property>
      <property Name="userID">1</property>
      <property Name="raw">true</property>
    </properties>
</method>
<method>
      <name>BAPI+COMMIT</name>
      <type>0</type>
      <wait_for_result>false</wait_for_result>
      <class>de.softproject.integration.sapjco3server.requesthandlers.
             WorkflowStarter</class>
      <properties>
         <property name="workflowname">Project/Folder/BAPI_Commit.wrf</property>
         <property name="userID">1</property>
      </properties>
</method>
<method>
      <name>*</name>
      <type>1</type>
      <wait_for_result>false</wait_for_result>
      <class>de.softproject.integration.sapjco3server.requesthandlers.
             WorkflowStarter</class>
      <properties>
      </properties>
</method>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.