cancel
Showing results for 
Search instead for 
Did you mean: 

Product creation in CRM

Former Member
0 Kudos

Hi,

Is there any function module to create a product by passing the Object family and product type.

I have tried using the Function Modules COM_PRODUCT_CREATEM, COM_PRODUCT_MAINTAIN but not able to create product.

Thanks,

Swamy

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi all,

I have created the product(material) with mandatory fields using of the below function modules.

COM_PRODUCT_MAT_MAINT_MULT_API, COM_PRODUCT_SAVE_API and BAPI_TRANSACTION_COMMIT.

Hereby i'm attaching my code snippet refer this.

DATA: it_product TYPE comt_product_mat_maintain_apit,

      is_product TYPE comt_product_mat_maintain_api,

      et_product TYPE comt_product_mat_maintain_apit,

      et_bapireturn TYPE bapiret2_tab,

      es_bapireturn TYPE bapiret2,

      it_categories TYPE comt_prod_cat_rel_maintain_tab,

      is_categories TYPE comt_prod_cat_rel_maintain,

      it_shorttext TYPE comt_pr_shtext_maintain_tab,

      is_shorttext TYPE comt_pr_shtext_maintain,

      it_measure TYPE /1cn/working_set_i_d_crm_t,

      is_measure TYPE /1cn/working_set_i_d_crm.

is_product-header-pr_number = '00001'. “ product header details

is_product-header-com_product-product_id = 'BA07'.

is_product-header-com_product-product_type = '01'.

is_product-header-com_product-logsys = 'CLNT930CI7'.

is_categories-data-category_id = 'MAT_EPA'.

is_categories-data-category_guid = 'DD9A8877C9746BF18A90001321F2A23C'.

is_categories-data-logsys = 'CLNT930CI7'.

APPEND is_categories TO it_categories. “ category details itab

is_measure-meins = 'PC'.

APPEND is_measure TO it_measure.

is_shorttext-data-short_text = 'Sample Product'.

is_shorttext-data-langu = 'EN'.

is_shorttext-data_x-short_text = 'X'.

is_shorttext-data-logsys = 'CLNT930CI7'.

is_shorttext-update_type = 'I'.

APPEND is_shorttext TO it_shorttext. “ description itab

is_product-header-categories = it_categories.

is_product-header-short_texts = it_shorttext.

is_product-conditions-cnd_crm_working_set = it_measure.

APPEND is_product TO it_product. “ full product details

CALL FUNCTION 'COM_PRODUCT_MAT_MAINT_MULT_API'

  EXPORTING

    it_product                          = it_product

*   IV_CHECK_ONLY                       =

*   IV_SUPPRESS_INACTIVE                =

*   IV_ACTIVATE_INACTIVE_PRODUCTS       =

*   IV_APPLICATION                      = ' '

   iv_supress_rollback                 = 'X'

IMPORTING

   et_product                          = et_product

   et_bapireturn                       = et_bapireturn

EXCEPTIONS

   internal_error                      = 1

   OTHERS                              = 2

          .

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

READ TABLE et_bapireturn INTO ls_bapireturn WITH KEY type = 'E'.

  IF sy-subrc <> 0.

    READ TABLE et_bapireturn INTO ls_bapireturn WITH KEY type = 'A'.

    IF sy-subrc <> 0.

      CALL FUNCTION 'COM_PRODUCT_SAVE_API'

        EXPORTING

          iv_update_task   = 'X'

        EXCEPTIONS

          internal_error   = 1

          save_not_allowed = 2

          OTHERS           = 3.

      IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ELSE.

        call FUNCTION 'BAPI_TRANSACTION_COMMIT'.

      ENDIF.

    ENDIF.

  ENDIF.

Its working fine now.

Thank you for all ur suggestions.

Regards,

Swadini Sujanaranjan

pedro_murias
Participant
0 Kudos

Dear Swadini,

Im unable to find on the structure of COM_PRODUCT_MAT_MAINT_MULT_AP where to fed the SALES_ORG info.

Please advise.

Regards

Former Member
0 Kudos

Hi Pedro

While importing the values through IT_PRODUCT in the above function module, you are supposed to give Sales_org value.

You can find Sales details structure by navigating from,

IT_PRODUCT--->COMT_PRODUCT_MAT_MAINTAIN_API--->

DATA--->CRMM_PR_SALESH--->RELATION--->SALES_ORG

Note: Give entry for Sales_org and Fill values in data and data_x of the same structure.


Try it and let me know for further issues.

Regards

Swadini Sujanaranjan

pedro_murias
Participant
0 Kudos

Dear Swadini,

I solved it:

Data:

is_mnt_settype     type comt_frgtype_id,

ls_salesh type  crmt_crmm_pr_salesh_maintain,

lt_salesh type crmt_crmm_pr_salesh_maintain_t.

   is_mnt_settype  'CRMM_PR_SALESH'.

   append is_mnt_settype to lt_mnt_settype.

       ls_salesh-relation-client = sy-mandt.

       ls_salesh-relation-sales_org = li_sorg-low.

       ls_salesh-relation-distr_chan = li_schan-low.

       ls_salesh-relation-upname = sy-uname.

       ls_salesh-relation-logsys = lv_logsys.

      append ls_salesh to  lt_salesh.

Thanks

0 Kudos

Does this mean that I have to append all the settypes in  is_mnt_settype .

All only specific settypes.

Regards,

Satish

former_member217722
Participant
0 Kudos

Hi,

I have done same code as you explained. where bapi returns nothing but i cannot assign sales org .And data and datax i have not used i need to update only sales org details.Here is the code.

And what is the settypes that to be maintained in table CRMM_PR_SALESA, CRMM_PR_SALESG and CRMM_PR_SALESH. How this reflects .

is_mnt  = 'CRMM_PR_SALESG'.    "G A H

APPEND is_mnt TO it_mnt.

CLEAR is_mnt.

is_sorg-distr_chan      = '01'.

is_sorg-sales_org       = 'ORG9999'.

*is_sorg-product_guid    =

is_sorg-logsys          = 'xlsa100'.

is_sorg-client          = sy-mandt.

is_sorg-upname          = sy-uname.

is_salesh-relation    = is_sorg.

is_salesh-update_type = 'U'.

APPEND is_salesh TO it_salesh.

is_product-data-crmm_pr_salesh            = it_salesh.

is_product-data-mnt_settype               = it_mnt.



Regards,

Mithuunn

Former Member
0 Kudos

Hi Swamy

Try using the following FM:

CRM_IOBJECT_CIC_IOBA_CREATE

hope this helps

Rupesh

Former Member
0 Kudos

hi ,

I used the following function modules in the creation of service products.

COM_PRODUCT_SRV_MAINT_MULT_API

and then use COM_PRODUCT_SAVE_API to save the product.

pl check all the values are in proper format.

(u better create one product using t.code commpr01.

and check it in the db tables. then you can get an idea about the format of the input values)

hope this answer helps you.

best regards,

Mallik

saumya_govil
Active Contributor
0 Kudos

Hi Swamy,

Try using the following FMs in the same order:

COM_PRODUCT_MAINTAIN_MULT_API

COM_PRODUCT_SAVE_API

BAPI_TRANSACTION_COMMIT

Hope this helps!

Regards,

Saumya

Former Member
0 Kudos

Hello Swamy,

Check FM:COM_PRODUCT_UI_MAINTAIN

Hope this helps!

Best Regards,

Shanthala Kudva