cancel
Showing results for 
Search instead for 
Did you mean: 

Product Attributes with FM COM_PROD_MATERIAL_MAINTAIN_API

Former Member
0 Kudos

Hi Experts,

I´m trying to create values for the Products Attributes with the FM COM_PROD_MATERIAL_MAINTAIN_API.

Unfortunately, Its not working. I am filling the structure free_attributes of the table it_product with the values for the attributes.

The FM returns sy-subrc = 0 and the table t_returns return´s empty, so I tought that it is filled right, but the Product attribute its not updated.

This is the code Im using fot test:

w_product-com_product-product_guid = v_p_guid.
w_product-com_product-upname = sy-uname.
 
t_free_attr-data-product_guid = v_p_guid.
t_free_attr-data-attribute_id = 'ZATT_MONT'.
t_free_attr-data-valid_from = sy-datum.
t_free_attr-data-valid_to = v_valid_to.
t_free_attr-data-upname = sy-uname.
t_free_attr-data-logsys = v_log_sys.
t_free_attr-data-attribute_value = v_value.
 
APPEND t_free_attr TO w_product-free_attributes.
w_product-pr_number = '1'.
APPEND w_product TO t_product.
 
 
CALL FUNCTION 'COM_PROD_MATERIAL_MAINTAIN_API'
  EXPORTING
    it_product                          = t_product
*   it_set
 IMPORTING
   et_bapireturn                       = t_return
 EXCEPTIONS
   internal_error                      = 1
   OTHERS                              = 2.
 
IF sy-subrc = 0.
 
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
 
ENDIF.

I read in another thread( I didn´t found the thread today...) that maybe i have to fill the IT_SET table but I I tried and didn´t work out either.

Anyone knows how to use this FM (COM_PROD_MATERIAL_MAINTAIN_API) to maintain the values of the Product Attribute?

or any other way?

Any help is welcome!

Thanks a lot!

Jonas

Accepted Solutions (0)

Answers (1)

Answers (1)

Maggie
Employee
Employee
0 Kudos

Hello Jonas,

Yes you need to fill IT_SET with the set type information and iv_update_task with 'X'.


  call function 'COM_PROD_MATERIAL_MAINTAIN_API'
    exporting
      iv_update_task = 'X'
      it_product     = t_product
      it_set         = t_set
    importing
      et_bapireturn  = t_return
    exceptions
      internal_error = 1
      others         = 2.

Best regards,

Maggie

Edited by: Maggie Su on Jul 9, 2010 4:46 AM