FORM delete_routing_ewb USING f_plnty TYPE plko-plnty
f_plnnr TYPE plko-plnnr
f_plnal TYPE plko-plnal
f_matnr TYPE mapl-matnr
f_werks TYPE mapl-werks.
TYPE-POOLS: cpsc, czcl.
DATA: f_classes_in_workarea LIKE classes_in_workarea.
DATA: f_tsk_plnty_selection TYPE cpsc_plnty_type.
DATA: f_tsk_plnnr_selection TYPE cpsc_plnnr_type.
DATA: f_tsk_plnal_selection TYPE cpsc_plnal_type.
DATA: f_tsk_selection TYPE cpsc_tsk_sel_type.
DATA: f_tsk_ident TYPE cpcl_tsk_ident_type.
DATA: f_mtk_ident TYPE czcl_mtk_type.
* objects for loading
f_classes_in_workarea-mtk_inarea = 'X'.
f_classes_in_workarea-tsk_inarea = 'X'.
f_classes_in_workarea-seq_inarea = 'X'.
f_classes_in_workarea-opr_inarea = 'X'.
f_classes_in_workarea-suo_inarea = 'X'.
f_classes_in_workarea-prt_inarea = 'X'.
f_classes_in_workarea-com_inarea = 'X'.
f_classes_in_workarea-itm_inarea = 'X'.
f_classes_in_workarea-bom_inarea = 'X'.
* fill selection conditions
CONCATENATE 'I' 'EQ' f_plnty INTO f_tsk_plnty_selection.
APPEND f_tsk_plnty_selection TO f_tsk_selection-plnty.
CONCATENATE 'I' 'EQ' f_plnnr INTO f_tsk_plnnr_selection.
APPEND f_tsk_plnnr_selection TO f_tsk_selection-plnnr.
CONCATENATE 'I' 'EQ' f_plnal INTO f_tsk_plnal_selection.
APPEND f_tsk_plnal_selection TO f_tsk_selection-plnal.
* load objects into EWB
CALL FUNCTION 'CP_CC_S_LOAD_COMPLEX_BY_TSK'
EXPORTING
i_class = 'P'
i_classes_in_workarea = f_classes_in_workarea
i_cpsc_tsk_sel = f_tsk_selection
i_date_from = sy-datum
i_date_to = sy-datum
EXCEPTIONS
workarea_not_found = 1
workarea_wrong_type = 2
class_in_workarea_inconsistent = 3
workarea_not_specified = 4
opr_not_found = 5
no_selection_criteria = 6
invalid_selection_period = 7
key_date_required_for_ecm = 8
OTHERS = 9.
IF sy-subrc EQ 0.
"prepare ident for material task allocation
f_mtk_ident-mandt = sy-mandt.
f_mtk_ident-plnty = f_plnty.
f_mtk_ident-plnnr = f_plnnr.
f_mtk_ident-plnal = f_plnal.
f_mtk_ident-zkriz = f_plnal.
f_mtk_ident-matnr = f_matnr.
f_mtk_ident-werks = f_werks.
* f_mtk_ident-vbeln = f_vbeln.
* f_mtk_ident-posnr = f_posnr.
* f_mtk_ident-matnr_ext = .
"delete material-task allocation MAPL-LOEKZ
CALL FUNCTION 'CP_CC_S_DELETE_BY_MTK'
EXPORTING
* I_ECN_S = I_ECN_S
i_key_date_s = sy-datum
i_mtk_ident = f_mtk_ident
* IMPORTING
* E_TSK_LOCK = E_TSK_LOCK
* E_ECM_DATA_ERROR_TYPE = E_ECM_DATA_ERROR_TYPE
* E_OPR_LOCK = E_OPR_LOCK
EXCEPTIONS
no_authority = 1
no_authority_for_material = 2
no_valid_allocation = 3
no_key_date = 4
task_not_locked = 5
path_incomplete = 6
ecm_data_not_suitable = 7
no_authority_for_qm = 8
opr_not_locked = 9
OTHERS = 10.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
"prepare Task ident for deletion
f_tsk_ident-mandt = sy-mandt.
f_tsk_ident-plnty = f_plnty.
f_tsk_ident-plnnr = f_plnnr.
f_tsk_ident-plnal = f_plnal.
"delete routing (PLKO-LOEKZ)
CALL FUNCTION 'CP_CC_S_DELETE_BY_TSK'
EXPORTING
* I_ECN_S = I_ECN_S
i_key_date_s = sy-datum
i_tsk_ident = f_tsk_ident
* I_FLG_ECM_FILTER = ' '
* IMPORTING
* E_TSK_LOCK = E_TSK_LOCK
* E_ECM_DATA_ERROR_TYPE = E_ECM_DATA_ERROR_TYPE
EXCEPTIONS
no_authority = 1
no_valid_task = 2
no_key_date = 3
task_not_locked = 4
path_incomplete = 5
ecm_data_not_suitable = 6
reference_set_is_in_use = 7
OTHERS = 8.
IF sy-subrc EQ 0.
"save changes
CALL FUNCTION 'CP_CC_S_SAVE'
EXCEPTIONS
error_at_save = 1
OTHERS = 2.
IF sy-subrc EQ 0.
COMMIT WORK AND WAIT.
ELSE.
ROLLBACK WORK.
ENDIF.
ENDIF.
ENDIF.
"dequeue Task
CALL FUNCTION 'CP_CL_TSK_UNLOCK'
EXPORTING
* MODE_TSK_CLASS_LOCK = 'E'
* MANDT = SY-MANDT
plnty = 'N'
plnnr = f_plnnr
plnal = f_plnal
* X_PLNTY = ' '
* X_PLNNR = ' '
* X_PLNAL = ' '
_synchron = 'X'
* _COLLECT = ' '
* IMPORTING
* E_NAME = E_NAME
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc EQ 0.
ENDIF.
ENDFORM. "delete_routing_ewb
相关文章
- 12-03elasticsearch笔记(6) 删除文档delete-by-query
- 12-0308.02、js之对象属性-for...in 循环&添加&delete
- 12-0363、new和delete的实现原理, delete是如何知道释放内存的大小的额?
- 12-03springmvc get post put delete
- 12-03关于delete method的body
- 12-03Error:Execution failed for task ':app:clean'. > Unable to delete directory: ***/app/build/generated/***
- 12-03Docker:删除images报错(Error response from daemon: conflict: unable to delete 6885a5e3712a (must be force
- 12-03js中数组删除 splice和delete的区别,以及delete的使用
- 12-03js的splice和delete
- 12-03js之删除数组里的某个元素(delete/splice)