Skip to Content

7A87BC9C-9EF3-4715-9534-6CA7768F7738.jpg

如上图所示,要通过程序实现这一功能。

程序代码如下:

DATA: lw_product    TYPE comxif_product_indobj,

      lw_categories TYPE comxif_pr_s_categories,

      lw_cate       TYPE comxif_prd_s_categories,

      lw_admin      TYPE comxif_product_s_admin.

DATA: lv_logsys TYPE comt_logsys.

DATA: lt_categories TYPE comxif_pr_s_categories_t,

      lt_product    TYPE comxif_product_indobj_t.

DATA: lt_bapiret TYPE bapiretm.


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

*           Iobject Category          *

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

CALL FUNCTION ‘OWN_LOGICAL_SYSTEM_GET’

  IMPORTING

    own_logical_system             = lv_logsys

  EXCEPTIONS

    own_logical_system_not_defined = 1

    OTHERS                         = 2.

lw_catecategory_id   = ‘0401’.

lw_catehierarchy_id  = ‘R3PRODSTYP’.

lw_catelogsys        =  lv_logsys.

lw_admintask         =  ‘I’.              “<insert (I), update(u) , delete(d)>

lw_adminlogsys       =  lv_logsys.

lw_adminupname       =  syuname.

lw_categoriesdata    =  lw_cate.

lw_categoriess_adminlw_admin.

*

APPEND lw_categories TO lt_categories.

lw_productcategories = lt_categories.

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

*     Individual object Details       *

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

lw_producttask              = ‘I’.         “<insert (I), update(u) , delete(d)>

lw_productindobj_id        = ‘100000’.    

lw_productobject_family = ‘0401’.          “<if you have no idea, just create an iobject from ib51/52 and check table comm_product>

lw_productlogsys           = lv_logsys.    “<current logical system>

lw_productupname         = syuname.

APPEND lw_product TO lt_product.

CALL FUNCTION ‘CRMXIF_PRODUCT_INDOBJ_SAVE’

  EXPORTING

    data   = lt_product

  IMPORTING

    return = lt_bapiret.    “<return table>.

“IF no error IN the RETURN TABLE,

CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’

  EXPORTING

    wait = ‘X’.

其中,category_id和hierarchy_id(类别ID和层次ID),可以在WebUI上查找,或者通过T-code:COMM_HIERARCHY /SE16:COMM_HIERARCHY 来进行查找。

把已存在的Product或IObject作为Component挂到安装点上可参考如下链接的内容:

SAP CRM – Creating Installed Base (IBASE), Individual Objects, Readings and Counters programmatically – CRM – SCN Wiki

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply