Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

/CCM/CTLG_ENRICHMENT - ENRICH_ITEM method sample

Hi

I have a requirement to update some catalog characteristic values while transferring from SRM to CCM. We had to do this because some of the caharacteristics are not availble in COMMPR01 transaction so we had to retrieve from R/3 and populate in a BADI. I am using BADI /CCM/CTLG_ENRICHMENT ENRICH_ITEM method. I wrote a simple prottype by hardcoding characteristic value to see if concept works what i am doing is reading the item data populating additional characteristic and then updating the item back. ALl the logs are green but material is not transferred. No errors found during transfer but can't find the material in CCM if i comment the BADI everything works fine i can see material transferred.

SO i am looking for a perfect BADI that someone did before and works in production environment if anyone has it.

Below is my code that was written

method /ccm/if_ex_ctlg_enrichment~enrich_item.

***************************

  • DEFAULT CODING START!!! *

***************************

data:

lr_item_enrichment type ref to /ccm/cl_complete_catalog,

lr_enrich_exc type ref to /ccm/cx_enrichment_failed,

lr_fatal_exc type ref to /ccm/cx_fatal_error,

lr_base_exc type ref to /ccm/cx_catalog_base,

lv_dummy type string. "#EC NEEDED

try.

lr_item_enrichment = /ccm/cl_complete_catalog=>get_instance(

ir_catalog_manager = ir_catalog_manager ).

lr_item_enrichment->complete_item_operation( iv_guid =

iv_item_guid

iv_operation =

iv_item_op ).

catch /ccm/cx_enrichment_failed into lr_enrich_exc.

*---- enrichment failed => forward exception

raise exception lr_enrich_exc.

catch /ccm/cx_fatal_error into lr_fatal_exc.

*---- fatal error => rollback the enrichment and forward exception

call method /ccm/cl_complete_catalog=>rollback_on_error.

raise exception lr_fatal_exc.

catch /ccm/cx_catalog_base into lr_base_exc.

*---- other exception in enrichment process => rollback the enrichment

*---- and wrap it into internal exception

call method /ccm/cl_complete_catalog=>rollback_on_error.

message e100(/ccm/ctlg_enrichment) into lv_dummy.

raise exception type /ccm/cx_internal_error

exporting

previous = lr_base_exc

t100_msgid = sy-msgid

t100_msgno = sy-msgno.

endtry.

*************************

  • DEFAULT CODING END!!! *

*************************

data: lv_msg type string, "#EC NEEDED

lr_item_manager type ref to /ccm/cl_item_manager,

ls_item_data type /ccm/s_component_api,

ls_item_req_data type /ccm/s_component_api_x,

ls_char_value type /ccm/s_char_value_api,

lr_cat_ex type ref to /ccm/cx_catalog_base,

gr_ctlg_mngr type ref to /ccm/cl_catalog_manager,

iv_guid type /ccm/object_guid.

*

try.

gr_ctlg_mngr = ir_catalog_manager.

  • get item manager

lr_item_manager = gr_ctlg_mngr->get_item_manager( ).

  • get supplier id

ls_item_req_data-char_value_req = abap_true.

ls_item_data = lr_item_manager->get_item_data( iv_guid = iv_guid

is_req_data = ls_item_req_data ).

  • fill characteristic for contract id

ls_char_value-id-id = '/CCM/CONTRACT_ID'. "co_ros_partner.

ls_char_value-id-context = gr_ctlg_mngr->gs_curr_catalog-guid.

ls_char_value-value = '10000'.

ls_char_value-op =

/ccm/cl_data_access_constants=>co_operation_create.

append ls_char_value to ls_item_data-char_value_tab.

lr_item_manager->update_item( iv_guid = iv_guid

it_char_value = ls_item_data-char_value_tab ).

catch /ccm/cx_catalog_base into lr_cat_ex.

  • raise new exception

message id '/CCM/CTLG_ENRICHMENT' type 'E' number '050' into

lv_msg.

raise exception type /ccm/cx_fatal_error

exporting

previous = lr_cat_ex

t100_msgid = sy-msgid

t100_msgno = sy-msgno.

endtry.

endmethod.

Former Member
Not what you were looking for? View more on this topic or Ask a question