change document

 http://help.sap.com/saphelp_nw70/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/frameset.htm

For changes to a commercial object to be able to be logged in a change document, the object must have been defined in the system as a change document object. A change document object definition contains the tables which represent a commercial object in the system. The definition can also specify whether the deletion of individual fields is to be documented. If a table contains fields whose values refer to units and currency fields, the associated table, containing the units and currencies, can also be specified.

It must be specified for each table, whether a commercial object contains only one (single case) or several (multiple case) records. For example, an order contains an order header and several order items. Normally one record for the order header and several records for the order items are passed to the change document creation when an order is changed.

The name under which a change document object is created is an object class.

Example

The object class BANF was defined for the change document object "Purchase requisition", which consists of the tables EBAN (purchase requisition) and EBKN (purchase requisition account assignment).

Changes to this commercial object can then be saved in the system under the object values of this change document object, i.e. the object ID and a change document number. The object ID is the key to the object value, i.e. all records which are defined as belonging to a given change document object.

All changes to a commercial object constitute an object value under this key. This is for example the order number for orders or the number range object name for number range objects. All changes to a given order or to a given number range object can be accessed in this way.

Example

The object value BANF with the object ID "3000000000" consists of the records of the tables EBAN and EBKN with the order number "3000000000".

If changes are not yet to be made, but are planned, they can be logged as planned changes. A planned date for the changes can be specified. The planned changes can be analyzed and copied into the tables. You must program the copy yourself.

All logging functions are supported by SAP function modules. The application development must contain certain INCLUDE programs. Old and new status are passed to the change document creation. The included function modules determine the changes for all table fields which are flagged as being change-relevant in the Dictionary.

Change document

A change document logs changes to a commercial object. The document is created independently of the actual database change. The change document structure is as follows:

    • Change document header

    The header data of the change to an object ID in a particular object class are stored in the change document header. The change document number is automatically issued.
    • Change document item

    The change document item contains the old and new values of a field for a particular change, and a change flag.
    The change flag can take the following values:
      • U(pdate)
      Changed data. (Log entry for each changed field which was flagged in the Dictionary as "change document-relevant")
      • I(nsert)
      • D(elete)
      • I(ndividual field documentation)

      Data inserted.
      Changes: Log entry for the whole table record
      Planned changes: Log entry for each table record field
      Data were deleted (log entry for the whole table record) Delete a table record with field documentation
      1 log entry per field of the deleted table entry, the deleted text is saved
    • Change document number
    The change document number is issued when a change is logged, i.e. when the change document header is created by the change document creation function module (function group SCD0).

Caution

The change number is not the same as the change document number. The change document number is issued automatically by the function group SCD0 function modules when a change document is created for a change document object. The change number is issued by the user when changes are planned. The same change number can be used for various change document objects.

Internal processing

When the object-specific update is called, the object-specific change document creation is called. The object-specific change document header is written with a change document number. The Dictionary is searched for which fields are to be logged for each table in the object definition. The log records for these fields are then created as change document items according to the object definition.

 Define change document object Locate the document in its SAP Library structure

Proceed as follows:

  1. Call the change document maintenance transaction (Tools
  2. Choose the menu option Create.
  3. Enter a name for the change document object which is to be created. It can be any name starting with "Y" or "Z" (customer name area).
  4. Choose Continue. A new window for inputting the associated tables appears.
  5. Enter a descriptive short text for the change document object.
  6. Make the following entries for each table whose changes are to be logged in the change document for this change document object:

    -

    -

    -

    -

    -

    Name of the old record fields
    Only possible for single case, i.e. when passing change data in a work area: If you do not want to use the * work area, enter an alternative work area name here.
    Ref. table name. (Name of the reference table)
    If the currency and unit fields are defined in a reference table, rather than in the table passed, you must pass the name of the reference table, and the field referred to, to the function module. Create an INTTAB structure in the Dictionary, and define fields for this structure, which are made up of the names of the associated reference table and the reference fields.
    Enter the name of this structure here.
    In the individual case, the reference information is passed in the form of two extra work areas (old, new). In the collective case, the internal tables are extended to include the reference structure.
    Doc. for individual fields at delete flag
    If you want separate log entries for each field when data are deleted, mark this field. If it is not marked, the deletion of all relevant fields is entered in one document item.
    Copy as internal table flag.
    If the change data are to be passed in an internal table (multiple case), mark this field. If it is not marked, the change data are passed in a work area (single case).
    Table name
    Name of the table, as defined in the Dictionary
  7. After inputting all relevant tables, choose Insert entries. The new entries are copied into the display.
  8. Save your entries.
® ABAP/4 Workbench ® Development ® Other tools ® Change doc. object

Transport change document object

The change document objects are a transport object type, a change request is made when the object is created.

During transport the object-specific update is generated in the target system.

Set change document flag Locate the document in its SAP Library structure

Now check whether the change document flag is set for the corresponding data element in the Dictionary for the fields whose changes are to be logged. This is necessary so that the object-specific function modules can identify which field of the defined object should be entered in the change document during logging.

If the flag is not set, you can change it. The flag becomes effective after the activation.

Caution

If the flag is set by hand, it can have undesirable side-effects: If a table field in another application, which is based on the data element in question, belongs to a change document object, but was not previously logged, setting the flag will start logging in this application as well.
It is therefore important to consider whether data elements are, or could be, change-relevant when creating them, and to set the flag accordingly. If the data element is not in any change document object via a table field, this has no negative effect on the system.

Generate Update and INCLUDE Objects Locate the document in its SAP Library structure® ABAP/4 Workbench ® Development ® Other tools ® Change documents

 

CHANGEDOCUMENT_OPEN

CHANGEDOCUMENT_SINGLE_CASE and/or

CHANGEDOCUMENT_MULTIPLE_CASE and possibly

CHANGEDOCUMENT_TEXT_CASE

CHANGEDOCUMENT_CLOSE

 

      • F<K4>CDC

      INCLUDE

      <table name>

      INCLUDE

      KZ

      INCLUDE

      <ref. table name>

      INCLUDE program part with FORM statement for calling the object-specific update program.

    • F<K4>CDT

INCLUDE program part containing two INCLUDE program parts (F<K4>CDF and F<K4>CDV, see below), which contain the data definitions which are to be passed to the update program. The data definitions correspond to the function group SCD0 function modules interface definition. The fields, record fields and tables are to be filled in in the application program and passed to the update program.

    • F<K4>CDF

INCLUDE program part with data definitions which are the same for all change document objects.

      • F<K4>CDV

      INCLUDE program part with data definitions, which are specific to the change document object.

      • V<Dictionary structure name >
      (only for multiple case tables)

This structure comprises the following INCLUDE structures:

 

 

The generated program parts contain the object-specific program code, and are included in the application program per INCLUDE statement. The data definitions of the change document-relevant fields correspond to the function group SCD0 function module interface definitions.

Caution

If several change document objects are to be processed in one application program, the update program must be generated for each change document object with a different <K4> code (e.g. XX01, XX02, XX03 etc.).

).

The generation creates INCLUDE objects, which contain general and specific data definitions and the program logic for the update function module. Proceed as follows:

  1. Call the change document maintenance transaction (Tools
  2. Position the cursor on a change document object and choose the menu option Generate update pgm. A dialog box, in which you must make the following entries, is displayed:

    maximum 26 character INCLUDE name

    This 26-character name (<K4>) is used to complete the name of the generated INCLUDE program parts.

    Function group

    Enter the name of the function group to which the change document update program is to belong. If this function group does not yet exist in the system, it is automatically created during generation. Exactly one function group must belong to each change document object. Other function modules may not be assigned to this function group.

    FM structure prefix (12-char.)

    Multiple-case table transfer structures are created at generation. Their names are constructed from this prefix and the name of the multiple case tables. A value is proposed.

    An update-compatible function parameter must not be longer than 28 characters, so the prefix and the longest table name must not be longer than 28 characters together.

    Error message ID

    The application-specific error messages generated are stored under this message ID (work area). A value is proposed.

    Error number

    Number with which errors occurring in connection with this change document object can be identified in the system. A value is proposed.

    Processing type

    Update type flag:

    – immediate

    – delayed

    – in dialog

    Special text handling flag

    Select this field to log long text changes.

    The old and new status of long texts is not logged. Only the fact that they have been changed is noted.

  3. Choose Generate.

    The following INCLUDE objects are generated:

      • <Change document object>_WRITE_DOCUMENT

      The object-specific update function module calls the following function modules with object-specific parameters:

). An overview of existing change document objects is displayed.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值