SAP Function CHANGEDOCUMENT_SINGLE_CASE - Change document: Create change document items (single 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
REFAREA_NEW 0 SPACE X Work area with reference information
REFAREA_OLD 0 SPACE X Work area with reference information
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
WORKAREA_NEW 0 SPACE X Work area with changed contents
WORKAREA_OLD 0 SPACE X Work area with original contents

Exception Text
NAMETAB_ERROR Error when calling NAMETAB_GET
OPEN_MISSING No OPEN was carried out
POSITION_INSERT_FAILED SQL error occurred during 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 work areas must have the structure of the DDIC tablespecified under TABLENAME. For the change document creation, only thosefields that were defined as relevant to change document in DDIC aretaken into account.
Example call:
DATA: STCT_OLD ,,TYPE ,,TSTCT
,STCT_NEW,,TYPE ,,TSTCT
,OBJECTCLASS ,,LIKE ,,CDHDR-OBJECTCLASS
,OBJECTID ,,LIKE ,,CDHDR-OBJECTID
,, ,TABLENAME ,,LIKE ,,CDHDR-TABNAME.
OBJECTCLASS = 'TCODE'.
OBJECTID = 'XY47'.
TABLENAME = 'TSTCT'.
CALL FUNCTION 'CHANGEDOCUMENT_OPEN' ...
STCT_OLD = .
STCT_NEW = STCT_OLD.
STCT_NEW-TTEXT = ' ... ' .
CALL FUNCTION 'CHANGEDOCUMENT_SINGLE_CASE'
EXPORTING TABLENAME = TABLENAME
CHANGE_INDICATOR = 'U'
WORKAREA_OLD = STCT_OLD
WORKAREA_NEW = STCT_NEW
EXCEPTIONS ...
CALL FUNCTION 'CHANGEDOCUMENT_CLOSE' ...
The change flag determines the proccessing logic of the function moduleand must have one of the following values:
  • "D" = DELETE

  • A change document item is to be created to flag the record inWORKAREA_OLD as deleted.
    • "I" = INSERT

    • A change document item is to be created to flag the record inWORKAREA_NEW as newly created.
      • "U" = UPDATE

      • WORKAREA_OLD and WORKAREA_NEW are compared and a change document itemis created for each changed field. The keys of the two work areas mustbe identical.
        The parameter determines how the document positions are to be createdafter delete:
        • "X"

        • a document position is created for each field of the deleted record.
          • " " (Space)

          • document positions are only created with the key of the deleted record.
            The work area must have the structure of the table specified underREFTABLENAME and contain the current, possibly changed, currencies andunits.
            The work area must have the structure of the table specified underREFTABLENAME and contain the unchanged, old currencies and units.
            ADIC table name for units and currency fieldsr(only enter if required)
            The table structure must be defined in ADIC and have a key which doesnot contain packed fields. The key mustalso be the first fields in the table.
            The work area must have the structure of the table specified underTABLENAME and contain the data changed by the user.
            The work area must have the structure specified under TABLENAME andcontain the unchanged original data.