The file bapi.xml contains a list of all input and output fields as well as the SAP tables belonging to the module.
<?xml version="1.0" encoding="UTF-8"?>
<jobsapbapi bapiId="Z_ACC_DOCUMENT_POST" bapiName="CONST_Z_ACC_DOCUMENT_POST_NAME"
bapiDescription="CONST_Z_ACC_DOCUMENT_POST_DESCRIPTION">
<input>
<field name="OBJ_TYPE" table="DOCUMENTHEADER" description="CONST_Z_ACC_DOCUMENT_POST_FIELD_OBJ_TYPE"
required="true" />
<field name="COMP_CODE" table="DOCUMENTHEADER" description="CONST_Z_ACC_DOCUMENT_POST_FIELD_COMP_CODE"
required="true" />
<field name="BUS_ACT" table="DOCUMENTHEADER" description="CONST_Z_ACC_DOCUMENT_POST_FIELD_BUS_ACT"
required="true" />
<field name="CREDIT_NOTE" table="DOCUMENTHEADER" type="xflag"
description="CONST_Z_ACC_DOCUMENT_POST_FIELD_CREDIT_NOTE" />
<field name="PSTNG_DATE" table="DOCUMENTHEADER" type="date"
description="CONST_Z_ACC_DOCUMENT_POST_FIELD_PSTNG_DATE" required="true" />
<field name="USERNAME" table="DOCUMENTHEADER" userdefined="true"
description="CONST_Z_ACC_DOCUMENT_POST_FIELD_USERNAME" />
<field name="SAP_USERNAME" table="DOCUMENTHEADER" userdefined="true"
description="CONST_Z_ACC_DOCUMENT_POST_FIELD_SAP_USERNAME" />
<field name="DOC_DATE" table="DOCUMENTHEADER" type="date"
description="CONST_Z_ACC_DOCUMENT_POST_FIELD_DOC_DATE" required="true" />
Root element jobsapbapi
Field |
Description |
|---|---|
bapiId |
Name of the function module (corresponds to the name in the SAP system) |
bapiName |
Label of the JobLink for SAP module (displayed, e.g., in the module selection list of the system activity) |
bapiDescription |
Description of the JobLink for SAP module (displayed, e.g., in the system activity as additional text) |
Element input
The element contains individual fields and list elements with item fields. They are used as input parameter of the system activity or form element and passed to the function module of the SAP system.
Element output
The element contains individual fields and list elements with item fields. They are used as output parameter of the system activity or the form element. They can be used to save values returned from the SAP system into the JobRouter database.
</input>
<output>
<field name="FISCALYEAR" description="CONST_Z_ACC_DOCUMENT_POST_FIELD_FISCALYEAR" />
<field name="INVOICEDOCNUMBER" description="CONST_Z_ACC_DOCUMENT_POST_FIELD_INVOICEDOCNUMBER" />
</output>
<tables>
Element field
Individual fields are defined here.
Each Field element has the following attributes:
Field |
Description |
|---|---|
name |
Field name (as defined in the SAP system) |
table |
Table in the SAP system containing the field. The table is listed in a tables element. |
description |
Description of the field. Displayed, e.g., as tooltip in the system activity configuration. |
type |
Data type of the field. The following data types can be used: •date - Date values in the format (yyyy-mm-dd) •decimal - Decimal numbers •xflag - passes an "X" to the SAP system, if a 1 or "x" is written into the field •fixLengthChar:<Length>:<Fill character> - defines the length of an input and the fill character. The definition fixLengthChar:10:0 states, that the input is to be 10 chars long, filled with 0 from the left. |
required |
Indicator if the field is required. |
userdefined |
User defined fields that can be treated separately in the PHP file of the module (e.g. USERNAME or SAP_USERNAME). |
amount |
A user-defined attributed used in the example module. In case of a credit and if the attribute is set to true, the value of this field will be passed to the SAP system with a minus sign. |
The attributes name and table are required. Apart from them, any attribute can be added but has to be treated separately in the respective bapi.php files.
The Table attribute receives the value HEAD in case of unstructured data, meaning it is not assigned to a table. The table HEAD is not listed in the tables element. This example shows how this table is used in the JobLink for SAP module Z_INCOMINGINVOICE_CHANGE:
<?xml version="1.0" encoding="UTF-8"?>
<jobsapbapi bapiId="Z_INCOMINGINVOICE_CHANGE" bapiName="Z_INCOMINGINVOICE_CHANGE_NAME"
bapiDescription="Z_INCOMINGINVOICE_CHANGE_DESCRIPTION">
<input>
<field name="FISCALYEAR" table="HEAD" description="CONST_Z_INCOMINGINVOICE_CHANGE_FIELD_FISCALYEAR"
required="true" />
<field name="INVOICEDOCNUMBER" table="HEAD" description="CONST_Z_INCOMINGINVOICE_CHANGE_FIELD_INVOICEDOCNUMBER"
required="true" />
Element list
Item fields are defined inside a list element. The list element has the following attributes:
Field |
Description |
|---|---|
id |
Unique ID. The ID can be used to link the list to a table (Attributes inputList and outputList) |
name |
Name |
description |
Description |
<list id="items" name="CONST_Z_ACC_DOCUMENT_POST_LIST_ITEMS_NAME"
description="CONST_Z_ACC_DOCUMENT_POST_LIST_ITEMS_DESCRIPTION">
<field name="GL_ACCOUNT" table="ACCOUNTGL" type="fixLengthChar:10:0"
description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_GL_ACCOUNT" />
<field name="COSTCENTER" table="ACCOUNTGL" type="fixLengthChar:10:0"
description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_COSTCENTER" />
<field name="WBS_ELEMENT" table="ACCOUNTGL" description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_WBS_ELEMENT" />
<field name="ITEM_TEXT" table="ACCOUNTGL" description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_ITEM_TEXT" />
<field name="TAX_CODE" table="ACCOUNTGL" description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_TAX_CODE" />
<field name="ITEM_AMOUNT" table="CURRENCYAMOUNT" userdefined="true"
description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_ITEM_AMOUNT" amount="true" />
<field name="ALLOC_NMBR" table="ACCOUNTGL" description="CONST_Z_ACC_DOCUMENT_POST_ITEMS_ALLOC_NMBR" />
</list>
Element tables
SAP tables addressed by function modules are listed here. The definition of the tables can be found in the SAP BAPI documentation. Using the transaction code "se37" opens the dialog Function Builder: Initial Screen. After entering Z_ACC_DOCUMENT_POST into the "function module" field, an overview over the function module will be displayed. The tables can be found in the tabs Import, Export and Tables.
Each Table element has the following attributes:
Field |
Description |
|---|---|
name |
Table name (as defined in the SAP system) |
inputList |
Links the table with a list element from the input using the ID (optional) |
outputList |
Links the table with a list element from the output using the ID (optional) |
</output>
<tables>
<table name="DOCUMENTHEADER" />
<table name="ACCOUNTPAYABLE" />
<table name="ACCOUNTGL" inputList="items" />
<table name="ACCOUNTTAX" />
<table name="CURRENCYAMOUNT" inputList="items" />
<table name="EXTENSION1" />
<table name="ACCOUNTRECEIVABLE" />
<table name="ACCOUNTWT" />
<table name="CONTRACTHEADER" />
<table name="CONTRACTITEM" />
<table name="CRITERIA" />
<table name="CUSTOMERCPD" />
<table name="EXTENSION2" />
<table name="PAYMENTCARD" />
<table name="REALESTATE" />
<table name="RETURN" outputList="returnItems"/>
<table name="VALUEFIELD" />
</tables>
Element include
Next to simple JobLink for SAP modules, the Include element allows to define combined modules. The modules included with the Element element will be processed sequentially. The return values of the first function can be used as input of the next function.
Please note: The combined functions are not transactional, this means, if the second function fails, the changes of the first function will not be reversed. However, if the first function fails, the second one will no longer be executed.
<?xml version="1.0" encoding="UTF-8"?>
<jobsapbapi bapiId="Z_ACC_DOCUMENT_CHANGE" bapiName="CONST_Z_ACC_DOCUMENT_CHANGE_NAME"
bapiDescription="CONST_Z_ACC_DOCUMENT_CHANGE_DESCRIPTION">
<include>
<element name="Z_ACC_DOCUMENT_DELETE"/>
<element name="Z_ACC_DOCUMENT_POST"/>
</include>
</jobsapbapi>