zoukankan      html  css  js  c++  java
  • 无法添加某个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的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    Pytest单元测试框架实战之Pytest用例运行规则
    Pytest单元测试框架实战之-Pytest环境安装
    Monkey稳定性测试实战之ADB命令(二)
    Jenkins配置报告与邮件插件
    如何对用户体验进行测试?
    Jmeter性能测试实战之java.net.BindException: Address already in use报错解决方案
    测试过程杂记(三)Linux执行yum命令报错
    Jenkins持续集成实战之解决windows搭建jenkins执行selenium无法启动浏览器
    测试框架中工具类的实现
    《Python自动化测试修炼宝典》线上课程已经成功入驻网易云课堂......
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13555135.html
Copyright © 2011-2022 走看看