on 09-25-2008 1:56 PM
Hi Experts
Does somebody has info on the CRM FM "COM_PRODUCT_MAINTAIN_INIT"? What functionality does it provide? Any sample code examples?
Please help!
Thanks
Gopal
HI,
I did a POC regarding the use of this FM to update the pricing conditions in CRM product.
DATA : lt_return TYPE bapiret2_tab,
lt_ret TYPE bapiret2 ,
it_producto TYPE comt_product_maintain_api_extt,
wa_producto TYPE comt_product_maintain_api_ext,
wa_conditions TYPE com_product_cnd_api,
wa_prueba TYPE /1cn/working_set_i_d_crm,
iv_logsys TYPE comt_logsys,
lv_save TYPE comt_boolean.
DATA : wa_prueba1 TYPE /1cn/working_set_i_d_bbp.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = iv_logsys
EXCEPTIONS
own_logical_system_not_defined = 1
OTHERS = 2.
wa_producto-header-com_product-product_guid = 'DEADB868697D94F19FF1001CC4EF4BFA'.
wa_producto-header-com_product-product_type = '01'.
wa_producto-header-com_product-product_id = '834027602'.
wa_producto-header-com_product-logsys = iv_logsys.
wa_producto-header-update_type = 'I'.
wa_producto-header-pr_number = '1'.
*for conditions that i need to update
wa_prueba-client = sy-mandt.
wa_prueba-kschl = 'YSFA'.
wa_prueba-kbetr = '0.01'.
wa_prueba-konwa = 'USD'.
wa_prueba-kappl = 'CRM'.
wa_prueba-kpein = '1'.
wa_prueba-kmein = 'ST'.
wa_prueba-kvewe = 'PR'.
wa_prueba-kotabnr = 'CUSSFA'.
wa_prueba-product = 'DEADB868697D94F19FF1001CC4EF4BFA'.
wa_prueba-yyfld000011 = '1001'.
wa_prueba-timestamp_from = '20110414235959'.
wa_prueba-timestamp_to = '99991231235959'.
wa_prueba-product_ref_guid = 'DEADB868697D94F19FF1001CC4EF4BFA'.
wa_prueba-cpe_r_rate = '0.01'.
wa_prueba-cpe_r_currency = 'USD'.
wa_prueba-cpe_r_priceunit = '1'.
wa_prueba-cpe_r_uom = 'ST'.
APPEND wa_prueba TO wa_conditions-cnd_crm_working_set.
MOVE-CORRESPONDING wa_prueba TO wa_prueba1.
APPEND wa_prueba1 TO wa_conditions-cnd_bbp_working_set.
wa_producto-conditions = wa_conditions.
this is the final table i a send to the fm
APPEND: wa_producto TO it_producto.
lv_save = 'X'.
CALL FUNCTION 'COM_PRODUCT_FREE_API'.
DATA : lt_product_api TYPE comt_product_maintain_api_tab,
ls_product_api TYPE comt_product_maintain_api.
ls_product_api-pr_number = 1.
SELECT SINGLE *
FROM comm_product
INTO CORRESPONDING FIELDS OF ls_product_api-com_product
WHERE product_guid = wa_prueba-product.
APPEND ls_product_api TO lt_product_api.
CALL FUNCTION 'COM_PRODUCT_MAINT_CONDITIONS'
EXPORTING
it_product = it_producto
IMPORTING
et_bapireturn = lt_return
CHANGING
cv_save = lv_save.
IF sy-subrc = 0.
CALL FUNCTION 'COM_PROD_MATERIAL_MAINTAIN_API'
EXPORTING
it_product = lt_product_api
iv_commit_work = 'X'
IMPORTING
et_bapireturn = lt_return.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'COM_PRODUCT_SAVE'.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = lt_ret.
WAIT UP TO 2 SECONDS.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.