• 无法添加某个relationship给SAP CRM Product category的一个可能原因


    For example, I would like to test relationship type STRSET and then I plan to add it to product category 00001.

    However, in available drop down list, I could not see relationship type STRSET. Why?

    When debugging the backend logic to render relationship type drop down list entries, I found there is a check implemented by the function module below, to avoid a relationship is assigned more than once.

    According to SAP help,
    a set type / relationship may be assigned to more than one category within a hierarchy, but to only one hierarchy for each product type. Therefore even if two categories are in different hierarchies but have the same product type, it is not possible to assign the set type / relationship to both categories.
    In my example, the check against my category 00001 belonging to hierarchy R3PRODHIER fails ( assign_not_allowed ).

    The question is, how to find other categories in different hierarchy other than R3PRODHIER, which are already assigned with STRSET?
    In order to make life easier, I write the following utility method to detect such collision:
    Method input: relationship type name, here it is STRSET:

    Output is a table with line type category id, hierarchy id and product type the category is assigned to.

    By using this method, I know in current system, in another product hierarchy R3PRODSTYP, there are already three categories with relationship type STRSET assigned:

    As a result I have several approaches: I can remove the relationship STRSET from category ZALTID, after that it will be possible again for me to add STRSET to category 00001. If there is already product created based on category ZALTID, it will not be possible to remove relationship from ZALTID, then I have to consider to directly add category ZALTID or its children category to my product.
    The utility method signature:

    type TT_USAGE used:

    types:
        BEGIN OF ty_usage,
           cat_id TYPE comm_category-category_id,
           hier_id TYPE comm_hierarchy-hierarchy_id,
           prod_type TYPE comm_product-product_type,
            END OF ty_usage .
      types:
        tt_usage TYPE STANDARD TABLE OF ty_usage WITH key cat_id hier_id .
    Method source code:
      METHOD rel_type_usage_check.
        DATA: lt_prcat_il_rel TYPE comt_prcat_il_rel_tab,
              ls_prcat        LIKE LINE OF lt_prcat_il_rel,
              ls_category     TYPE comt_category,
              ls_prcattype        TYPE comt_prcat,
              lv_hie_id       TYPE comm_hierarchy-hierarchy_id.
    
        CALL FUNCTION 'COM_PRCAT_IL_REL_READ_WITH_IL'
          EXPORTING
            iv_il_reltype   = iv_rel
            iv_il_direction = 'S'
          IMPORTING
            et_prcat_il_rel = lt_prcat_il_rel
          EXCEPTIONS
            not_found       = 1
            wrong_call      = 2
            OTHERS          = 3.
        CHECK sy-subrc = 0.
    
        LOOP AT lt_prcat_il_rel INTO ls_prcat.
          CALL FUNCTION 'COM_CATEGORY_READ'
            EXPORTING
              iv_category_guid = ls_prcat-category_guid
            IMPORTING
              es_category      = ls_category
            EXCEPTIONS
              wrong_call       = 1
              not_found        = 2
              error            = 3.
          CHECK sy-subrc = 0.
          SELECT SINGLE hierarchy_id INTO lv_hie_id FROM comm_hierarchy
             WHERE hierarchy_guid = ls_category-hierarchy_guid.
          CHECK sy-subrc = 0.
          CALL FUNCTION 'COM_PRCAT_READ'
            EXPORTING
              iv_category_guid = ls_category-category_guid
            IMPORTING
              es_prcat         = ls_prcattype
            EXCEPTIONS
              wrong_call       = 1
              not_found        = 2
              OTHERS           = 3.
          APPEND INITIAL LINE TO rt_usage ASSIGNING FIELD-SYMBOL(<result>).
    
          <result> = value #( cat_id = ls_category-category_id hier_id = lv_hie_id
          prod_type = ls_prcattype-product_type  ).
        ENDLOOP.
    
      ENDMETHOD.
    

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    第四章 处理器体系结构
    第四节、程序的机器语言
    第三节 信息的表示和处理
    app
    你只是看起来很努力
    tap news:week5 0.0 create react app
    28.week4
    ubuntu去除带锁文件的锁 sudo chown 用户名 目标文件夹/ -R
    26.如何使用python操作我们自己创建的docker image呢?
    25.week4 docker build 也就是创建自己的image 上传image到dockerhub 从dockerhub下载images
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13570646.html
Copyright © 2020-2023  润新知