我们已经实现了 BADI ZHR_INT_BAD_OM_INFTY 和方法 IN_UPDATE。现在,当一些用户保存他们的 OM 工作时,不会触发 IN_UPDATE 方法。
调试的问题在于,当您进入abap 调试器时,后台的“东西”会被提交。
我们的目标是列出最近的 OM 更改以进行 delta 检测。
我们实现的代码示例:
DATA:
lw_old_image LIKE LINE OF old_image,
lw_new_image LIKE LINE OF new_image,
ls_object TYPE hrobject.
"-- Check if there is anything interesing in the old image
LOOP AT old_image INTO lw_old_image
WHERE infty IN me->get_range_infotypes( )
AND begda LE sy-datum
AND endda GE sy-datum.
MOVE-CORRESPONDING lw_old_image TO ls_object.
"-- If an object has been detected, trigger the refresh
TRY.
zhr_cl_int_person_masterdata=>trigger_om_object_changed( zhr_cl_om_object=>get( im_plvar = ls_object-plvar
im_otype = ls_object-otype
im_objid = ls_object-objid ) ).
CATCH zcx_hr_om. " " Base class for OM objects
ENDTRY.
ENDLOOP.
"-- If nothing found, check if there is anything interesting in the new image
IF ls_object IS INITIAL.
LOOP AT new_image INTO lw_new_image
WHERE infty IN me->get_range_infotypes( )
AND begda LE sy-datum
AND endda GE sy-datum.
MOVE-CORRESPONDING lw_new_image TO ls_object.
"-- If an object has been detected, trigger the refresh
TRY.
zhr_cl_int_person_masterdata=>trigger_om_object_changed( zhr_cl_om_object=>get( im_plvar = ls_object-plvar
im_otype = ls_object-otype
im_objid = ls_object-objid ) ).
CATCH zcx_hr_om. " " Base class for OM objects
ENDTRY.
ENDLOOP.
ENDIF.