Skip to Content
author's profile photo Former Member
Former Member

bapi / api / function to get Multilevel Categorization chosen in Serv Order

Hello experts,

As CRM order only stores in table CRMD_SRV_SUBJECT the lowest level of the Multilevel Categorization chosen in the Service order. I wondered if somebody knows if there is a BAPI / API / Function that can retrieve the upper levels by passing the lowest one.

I mean, in a service order with 4 levels of categorization chosen:

Level1

Level 2

Level 3

Level 4

Only Level 4 is stored in the CRMD_SRV_SUBJECT for Service Orders. That is the reason why I need some BAPI or similiar to get the upper levels of the Service Order.

I hope you can help me!

Many thanks!

Pablo

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Nov 14, 2013 at 12:34 AM

    Hi,

    Please use the Utilities class CL_CRM_ML_Category_util and methodget_categories will provide the category details based on the header guid u r passing.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2015 at 06:23 AM

    Hi Pablo,

    Similar type of requirement came to us in one of the project, we solved using custom code.

    just copy and paste the method in your custom class

    METHOD get_categories.

    input parameter:- object_guid

    export parameter:- zcrm_categories_t." ( cat_id, cat_desc,cat_guid )

    * Get category levels based on transaction guid

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

    DATA: lr_aspect TYPE REF TO if_crm_erms_catego_aspect,

    lr_category TYPE REF TO if_crm_erms_catego_category,

    lv_ref_guid TYPE crmt_object_guid, ".

    lv_asp_guid TYPE crm_erms_cat_guid,

    lv_cat_guid TYPE crm_erms_cat_guid,

    lv_sel_level TYPE int4,

    ls_cat TYPE crmt_erms_cat_ca_buf,

    et_cat_tree TYPE bsp_wd_dropdown_table,

    ls_cat_tree TYPE bsp_wd_dropdown_line,

    lv_cat_id TYPE crm_erms_cat_ca_id,

    ls_category TYPE zcrm_categories,

    lt_category TYPE zcrm_categories_t." ( cat_id, cat_desc,cat_guid )

    lv_ref_guid = iv_guid." guid of object id

    CALL METHOD cl_crm_ml_category_util=>get_categoryfirst

    EXPORTING

    iv_ref_guid = lv_ref_guid

    iv_ref_kind = 'A'" Header

    iv_catalog_type = 'D' "ORDER_READ->ET_SUBJECT->CAT_ID'

    IMPORTING

    er_aspect = lr_aspect

    er_category = lr_category.

    * get aspect guid

    CALL METHOD lr_aspect->get_asp_guid

    RECEIVING

    rv_asp_guid = lv_asp_guid.

    * get category guid

    CALL METHOD lr_category->get_details

    IMPORTING

    ev_cat = ls_cat.

    lv_cat_guid = ls_cat-cat_guid.

    *get category levels

    cl_crm_ml_category_util=>get_selected_category_tree(

    EXPORTING

    iv_selected_cat_guid = lv_cat_guid " Selected Category GUID

    iv_schema_guid = lv_asp_guid " Schema GUID

    IMPORTING

    et_cat_tree = et_cat_tree " category levels

    ev_selected_level = lv_sel_level ). " Selected Category Level

    CLEAR: lv_cat_guid.

    IF et_cat_tree IS NOT INITIAL." sy-subrc = 0.

    LOOP AT et_cat_tree INTO ls_cat_tree.

    IF ls_cat_tree IS NOT INITIAL.

    ls_category-cat_guid = ls_cat_tree-key.

    ls_category-cat_desc = ls_cat_tree-value.

    SELECT SINGLE cat_id INTO lv_cat_id FROM crmc_erms_cat_ca WHERE cat_guid = ls_category-cat_guid.

    ls_category-cat_id = lv_cat_id.

    APPEND ls_category TO lt_category.

    et_category = lt_category.

    CLEAR:ls_cat_tree,ls_category,lv_cat_id.

    ENDIF.

    ENDLOOP.

    ENDIF.

    ENDMETHOD.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 06, 2009 at 11:11 AM

    Hi Pablo,

    The higher level categorization information is stored in table CRMD_SRV_OSSET.

    You can also use FM CRM_ORDER_READ to fetch this information easily.

    Just check the output parameter ET_SUBJECT. This parameter stores the entire hierarchy of the categorization levels.

    Hope this helps!

    Regards,

    Saumya

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Sweta,

      I have created a new Custom FM to figure out all the Problem codes for an ORder.

      In my case i have Four levels.

      So I found Four codes and description based on the below logic.

      You could use where used list for this Standard FMs.

      ET_SCHEMA will have all the problem codes.

      IF ( it_subject IS SUPPLIED ) AND ( it_subject IS NOT INITIAL ).
      lt_subject = it_subject.
      ELSE.
      IF iv_header_guid IS NOT INITIAL.
      CALL FUNCTION 'CRM_SUBJECT_READ_OW'
      EXPORTING
      iv_ref_guid = iv_header_guid
      iv_ref_kind = 'A'
      IMPORTING
      et_subject_wrk = lt_subject
      EXCEPTIONS
      error_occurred = 1
      OTHERS = 2.
      IF sy-subrc <> 0.
      * Implement suitable error handling here
      ENDIF.
      ENDIF.
      ENDIF.
      READ TABLE lt_subject INTO ls_subject WITH KEY ref_kind = 'A'.
      IF sy-subrc = 0.
      lv_cat_id = ls_subject-cat_id.
      ENDIF.

      CALL FUNCTION 'CRM_ERMS_CAT_CA_READ'
      EXPORTING
      iv_cat_id = lv_cat_id
      IMPORTING
      et_cat_guid = lt_categ_guid
      EXCEPTIONS
      non_existent = 1
      non_existent_aspect = 2
      data_error = 3
      OTHERS = 4.
      IF sy-subrc <> 0.
      * Implement suitable error handling here
      ENDIF.
      READ TABLE lt_categ_guid INTO ls_categ_guid INDEX 1.
      IF sy-subrc = 0.
      lv_cat_guid = ls_categ_guid.
      CALL FUNCTION 'CRM_ERMS_CAT_CA_READ'
      EXPORTING
      iv_cat_guid = lv_cat_guid
      IMPORTING
      et_cat = lt_cat
      EXCEPTIONS
      non_existent = 1
      non_existent_aspect = 2
      data_error = 3
      OTHERS = 4.
      IF sy-subrc <> 0.
      * Implement suitable error handling here
      ENDIF.
      READ TABLE lt_cat INTO ls_cat INDEX 1.
      IF sy-subrc = 0.
      lv_asp_guid = ls_cat-cat-asp_guid.
      ENDIF.
      ENDIF.
      ls_query-tree_guid = lv_asp_guid.
      ls_query-node_guid = lv_cat_guid.
      lv_level = '4'.

      CALL FUNCTION 'CRM_ERMS_CAT_HI_PARS_LEVEL'
      EXPORTING
      iv_hier_query = ls_query
      iv_level = lv_level
      * IV_INNER_NODES = 'X'
      IMPORTING
      et_hier = lt_cat_all.

      LOOP AT lt_cat_all INTO ls_cat_all.

      CALL FUNCTION 'CRM_ERMS_CAT_CA_READ'
      EXPORTING
      iv_cat_guid = ls_cat_all-node_guid
      IMPORTING
      et_cat = lt_cat
      EXCEPTIONS
      non_existent = 1
      non_existent_aspect = 2
      data_error = 3
      OTHERS = 4.
      READ TABLE lt_cat INTO ls_cat INDEX 1.
      IF sy-subrc = 0.
      APPEND ls_cat TO et_schema.
      ENDIF.
      ENDLOOP.

      Thanks

      Logu

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.