生活随笔
收集整理的這篇文章主要介紹了
使用代码删除Acquisition contract上指定IP的right scope
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Created by Jerry Wang, last modified on Oct 10, 2014
假設(shè)需要?jiǎng)h除第二個(gè)line item IP擁有的四個(gè)right scope:
執(zhí)行report:
刪除成功:
REPORT zassign_ip2.PARAMETERS:order TYPE crmd_orderadm_h-object_id OBLIGATORY DEFAULT '5600000010'.DATA: lo_core TYPE REF TO cl_crm_bol_core,lo_collection TYPE REF TO if_bol_entity_col,lv_query_name TYPE crmt_ext_obj_name,lt_selection_parameter TYPE genilt_selection_parameter_tab,ls_selection_parameter TYPE genilt_selection_parameter,lr_del_handler TYPE REF TO cl_crm_ipm_item_delete_handler,ls_query_parameters TYPE genilt_query_parameters.ls_selection_parameter-attr_name = 'OBJECTID'.
ls_selection_parameter-option = 'EQ'.
ls_selection_parameter-sign = 'I'.
ls_selection_parameter-low = order.
APPEND ls_selection_parameter TO lt_selection_parameter.ls_query_parameters-max_hits = 1.
lv_query_name = 'BTAdvQueryAUI'.lo_core = cl_crm_bol_core=>get_instance( ).
lo_core->load_component_set( 'BT' ).
lo_core->load_component_set( 'IPMRM' ).
lo_collection = lo_core->dquery(iv_query_name = lv_query_nameit_selection_parameters = lt_selection_parameteris_query_parameters = ls_query_parameters ).DATA(lo_contract) = lo_collection->get_current( ).
CHECK lo_contract IS NOT INITIAL.
DATA: lr_item_handler TYPE REF TO cl_crm_ipm_item_handler.
CREATE OBJECT lr_item_handler EXPORTING iv_header_bol_entity = lo_contract.DATA(ips) = lr_item_handler->get_all_ips( ).DATA(second_ip) = ips->find( iv_index = 2 ).
CHECK second_ip IS NOT INITIAL.DATA(ip_handler) = cl_crm_ipm_item_handler_provid=>get_instance( second_ip ).DATA(scope_collection) = ip_handler->get_rights_scopes( second_ip ).
CHECK scope_collection IS NOT INITIAL.DATA(ip) = cl_crm_ipm_order_item_entity=>get_instance( io_original = second_ip iv_ipm_admini_type = 'IP' ).
DATA(scope) = scope_collection->get_first( ).
WHILE scope IS NOT INITIAL.DATA(wrapped) = cl_crm_ipm_order_item_entity=>get_instance( io_original = scope iv_ipm_admini_type = 'RIGHTSCOPE' ).DATA(scope_handler) = cl_crm_ipm_item_handler_provid=>get_instance( wrapped ).CREATE OBJECT lr_del_handlerEXPORTINGir_item_handler = scope_handler.lr_del_handler->delete_scope( ir_ip = ipir_item = wrapped ).ip = cl_crm_ipm_order_item_entity=>get_instance( io_original = second_ip iv_ipm_admini_type = 'IP' ).scope = scope_collection->get_next( ).
ENDWHILE.lo_core->modify( ).DATA(lo_transaction) = lo_core->get_transaction( ).
CHECK lo_transaction->check_save_possible( ) = abap_true.CHECK lo_transaction->save( ) = abap_true.lo_transaction->commit( ).WRITE: / 'IP Right scope deleted successfully!'.
總結(jié)
以上是生活随笔為你收集整理的使用代码删除Acquisition contract上指定IP的right scope的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。