数据修改明细
作者:互联网
FUNCTION.
CALL FUNCTION 'CHANGEDOCUMENT_OPEN'
EXPORTING
OBJECTCLASS = 'ZSTRU'
OBJECTID = OBJECTID
PLANNED_CHANGE_NUMBER = PLANNED_CHANGE_NUMBER
PLANNED_OR_REAL_CHANGES = PLANNED_OR_REAL_CHANGES
EXCEPTIONS
SEQUENCE_INVALID = 1
OTHERS = 2.
CASE SY-SUBRC.
WHEN 0. "OK.
WHEN 1. MESSAGE A600 WITH 'SEQUENCE INVALID'.
WHEN 2. MESSAGE A600 WITH 'OPEN ERROR'.
ENDCASE.
IF UPD_ZTFI_YJPT_YJJLB NE SPACE.
IF ( O_ZTFI_YJPT_YJJLB IS INITIAL ) AND
( N_ZTFI_YJPT_YJJLB IS INITIAL ).
UPD_ZTFI_YJPT_YJJLB = SPACE.
ENDIF.
ENDIF.
IF UPD_ZTFI_YJPT_YJJLB NE SPACE.
CALL FUNCTION 'CHANGEDOCUMENT_SINGLE_CASE'
EXPORTING
TABLENAME = 'ZTFI_YJPT_YJJLB'
WORKAREA_OLD = O_ZTFI_YJPT_YJJLB
WORKAREA_NEW = N_ZTFI_YJPT_YJJLB
CHANGE_INDICATOR = UPD_ZTFI_YJPT_YJJLB
DOCU_DELETE = ''
DOCU_INSERT = ''
DOCU_DELETE_IF = ''
DOCU_INSERT_IF = ''
EXCEPTIONS
NAMETAB_ERROR = 1
OPEN_MISSING = 2
POSITION_INSERT_FAILED = 3
OTHERS = 4.
CASE SY-SUBRC.
WHEN 0. "OK.
WHEN 1. MESSAGE A600 WITH 'NAMETAB-ERROR'.
WHEN 2. MESSAGE A600 WITH 'OPEN MISSING'.
WHEN 3. MESSAGE A600 WITH 'INSERT ERROR'.
WHEN 4. MESSAGE A600 WITH 'SINGLE ERROR'.
ENDCASE.
ENDIF.
CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'
EXPORTING
OBJECTCLASS = 'ZSTRU'
OBJECTID = OBJECTID
DATE_OF_CHANGE = UDATE
TIME_OF_CHANGE = UTIME
TCODE = TCODE
USERNAME = USERNAME
OBJECT_CHANGE_INDICATOR = OBJECT_CHANGE_INDICATOR
NO_CHANGE_POINTERS = NO_CHANGE_POINTERS
EXCEPTIONS
HEADER_INSERT_FAILED = 1
OBJECT_INVALID = 2
OPEN_MISSING = 3
NO_POSITION_INSERTED = 4
OTHERS = 5.
CASE SY-SUBRC.
WHEN 0. "OK.
WHEN 1. MESSAGE A600 WITH sy-msgv1.
WHEN 2. MESSAGE A600 WITH 'OBJECT INVALID'.
WHEN 3. MESSAGE A600 WITH 'OPEN MISSING'.
* WHEN 4. MESSAGE A600 WITH 'NO_POSITION_INSERTED'.
* do not abort, if positions are not inserted!!!
WHEN 5. MESSAGE A600 WITH 'CLOSE ERROR'.
ENDCASE.
ENDFUNCTION.
CALL FUNCTION 'CHANGEDOCUMENT_OPEN'
EXPORTING
OBJECTCLASS = 'ZSTRU'
OBJECTID = OBJECTID
PLANNED_CHANGE_NUMBER = PLANNED_CHANGE_NUMBER
PLANNED_OR_REAL_CHANGES = PLANNED_OR_REAL_CHANGES
EXCEPTIONS
SEQUENCE_INVALID = 1
OTHERS = 2.
CASE SY-SUBRC.
WHEN 0. "OK.
WHEN 1. MESSAGE A600 WITH 'SEQUENCE INVALID'.
WHEN 2. MESSAGE A600 WITH 'OPEN ERROR'.
ENDCASE.
IF UPD_ZTFI_YJPT_YJJLB NE SPACE.
IF ( O_ZTFI_YJPT_YJJLB IS INITIAL ) AND
( N_ZTFI_YJPT_YJJLB IS INITIAL ).
UPD_ZTFI_YJPT_YJJLB = SPACE.
ENDIF.
ENDIF.
IF UPD_ZTFI_YJPT_YJJLB NE SPACE.
CALL FUNCTION 'CHANGEDOCUMENT_SINGLE_CASE'
EXPORTING
TABLENAME = 'ZTFI_YJPT_YJJLB'
WORKAREA_OLD = O_ZTFI_YJPT_YJJLB
WORKAREA_NEW = N_ZTFI_YJPT_YJJLB
CHANGE_INDICATOR = UPD_ZTFI_YJPT_YJJLB
DOCU_DELETE = ''
DOCU_INSERT = ''
DOCU_DELETE_IF = ''
DOCU_INSERT_IF = ''
EXCEPTIONS
NAMETAB_ERROR = 1
OPEN_MISSING = 2
POSITION_INSERT_FAILED = 3
OTHERS = 4.
CASE SY-SUBRC.
WHEN 0. "OK.
WHEN 1. MESSAGE A600 WITH 'NAMETAB-ERROR'.
WHEN 2. MESSAGE A600 WITH 'OPEN MISSING'.
WHEN 3. MESSAGE A600 WITH 'INSERT ERROR'.
WHEN 4. MESSAGE A600 WITH 'SINGLE ERROR'.
ENDCASE.
ENDIF.
CALL FUNCTION 'CHANGEDOCUMENT_CLOSE'
EXPORTING
OBJECTCLASS = 'ZSTRU'
OBJECTID = OBJECTID
DATE_OF_CHANGE = UDATE
TIME_OF_CHANGE = UTIME
TCODE = TCODE
USERNAME = USERNAME
OBJECT_CHANGE_INDICATOR = OBJECT_CHANGE_INDICATOR
NO_CHANGE_POINTERS = NO_CHANGE_POINTERS
EXCEPTIONS
HEADER_INSERT_FAILED = 1
OBJECT_INVALID = 2
OPEN_MISSING = 3
NO_POSITION_INSERTED = 4
OTHERS = 5.
CASE SY-SUBRC.
WHEN 0. "OK.
WHEN 1. MESSAGE A600 WITH sy-msgv1.
WHEN 2. MESSAGE A600 WITH 'OBJECT INVALID'.
WHEN 3. MESSAGE A600 WITH 'OPEN MISSING'.
* WHEN 4. MESSAGE A600 WITH 'NO_POSITION_INSERTED'.
* do not abort, if positions are not inserted!!!
WHEN 5. MESSAGE A600 WITH 'CLOSE ERROR'.
ENDCASE.
ENDFUNCTION.
标签:YJJLB,WHEN,明细,修改,ZTFI,A600,MESSAGE,数据,CHANGE 来源: https://www.cnblogs.com/hone201911/p/16473871.html