本文主要是介绍数据修改明细,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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.
这篇关于数据修改明细的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!