Monday, February 26, 2007

Using the Data Transfer Data Structure

If you want to write data to a batch input session or to process the data using CALL TRANSACTION USING or CALL DIALOG , you must prepare an internal table . This internal table must be structured according to ABAP Dictionary structure BDCDATA. The internal table stores the data that is to be entered into R/3 System and the actions that are necessary to process the data. You can think of the table as storing the script that the R/3 System is to follow in processing batch input data.

The graphic below shows how to declare the internal table in your ABAP program and the fields contained in the structure BDCDATA.

DATA: like BDCDATA OCCURS .

with HEADER LINE.

Process flow

  1. Declare internal table
  2. .
  3. Initialize the internal table before you call each new transaction.
  4. At the beginning of each new screen, you must maintain the module pool name
  5. , the screen number and a flag:

    <
    bdc_tab>-PROGRAM = .
    -DYNPRO = .
    -DYNBEGIN = 'X'.
    APPEND .
  6. For each field to which you want to assign values, insert an entry in the internal table. Specify the technical field name
  7. and the field content :

    -FNAM = .
    -FVAL = .
    APPEND .

    If the field is in a step loop or a table control, you must also specify the lines in which the input is to be entered. The field name extension displays the line number:

    -FNAM = 'fieldx(5)'.
  8. If you want to position the cursor on a particular field, enter the cursor position by filling field
  9. FNAM with the value BDC_CURSOR, and transferring into the field FVAL the technical name of the field where the cursor should be:

    -FNAM = 'BDC_CURSOR'.
    -FVAL = .
    APPEND .
    If you want to position the cursor on a field in a step loop or table control, you must also specify the lines in which the input is to be entered. The field name extension displays the line number:

    -FVAL = 'fieldx(5)'.
  10. Now specify which action is to be executed in this screen. You must determine the triggered function code
  11. and assign this with the field FVAL. Note that the character '/' should always be placed before the function key number. The character '=' must be placed before all other function codes.
    Assign value
    BDC_OKCODE to the field FNAM:

    -FNAM = ‘BDC_OKCODE’.
    -FVAL = .
    APPEND .
  12. Execute steps 3 to 6 for each additional screen in the transaction.
  1. After the last screen in the transaction, internal table
  2. is filled with all of the values required. You can now use this table to create an entry in a batch input session or to call the commands CALL TRANSACTION or CALL DIALOG.
    The transaction to which a BDCDATA structure refers is identified separately. If your program writes data to a batch input session, then the transaction is specified in the call to the BDC_INSERT function module. This function module writes a BDCDATA structure out to the session. If your program processes data with CALL TRANSACTION USING, then the transaction is specified directly in this statement.



0 Comments:

Post a Comment

<< Home