The Dynamic Transaction function module is a mapping tool and dynamic code
generator. It uses SAP's Call Transaction API to get data into an
SAP application. Also, it stores static definitions of Batch Data
Communication (BDC) sessions by object/verb combinations. Before the
BDC data is passed to a Call Transaction, the business object attribute values
are mapped into the BDC session. At the completion of the call
transaction, the resulting key value is set in the appropriate value of the
business object, and all messages from the call transaction are logged.
- Note:
- If the Call Transaction fails, the connector does not store a BDC session in
SAP for reprocessing. Obsolete versions of the connector agent did
store a BDC session; however, using the stored session led to
inconsistencies in cross-referencing and request processing.
The Dynamic Transaction function module builds a BDC session to do a call
transaction by combining the BDC defined in the Dynamic Transaction table,
YXR_CHANGE, and the values from the incoming business
object. When the Dynamic Transaction function module is called, the
following steps are performed:
- All entries are retrieved from YXR_CHANGE, where:
object name =
objectName and verb =
objectVerb
- Field input values are mapped from the business object into the BDC
session based on the attribute name.
- BDC sessions are processed using Call Transaction.
- Key values are captured, Call Transaction messages are logged, and the key
is set in the business object.
- Note:
- Before you can generate a business object definition, you must create a
WebSphere business object using the IBM WebSphere InterChange Server Connector
Tools Window (YXR1).
- Data entered on an initial screen may default for all line items and
reduce required line item input.
- Line item overview screens may provide enough input rather than drilling
down to a details screen which may require additional input.
- Confirmation messages usually do not need to be answered in BDC; for
example, Are you sure you
want to save?
- The counter renumbers in increments of 10, for each object and verb
combination, every time you enter and exit the table maintenance in change
mode.
- During execution, the Call Transaction uses the user's settings for
date formatting. Be sure the connector user is set up to use a
variation of YYYY-MM-DD date format. This is the standard
date format used by the WebSphere business integration system.
Similarly, change your own user settings if you want to reprocess the business
objects by stepping through the transaction.
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.
- Go to the transaction that supports your object and identify the
transaction code.
- Identify the BDC elements for the screen and input fields you
require.
- Identify the menu command you need to continue processing to the next
screen.
- Repeat steps 2 and 3 for each screen required.
- Conclude by noting the command to save the transaction.
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):
- Go to the IBM WebSphere InterChange Server Connector Tools window
(transaction YXR1).
- From the Customizing menu, click Call Transaction, and click Modify
Create, Update.
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 14 shows the Dynamic Transaction table for an SAP
CustomerMaster business object to create a customer (transaction XD01).
Figure 14. Dynamic transaction for SAP CustomerMaster business object

Using the Counter column as a line number for discussion, step through the
SAP CustomerMaster example.
- 100
- Begin with screen number 100 of program SAPMF02D. This
is a new screen, the first, so it is flagged in the Start column.
- 110
- On screen 110, use the value from the Customer_account_group attribute in
the business object, and add it to the BDC field name column (the value is
RF02D-KT0KD). Specify the default value as
0001. If the Customer_account_group attribute contains
CxIgnore, then the BDC field name column receives the default value
0001
- 120
- The Customer_Account_Number attribute is the key value, so it is not set
during the Call Transaction. SAP assigns the key value internally and
makes it available only after the transaction is successfully posted.
For this reason, leave the BDC field name column blank, but include an entry
in the table because the Customer_Account_Number attribute must be set with
this key value when it is returned at the conclusion of the Call
Transaction. Also enter the word RETURN in the Program
column for CustomerNumber.
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 14 illustrates a 1 in the Return column, which
indicates that SY-MSGV1 contains the Customer Number.
- 130
- You are finished entering the necessary values for the first screen, so
enter a command, /00, in the Default Value column to simulate
pressing the Enter key. This takes you to the next transaction
screen. Commands are entered in the screen input field,
BDC_OKCODE, which is where you enter in a transaction code.
- 140
- At this point, you are at the next transaction screen. Enter the
address information. Since it is a new screen, flag it in the Start
column. In this example, the second screen is associated with the same
program as the initial screen, and only the screen number changed from 100 to
110. This is not always the case.
- 150 -210
- use the values from the Name_1, Sort_field, City, P_0_Box_postal_code,
Country_key, Language_keys, and Post_office_box attributes in the business
object, and add corresponding values to the BDC field name column.
- 220
- Similar to line 130, processing for this screen is complete.
However, rather than simply simulating the Enter key, enter the command value
UPDA to save the transaction. This takes you to the next
transaction screen.
- 230
- At this point, you are at the third transaction screen, so flag it in the
Start column. Because your business object does not require data from
this screen, you will complete processing for this screen in the next
line.
- 240
- Similar to line 130, processing for this screen is complete. Enter
the command value /00 to simulate pressing the Enter key.
This takes you to the final transaction screen.
- 250
- At this point, you are at the final transaction screen. Flag it in
the Start column.
- 260
- Similar to lines 150-210. Use the value from the business object
attribute, Transport_zone_to_which_or_from_which_the_goods
_are_delivered, and add its corresponding value (KNA1-LZONE) to
the BDC field name column.
- 270
- Similar to line 220, processing for this screen is complete and the
transaction is complete, so enter the command value to save,
UPDA. This is the last action the Call Transaction API
receives.
- 280
- The final entry for any business object is always the specification of the
transaction code. The keyword TCODE goes in the Program
column and the transaction code goes in the BDC field name column.
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.
- The SAP application has called a screen that the BDC did not expect, so
the SAP application returns the message, No input
available for program XX
and screen YY. If this occurs, add the
appropriate entries to the Dynamic Transaction table to handle the input
screen for program XX and screen YY.
- The SAP application is instructed by the BDC to set a field that does not
exist. Most likely, the SAP application executed its own instruction
that you did not explicitly set. As a result, you are on a different
screen than you intended. If this occurs, repeat the instruction and
add only the piece that sends you to the appropriate screen.
