FUNCTION zf_service_004.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_GUID) TYPE CRMT_OBJECT_GUID OPTIONAL
*" VALUE(IV_OBJECT_ID) TYPE CRMT_OBJECT_ID_DB OPTIONAL
*" VALUE(IV_PROCESS_TYPE) TYPE CRMT_PROCESS_TYPE_DB OPTIONAL
*" EXPORTING
*" VALUE(E_ERROR) TYPE CRMT_GENIL_MESSAGE_TAB
*" VALUE(E_MESSAGE) TYPE SYMSGTY
*"----------------------------------------------------------------------
DATA: lv_guid TYPE crmt_object_guid.
DATA: lv_root TYPE REF TO cl_crm_bol_entity.
DATA: lv_save TYPE c .
DATA: lv_commit TYPE c .
DATA: ls_error TYPE crmt_genil_message .
***************************************************************************
e_message = 'E' .
CLEAR lv_guid .
IF iv_guid IS INITIAL.
SELECT SINGLE guid FROM crmd_orderadm_h
INTO lv_guid
WHERE object_id = iv_object_id
AND process_type = iv_process_type.
ELSE .
lv_guid = iv_guid .
ENDIF.
IF lv_guid IS NOT INITIAL.
DATA: lv_bol_core TYPE REF TO cl_crm_bol_core.
lv_bol_core = cl_crm_bol_core=>get_instance( ).
lv_bol_core->start_up( 'ONEORDER' ).
lv_root = lv_bol_core->get_root_entity( iv_object_name = 'BTOrder'
iv_object_guid = lv_guid ). "#EC NOTEXT
ENDIF.
IF lv_root IS BOUND AND lv_root->lock( ) = abap_true.
lv_bol_core->root_delete( lv_root ). "重点
* lv_root->delete( ).
lv_bol_core->modify( ).
DATA: lv_transaction TYPE REF TO if_bol_transaction_context.
lv_transaction = lv_bol_core->get_transaction( ).
CLEAR: lv_save,lv_commit .
lv_save = lv_transaction->save( ).
IF lv_save = 'X' .
lv_commit = lv_transaction->commit( ).
CHECK lv_commit = 'X' .
e_message = 'S' .
ELSE .
IF lv_guid IS NOT INITIAL.
CALL FUNCTION 'CRM_ORDER_DEQUEUE'
EXPORTING
iv_guid = lv_guid.
ENDIF.
ENDIF.
ELSE .
ls_error-type = 'E' .
CONCATENATE '订单' iv_object_id '被锁定或者不存在!' INTO ls_error-message .
APPEND ls_error TO e_error. CLEAR ls_error .
ENDIF.
ENDFUNCTION.
阅读(536) | 评论(0) | 转发(0) |