Composing a BDC session requires an understanding of an SAP transaction's design. An SAP transaction allows the same data to be input in various sequences and on different screens. Typically each sequence or flow exposes additional functionality. As a result, certain data validation and input field requirements occur on some screens, but not on others. The challenge is to find the sequence that does what you need with the least amount of effort. A simple BDC session is more stable than a complex BDC session.
An SAP transaction may behave differently when accessed using the Call Transaction method in a background process instead of executing online. For example, different or additional screens may appear or input fields may reside on different screens than your online investigation revealed. The discrepancy occurs because the transaction's controlling code may dictate different behavior when executed in the background instead of executing online. As a result, your online test may work when reprocessing a failed object event as you step through the transaction, however, the connector consistently fails when processing the same object. If this occurs, modify the BDC so that it processes in the background. If you modify the BDC, you may encounter cases where the BDC processes in the background, but now fails when processed online.
The BDC you define in the Dynamic Transaction table is static. It cannot react during the transaction if certain input data causes other screens to pop-up or other fields become mandatory during runtime. Proper investigation of a transaction's configuration is important to be able to predict consistent behavior. Experiment several times with the transaction; repeated behavior can become your guideline.
Once you have determined the screen flow, follow the steps below and document the information you gather in a spreadsheet.
Table 13 describes the column names for Dynamic Transaction table YXR_CHANGE.
Table 13. YXR_CHANGE Table Entries for Dynamic Retrieve
Field Name | Description | When Used | Technical Name |
---|---|---|---|
Object Name | WebSphere business object name | Always | OBJ_NAME |
Verb | Verb (Create, Update, Delete, or Retrieve) | Always | OBJ_VERB |
Counter | Counter | Always | POSNR |
Program | Program associated with a screen | BDC screen identification | PROG_NAME |
ScNo | Screen number associated with a screen | BDC screen identification | DYNPRO |
Start | Specifies a new screen | BDC screen identification | DYNBEGIN |
BDC field name | BDC input field name | BDC input fields | FNAM |
Default Value | A static default value to use if no entry is provided in the WebSphere business object, or if using BDC_OKCODE, because it is the command value | A value might not always be passed in and it is mandatory for the transaction | DEFLT_VAL |
SY Field | A dynamic system field to be used as a default value (for example: DATUM) | A value is not passed in or should be determined by SAP system fields | SYFIELD |
Return | A numeric, 1-4, that identifies which system message field returns the key value at transaction completion (sy-msgv#) | A business object key attribute that should receive the key value | RETURNFLD |
Field Name in business object | Attribute in the WebSphere business object to supply the input value | BDC input fields | SOURCEFLD |
Length | Character length from the zero position of the attribute value that should be used for input | Only relevant when using an attribute that contains a composite value | LENGTH |
To define or modify a business object's metadata (transferring information to YXR_CHANGE):
Defining the metadata for the business object is simple. For each screen, the first entry identifies the screen, the following entries identify the input fields, and the last entry must be a command. This grouping repeats for each screen.
Figure 16 shows the Dynamic Transaction table for an SAP CustomerMaster business object to create a customer (transaction XD01).
Figure 16. Dynamic
transaction for SAP CustomerMaster business object
Using the Counter column as a line number for discussion, step through the SAP CustomerMaster example.
Depending on the transaction, SAP returns the key value in one of four possible fields: SY-MSGV1, SY-MSGV2, SY-MSGV3 or SY-MSGV4. To specify that you want the return value set in a particular attribute, enter a number, 1-4, in the Return column. This number corresponds to the SY-MSGV# field containing the key value. For example, Figure 16 illustrates a 1 in the Return column, which indicates that SY-MSGV1 contains the Customer Number.
This completes the definition of the BDC Session for the SAP4_CustomerMaster business object.
If a Call Transaction returns an error message when it fails, you could have one of the common errors described below.