一个不使用CRM中间件成功地将ERP Material下载到CRM的原型开发

本文涉及的产品
服务治理 MSE Sentinel/OpenSergo,Agent数量 不受限
简介:

Requirement

Replicate a material type for example MAT_YYYY into CRM system without using middleware.
After replication, the generated category could be used in normal product scenario ( for example, create new product based on this category, read / query operation on this category etc )

I have successfully written a API which could replicate data ( to simulate T134 ) into CRM category table.
Once this API is executed, a new category will be created in CRM system, without middleware.


This category could be found in tcode COMM_HIERARCHY:

Unfortunately, it is not visible in product creation page :(

bug fixed now. POC is done.
Run method in SE24, specify new product category id via parameter iv_cat_id:

Execute method, ensure ev_success equals to abap_true.

Once created, the category could be searched via tcode COMM_HIERARCHY:

And the category could be used to create new product in WebUI:


source code

 METHOD replicate_category.

    CONSTANTS:
      BEGIN OF gc_application,
        sales      TYPE comt_application VALUE '01', "r3-produkthier
        purchasing TYPE comt_application VALUE '02', "r3 mat class
        product    TYPE comt_application VALUE '03', "r3 mat types
        config     TYPE comt_application VALUE '04',
        internet   TYPE comt_application VALUE '05',
      END OF gc_application.

    CONSTANTS:

      BEGIN OF gc_product_type,
        material  TYPE comt_product_type VALUE '01',
        service   TYPE comt_product_type VALUE '02',
        finance   TYPE comt_product_type VALUE '03',
        ip_prod   TYPE comt_product_type VALUE '04',
        warranty  TYPE comt_product_type VALUE '05',
        tradeitem TYPE comt_product_type VALUE '06',
        fs_prod   TYPE comt_product_type VALUE '07',
      END OF gc_product_type.

    rv_success = abap_false.
    DATA: lv_hierarchy_guid TYPE comt_hierarchy_guid,
          lv_parent_guid    TYPE comt_category_guid,
          lt_categoryt      TYPE comt_categoryt_tab.


* Prerequisite: the corresponding hierarchy is already downloaded from ERP
* Read the hierarchy which is assigned to application 03
* (product type material) in transaction COMM_PRAPPLCAT
    CALL FUNCTION 'COM_HIERARCHY_READ_WITH_APPL'
      EXPORTING
        iv_application    = gc_application-product
        iv_product_type   = gc_product_type-material
      IMPORTING
        ev_hierarchy_guid = lv_hierarchy_guid
      EXCEPTIONS
        not_found         = 1
        OTHERS            = 2.

    CHECK sy-subrc = 0.

    DATA(ls_cat_text) = VALUE comt_categoryt( langu = sy-langu category_text = iv_text
    text_upper_case = iv_text ).
    TRANSLATE ls_cat_text-text_upper_case TO UPPER CASE.
    APPEND ls_cat_text TO lt_categoryt.

    select single category_guid into lv_parent_guid FROM comm_category
       where category_id = 'MAT_'.

    CALL FUNCTION 'COM_PRODCAT_API_CREATE_CAT'
      EXPORTING
        iv_category_id           = iv_cat_id
        iv_hierarchy_guid        = lv_hierarchy_guid
        iv_parent_guid           = lv_parent_guid
        iv_product_type          = gc_product_type-material
        it_categoryt             = lt_categoryt
        iv_logsys                = iv_log_sys " 'QI3CLNT502'
        iv_non_assignable        = abap_false
      EXCEPTIONS
        hierarchy_not_maintained = 1
        wrong_call               = 2
        category_id_exists       = 3
        id_scheme_error          = 4
        error                    = 5
        OTHERS                   = 6.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE 'X' NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      RETURN.
    ENDIF.

    CALL FUNCTION 'COM_PRODUCT_CATEGORY_SAVE_ALL'
      EXPORTING
        iv_update_task    = ' '
        iv_update_pme     = ' '
        iv_hierarchy_guid = lv_hierarchy_guid
      EXCEPTIONS
        internal_error    = 1
        OTHERS            = 2.
    ASSERT sy-subrc = 0.

    COMMIT WORK AND WAIT.

    rv_success = abap_true.

  ENDMETHOD.

本文来自云栖社区合作伙伴“汪子熙”,了解相关信息可以关注微信公众号"汪子熙"。

相关文章
|
Cloud Native 中间件
|
存储 中间件
为什么使用中间件下载时总是收到警告消息Object is in status Wait
为什么使用中间件下载时总是收到警告消息Object is in status Wait
134 1
为什么使用中间件下载时总是收到警告消息Object is in status Wait
|
中间件
如何使用SAP CRM中间件从ERP往CRM下载Service Master
如何使用SAP CRM中间件从ERP往CRM下载Service Master
121 0
如何使用SAP CRM中间件从ERP往CRM下载Service Master
|
中间件
如何用SAP CRM中间件从ERP下载material division到CRM
如何用SAP CRM中间件从ERP下载material division到CRM
124 0
如何用SAP CRM中间件从ERP下载material division到CRM
|
JavaScript 中间件 Java
使用SAP CRM中间件从ERP下载BOM的一些常见问题
使用SAP CRM中间件从ERP下载BOM的一些常见问题
200 0
使用SAP CRM中间件从ERP下载BOM的一些常见问题
|
中间件
使用SAP CRM中间件从ERP下载plant到CRM
使用SAP CRM中间件从ERP下载plant到CRM
107 0
使用SAP CRM中间件从ERP下载plant到CRM
|
中间件 Go
使用SAP CRM中间件下载customer的错误消息:Number not in interval XXX – XXX
使用SAP CRM中间件下载customer的错误消息:Number not in interval XXX – XXX
133 0
使用SAP CRM中间件下载customer的错误消息:Number not in interval XXX – XXX
|
数据挖掘 中间件
使用SAP CRM中间件从ERP下载Customer的错误消息:Customer classification does not exist
After I create a customer in ERP via tcode VD01 and try to download it into CRM via request download, I meet with the following error message:
123 0
使用SAP CRM中间件从ERP下载Customer的错误消息:Customer classification does not exist
|
中间件
使用SAP CRM中间件从ERP下载Customer的错误消息:Distribution channel is not allowed for sales organization
使用SAP CRM中间件从ERP下载Customer的错误消息:Distribution channel is not allowed for sales organization
135 0
使用SAP CRM中间件从ERP下载Customer的错误消息:Distribution channel is not allowed for sales organization
|
中间件
使用SAP CRM中间件从ERP下载具有层级结构的equipment
Requirement: in ERP there are two equipment created via tcode IE01, one is parent which holds the other child equipment.Requirement: in ERP there are two equipment created via tcode IE01, one is parent which holds the other child equipment.
128 0
使用SAP CRM中间件从ERP下载具有层级结构的equipment