SAP Function CHANGEDOCUMENT_MULTIPLE_CASE - Change document: Create change document items (multiple case)

Parameter Reference Type Length Default Optional Text
CHANGE_INDICATOR 0 'U' X Change flag
DOCU_DELETE 0 SPACE X Flag for type of document creation when deleting
REFTABLENAME CDPOS-TABNAME C 30 SPACE X Name of the reference table structure
TABLENAME CDPOS-TABNAME C 30 Name of the table structure of object class

Parameter Reference Length Optional Text
TABLE_NEW 0 Table contains the changed data
TABLE_OLD 0 Table contains unchanged data

Exception Text
NAMETAB_ERROR Error when calling NAMETAB_GET
OPEN_MISSING No OPEN was carried out
POSITION_INSERT_FAILED An SQL error occurred with INSERT_item


INCLUDE 'DOCU_HAS_TO_BE_ELABORATED' OBJECT DOKU ID TX
(see also documentation on CHANGEDOCUMENT_OPEN)
The function module creates change document items.
The transferred tables must have the structure described in theinterface. Only fields that were defined as relevant to change documentin the ADIC are taken into account for the change document creation.
Example call:
DATA: BEGIN OF AUFTRAGSPOS_OLD OCCURS 20.
INCLUDE STRUCTURE .
DATA: KZ(1) TYPE C.
INCLUDE STRUCTURE .
DATA: END OF AUFTRAGSPOS_OLD.
DATA: BEGIN OF AUFTRAGSPOS_NEW OCCURS 20.
INCLUDE STRUCTURE .
DATA: KZ(1) TYPE C.
INCLUDE STRUCTURE .
DATA: END OF AUFTRAGSPOS_NEW.
DATA: OBJECTCLASS LIKE CDHDR-OBJECTCLAS,
OBJECTID LIKE CDHDR-OBJECTID,
REFNAME LIKE CDHDR-TABNAME,
TABLENAME LIKE CDHDR-TABNAME.
OBJECTCLASS = 'AUFTRAG'.
OBJECTID = '...'.
REFNAME = '...'.
TABLENAME = '...'.
CALL FUNCTION 'CHANGEDOCUMENT_OPEN' ...
Fill table AUFTRAGSPOS_OLD including reference fields
Determine table AUFTRAGSPOS_NEW including reference fields
CALL FUNCTION 'CHANGEDOCUMENT_MULTIPLE_CASE'
EXPORTING TABLENAME = TABLENAME
REFTABLENAME = REFNAME
CHANGE_INDICATOR = 'U'
TABLES TABLE_OLD = AUFTRAGSPOS_OLD
TABLE_NEW = AUFTRAGSPOS_NEW
EXCEPTIONS ...
CALL FUNCTION 'CHANGEDOCUMENT_CLOSE' ...
The change flag determines the processing logic of the function moduleand must have one of the following values:
  • "D" = DELETE

  • Change document items are to be created for the records in TABLE_OLD,which flag them as deleted.
    • "I" = INSERT

    • Change document items are to be created for the records in TABLE_NEW,which flag them as created.
      • "U" = UPDATE

      • The keys of TABLE_OLD and TABLE_NEW are compared. The following casescan arise for each record:
        Record exists with key in TABLE_OLD, but not in TABLE_NEW
        Change document items are to be created for the records in TABLE_OLD,which flag them as deleted.
        Record exists with key in TABLE_NEW, but not in TABLE_OLD
        Change document items are to be created for the records in TABLE_NEW,which flag them as created.
        Record with key exists in TABLE_OLD and in TABLE_NEW
        A change document is created for each field which has been changed, andis defined in ADIC as change document relevant
        The parameter determines how the document items are to be created fordeleted records:
        • "X"

        • A document item is created for every field in the deleted record.
          • " " (Space)

          • A document item is created only with the key of the deleted record.
            ADIC table name for units and currency fields (only specify ifrequired)
            The table structure must be defined in ADIC and have a key which doesnot contain any packed fields. The key must also be the first fields inthe table.
            The table must contain the new version of the changed or createdrecords.
            The table structure must be as follows:
            • Structure as specified under TABLENAME

            • Additional processing flags (TYPE C, length 1)

            • If specified, table structure of the table specified under REFTABLENAME

            • If a table line is to be deleted and re-created with the same key in thesame transaction, and if this is to be understood as delete and create,rather than change, then in this special case the processing flag musthave the value "I". Otherwise the processing flag must have the valueSPACE or "I" for INSERT, for newly created lines, and SPACE or "U" forUPDATE, for changed records.
              The table must be passed sorted by the key.
              The table must contain the old version of the changed or the deletedrecords.
              The table structure must be as follows:
              • Structure as specified under TABLENAME

              • additional processing flags (TYPE C, length 1)

              • if specified, table structure of the table specified under REFTABLENAME

              • The processing flags should be given the values SPACE or "D" forDELETE. Both values cause the same processing.
                The table must be passed sorted by the key.