Copy IR2 SR

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

ICCMP_BT_INR UI wgląd IR

METHOD if_ex_crm_copy_badi~subject.

INCLUDE:
crm_object_names_con.

DATA: lv_asp_id TYPE crm_erms_cat_ca_id,


lv_cat_id TYPE crm_erms_cat_ca_id.
DATA: ls_object_link TYPE crmt_erms_cat_ob_update,
lv_cat_key TYPE crm_erms_cat_ob_extkey.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""

DATA:
lv_katalogart TYPE comt_catalog,
lv_codegruppe TYPE crm_qcodegrp,
lv_code TYPE crm_qcode,
lv_subject_profile TYPE crmt_subject_profile.

IF is_orderadm_h-process_type = zif_crm_common_constants=>gc_process_type-
interaction_record
AND is_ref_orderadm_h-process_type =
zif_crm_common_constants=>gc_process_type-service_request.

SELECT SINGLE category_ok~obj_extkey INTO @DATA(lv_cat_concat)


FROM crmc_erms_cat_ca AS category
JOIN crmc_erms_cat_ln AS category_ln ON category~cat_guid =
category_ln~cat_guid
JOIN crmc_erms_cat_ok AS category_ok ON category_ok~obj_guid =
category_ln~obj_guid
WHERE category~cat_id = @cs_subject-cat_id.

lv_katalogart = lv_cat_concat(2).
lv_codegruppe = lv_cat_concat+2(8).
lv_code = lv_cat_concat+10(4).

SELECT SINGLE subject_profile INTO lv_subject_profile


FROM crmc_activity_h WHERE process_type EQ
zif_crm_common_constants=>gc_process_type-interaction_record.

cs_subject-ref_kind = 'A'.
cs_subject-subject_profile = lv_subject_profile.
cs_subject-profile_type = 'F'.
cs_subject-katalogart = lv_katalogart.
cs_subject-codegruppe = lv_codegruppe.
cs_subject-code = lv_code.
cs_subject-asp_id = ''.
cs_subject-cat_id = ''.
cs_subject-katalog_type = ''.
cs_subject-catalog_type = 'F'.
ELSE.
lv_cat_key = cs_subject-katalogart && cs_subject-codegruppe && cs_subject-
code.

cl_crm_ml_category_util=>get_aspect(
EXPORTING
iv_ref_guid = is_ref_orderadm_h-guid " Header/Item
GUID
iv_ref_kind = cs_subject-ref_kind " HEADER/ITEM
iv_profile_type = cs_subject-profile_type " Subject
Profile Category
iv_catalog_type = cs_subject-catalog_type " Catalog
Category
iv_check_subj_prof = abap_true " Check the subject
profile for schema
iv_subject_profile = cs_subject-subject_profile " Subject
Profile
IMPORTING
er_aspect = DATA(lr_aspect) " Coherent Cat -
Categorization Aspect
).
CHECK lr_aspect IS BOUND.

lr_aspect->get_details(
IMPORTING
ev_asp = DATA(ls_asp) " Coherent Cat - Aspect
Buffer Linetype
).

SELECT SINGLE cat_id FROM crmc_erms_cat_ca AS category


JOIN crmc_erms_cat_ln AS category_ln ON category~cat_guid =
category_ln~cat_guid
JOIN crmc_erms_cat_ok AS category_ok ON category_ok~obj_guid =
category_ln~obj_guid
WHERE category~asp_guid = @ls_asp-asp_guid AND category_ok~obj_extkey =
@lv_cat_key
INTO @lv_cat_id.

lv_asp_id = ls_asp-asp-asp_id.

IF lv_cat_id IS NOT INITIAL.

DATA(ls_copy) = cs_subject.

CLEAR cs_subject.
cs_subject-guid = ls_copy-guid.
cs_subject-ref_guid = ls_copy-ref_guid.
cs_subject-ref_kind = ls_copy-ref_kind.
cs_subject-ref_handle = ls_copy-ref_handle.
cs_subject-handle = ls_copy-handle.
cs_subject-profile_type = 'A'.

cs_subject-asp_id = lv_asp_id.
cs_subject-cat_id = lv_cat_id.
cs_subject-katalog_type = cs_subject-catalog_type = 'D'.

READ TABLE ct_input_fields ASSIGNING FIELD-SYMBOL(<fs_input_fields>) WITH


KEY objectname = 'SUBJECT'.
IF sy-subrc = 0.
INSERT VALUE #( fieldname = 'ASP_ID' ) INTO TABLE <fs_input_fields>-
field_names.
INSERT VALUE #( fieldname = 'CAT_ID' ) INTO TABLE <fs_input_fields>-
field_names.
INSERT VALUE #( fieldname = 'CATALOG_TYPE' ) INTO TABLE
<fs_input_fields>-field_names.
ENDIF.
ENDIF.
ENDIF.

ENDMETHOD.

You might also like