
Industry sector: SAP Grantor Management
SAP CRM Objects: SAP CRM Case Management and One Order Management - Applications
Business Scenario: As part of Grantor management process, fund manager reviewing a case having multiple applications, can approve or reject applications based on business criteria. Once the manual activity is complete and Case needs to be progressed further to initiate payments for approved applications. Rejected Applications need to be de-linked from case, so that they can be linked another case in future for further review if re-submitted. Manual de-link will be a cumbersome task for end user, to automate the de-linking process following logic can be used in a report.
Above scenario can vary from client to client.
How to De-link a One order object from SAP CRM CASE?
Data required:
- SAP CRM CASE object to be de-linked
- SAP CRM ONE ORDER Object to be de-linked
DATA : lr_crm_case TYPE REF TO if_crm_cmg_api,
ls_message TYPE crmt_cmg_error,
lt_rec_hier_tech TYPE crmt_cmg_rec_hier_tech_t,
lv_bor_key TYPE swo_typeid,
lt_link_message TYPE crmt_cmg_attr_error_t.
FIELD-SYMBOLS:
<fs_rec> TYPE crmt_cmg_rec_hier_all.
TRY.
* Open case in mode edit
CALL METHOD cl_crm_cmg_manager=>open_case
EXPORTING
iv_case_guid = <CASE GUID>
iv_activity = if_scmg_authorization=>c_activity_modify
IMPORTING
er_crm_case = lr_crm_case
es_message = ls_message.
IF lr_crm_case IS Bound.
* Get Elements
CALL METHOD lr_crm_case->get_elements
EXPORTING
iv_no_model_nodes = abap_true
iv_relation = <relationship> ( example = 'CJ')
IMPORTING
et_rec_hier_tech = lt_rec_hier_tech
et_rec_hier_all =
lt_rec_hier_all
es_message = ls_message.
LOOP AT lt_rec_hier_all ASSIGNING <fs_rec>.
* Check if data in <fs_rec>-info6 is the linked one order to SAP CRM CASE.
MOVE <fs_rec>-bor_key TO lv_bor_key.
CALL METHOD lr_crm_case->delete_element
EXPORTING
iv_bor_key = lv_bor_key
iv_bor_type = <fs_rec>-bor_type
iv_model_node = <fs_rec>-model_id
iv_instance_id = <fs_rec>-inst_id
IMPORTING
es_message = ls_message.
ENDLOOP.
CALL METHOD lr_crm_case->save
IMPORTING
et_message_with_attr = lt_link_message.
COMMIT WORK
*Close the Opened case
CALL METHOD cl_crm_cmg_manager=>close_case
EXPORTING
iv_case_guid = <fs_case>-case_guid
IMPORTING
es_message = ls_message.
ENDIF.
CATCH cx_sy_ref_is_initial.
RETURN.
ENDTRY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.