Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to populate Marketting attributes

Former Member
0 Kudos

Hi,

I have a requirement where I need to populate the marketting attributes.

I am using the function module CRM_MKTBP_CREATE_LIST_BPS_OB.This is the code that I am using

x_alloclist-partner_guid = v_raw_bp_guid.

x_alloclist-profile_template_id = p_attset.

x_alloclist-allocvalues = i_allocvalues.

APPEND x_alloclist TO i_alloclist.

CALL FUNCTION ' CRM_MKTBP_CREATE_LIST_BPS_OB'

EXPORTING

ix_alloclist = i_alloclist

TABLES

et_return = i_return

EXCEPTIONS

communication_failure = 1 MESSAGE rfc_err

system_failure = 2 MESSAGE rfc_err.

IF sy-subrc NE 0.

***Exception raised.

    • RFC connection is down.

v_prob_cls = c_imp.

v_subobj = c_rfc.

MESSAGE e015(ysg) WITH rfc_err INTO g_dummy.

PERFORM write_log.

MESSAGE e019(ysg) WITH v_rfcdest.

ENDIF.

I am passing the attribute set in the parameter p_attset. I was expecting only the attributes which belong to this attribute set would get updated. But I found that it is updating the other MAs in i_alloclist which belong to some other attribute set.

Is this a standard behaviour of the function module? Or am I missing some parameters?

Can you please provide some solution to this?

Thanks,

Samrat.

7 REPLIES 7

saumya_govil
Active Contributor
0 Kudos

Hi Samrat,

I have used FM CRM_MKTBP_ASSIGN_ATTRIBUT_TAB to assign marketing attributes to a BP and it worked for me.

The advantage of using this FM is that you can pass the attribute set to be updated as the inout parameter.

Check if this helps you.

Regards,

Saumya

Former Member
0 Kudos

Hi,

I have updated Marketing Attribute of a BP in CRM by following FM,

DATA: lt_attr TYPE TABLE OF crmt_mktprof_comw,

gt_attributes TYPE crmt_mktbp_char_tp,

t_check TYPE crmt_mktprof_val_r_tab.

CALL FUNCTION 'CRM_MKTBP_READ_CHAR_ALL_PFTPL' " FM to get Marketing Attribute of an Business Partner.

EXPORTING

iv_bp_guid = gs_final-partner_guid

iv_unassigned_values = c_x

iv_langu = sy-langu

TABLES

et_return = gt_return1

et_allocvalues = gt_attributes.

IF gt_attributes[] IS NOT INITIAL.

READ TABLE gt_attributes INTO gs_attributes WITH KEY classname = c_mktatr_330.

IF sy-subrc EQ 0.

gt_check[] = gs_attributes-allocvalues. " Passing Marketing Attribute of a Business partner

endif.

endif.

LOOP AT gt_check INTO gs_check.

ls_attr-atname = gs_check-charact.

ls_attr-atwrt = gs_check-value.

ls_attr-changed_at = gs_check-changed_at.

ls_attr-changed_by = gs_check-changed_by.

APPEND ls_attr TO lt_attr.

CLEAR ls_attr.

ENDLOOP.

IF lt_attr[] IS NOT INITIAL.

CALL FUNCTION 'CRM_MKTBP_CHANGE_BP' " FM for Updating and Inserting Market attributes values

EXPORTING

iv_profile_template_id = l_atset

iv_bp_guid = l_part_guid

iv_fcode = 'C'

iv_msa = 'X'

iv_commit = 'X'

iv_partner = l_partner

iv_convert_values = 'X'

TABLES

it_imp_seltab = lt_attr

et_return = lt_return.

READ TABLE lt_return INTO wa_return WITH KEY type = 'E'.

IF sy-subrc NE 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ELSE.

Thanks and Regards,

ShreeMohan

Edited by: ShreeMohan Pugalia on Jul 17, 2009 11:04 AM

Edited by: ShreeMohan Pugalia on Jul 17, 2009 11:07 AM

Former Member
0 Kudos

Hi Samrat,

Try this FM

CRM_MKTBP_CHANGE_BP

Regards,

Vijay

Former Member
0 Kudos

Hi,

In your code I do not see Fm,

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

Are you using it?

If not Please use it after the FM CRM_MKTBP_CREATE_LIST_BPS_OB' .

Thanks & Regards,

ShreeMohan

Edited by: ShreeMohan Pugalia on Jul 17, 2009 11:17 AM

0 Kudos

Hi All,

I have used 'BAPI_TRANSACTION_COMMIT' though i have not mentioned it in the message.

I am aware of the function module 'CRM_MKTBP_CHANGE_BP' .

Basically . I want to know why the function module '' CRM_MKTBP_CREATE_LIST_BPS_OB'

' is behaving in this way?

Can you help me to get the solution?

Thanks,

Samrat.

0 Kudos

Hi,

Pass only that MAs in the FM which is to be modified.

When you read MA's Of a BP you get varous MAs of BP.

But U have to select particular MA from list of MAs.

Thanks & Regards

ShreeMohan.

0 Kudos

Hi ShreeMohan,

The function module has got a parameter CRM_MKTBP_CREATE_LIST_BPS_OB for passing the name of the attribute set. I am not understanding why then all the Marketting attributes are getting populated.

Am I missing something while passing the parameters to the function module?

Thanks,

Samrat.