遇到一个比较变态的需求,要用增强添加审核状态,就是用代码去生成VBAK-OBJNR或者VBAP-OBJNR。
在userexit_save_document_prepare 出口里用STATUS_OBJECT_CREATE创建一个临时对象编号,
例如‘TM0000000001VB‘,系统会自动去生成相应的审批对象,并替换成正式的OBJNR编号。
替换的函数为STATUS_OBJECT_SWITCH_NUMBER
CALL FUNCTION ‘STATUS_OBJECT_CREATE‘ EXPORTING chgkz = ‘X‘ * CLIENT = SY-MANDT objnr = ‘TM0000000001VB‘ "临时对象号 obtyp = ‘VBK‘ "对象类别 stsma = stsma "状态参数 * IONRA_IMP = * I_OBJECTKEY = * ONLY_E_STATUS = ‘ ‘ IMPORTING objnr = vbak-objnr * STONR = EXCEPTIONS obtyp_invalid = 1 status_object_already_exists = 2 stsma_invalid = 3 stsma_obtyp_invalid = 4 OTHERS = 5.
时间: 2024-10-06 00:53:26