REPORT zorder_delete.
PARAMETERS: id TYPE crmd_orderadm_h-object_id OBLIGATORY DEFAULT '1616',type TYPE crmd_orderadm_h-process_type OBLIGATORY DEFAULT 'OPPT'.
DATA: lv_guid TYPE crmt_object_guid,lt_delete TYPE crmt_object_guid_tab,lt_deleted TYPE crmt_return_objects,lt_saved LIKE lt_deleted,lt_exception TYPE crmt_exception_t,lv_type TYPE crmd_orderadm_h-process_type,lv_id TYPE crmd_orderadm_h-object_id.START-OF-SELECTION.lv_id = id.lv_type = type.SELECT SINGLE guid FROM crmd_orderadm_h INTO lv_guid WHERE object_id = lv_id AND process_type = lv_type.IF sy-subrc <> 0.WRITE: / 'No order found' COLOR COL_NEGATIVE.RETURN.ENDIF.APPEND lv_guid TO lt_delete.CALL FUNCTION 'CRM_ORDER_DELETE'EXPORTINGit_objects_to_delete = lt_deleteiv_update_task_local = abap_trueiv_no_check = abap_falseIMPORTINGet_deleted_objects = lt_deletedet_exception = lt_exceptionEXCEPTIONSsingle_deletion_error = 1deletion_error = 2no_authority = 3document_not_found = 4.IF sy-subrc <> 0.WRITE: / 'Deletion failed, error code: ' , sy-subrc COLOR COL_NEGATIVE.ELSE.WRITE: / 'No error found after CRM_ORDER_DELETE call ' COLOR COL_POSITIVE.ENDIF.LOOP AT lt_deleted ASSIGNING FIELD-SYMBOL(<deleted>).WRITE: / 'Deleted object: ' , <deleted>-object_id COLOR COL_TOTAL.ENDLOOP.LOOP AT lt_exception ASSIGNING FIELD-SYMBOL(<exception>).WRITE:/ 'Error message class: ' , <exception>-class, ' id: ', <exception>-code COLOR COL_POSITIVE.ENDLOOP.COMMIT WORK AND WAIT.