on 11-17-2006 4:16 PM
Hi,
I have a requirement to update the marketing attributes of a business partner. I am using CRM_IC_SCRIPTING_MKTBP_CHANGE, which assigns the entered values to the business partner in the marketing attribute set.
The problem is, any other values which existed under different attribute names are being deleted. For example, in an attribute set I have attribute1 with a value and attribute2 with a value. I want to change just attribute2, but keep attribute1, and right now the value of attribute1 is deleted when I execute the bapi. Is there a field I could set in this bapi to keep attribute values which don't have new values, or a different bapi to use? Right now, the only way I know to keep the old values is to first read them from the business partner and then add them to the table in this change bapi along with the new values I want to enter.
By the way, I need to use remote enabled function calls.
Thanks in advance!!
Caryn
Hello,
i have got some coding for you.
it works fine for me.
i just update only one MKT Attribute within one run
Fields for Update
lt_imp_seltab TYPE STANDARD TABLE OF crmt_mktprof_comw,
ls_imp_seltab LIKE LINE OF lt_imp_seltab,
Fields for Read
lt_r_alloc TYPE STANDARD TABLE OF crmt_mktprof_val_r,
ls_r_alloc LIKE LINE OF lt_r_alloc,
REFRESH : lt_imp_seltab.
CLEAR : ls_imp_seltab.
MOVE '<ATTRIBUTE NAME>' TO ls_imp_seltab-atname.
ls_imp_seltab-atwrt = <ATTRIBUTE VALUE>.
APPEND ls_imp_seltab TO lt_imp_seltab.
Read old values before
CALL FUNCTION 'CRM_MKTBP_READ_CHAR'
EXPORTING
iv_bp_guid = lv_bp_guid
iv_profile_template_id = lv_template
IV_LANGU = SY-LANGU
iv_unassigned_values = space
TABLES
et_return = lt_return
et_allocvalues = lt_r_alloc
ET_ALLOCVALUESNUM =
ET_ALLOCVALUESCHAR =
ET_ALLOCVALUESCURR =
.
Check if update is necessary
READ TABLE lt_imp_seltab INDEX 1 INTO ls_imp_seltab.
READ TABLE lt_r_alloc WITH KEY charact = ls_imp_seltab-atname
value_neutral = ls_imp_seltab-atwrt INTO ls_r_alloc.
IF sy-subrc = 0.
REFRESH : lt_imp_seltab.
WRITE : / 'No data to change'.
ELSE.
Mix up the old values into the change structure
LOOP AT lt_r_alloc INTO ls_r_alloc.
IF ls_r_alloc-charact <> p_mm .
CLEAR : ls_imp_seltab.
ls_imp_seltab-atwrt = ls_r_alloc-value_neutral.
ls_imp_seltab-atname = ls_r_alloc-charact.
APPEND ls_imp_seltab TO lt_imp_seltab.
ENDIF.
ENDLOOP.
ENDIF.
If there are data to update, do so
IF NOT lt_imp_seltab IS INITIAL.
REFRESH : lt_return.
CLEAR : ls_return.
CALL FUNCTION 'CRM_MKTBP_CHANGE_BP'
EXPORTING
iv_profile_template_id = lv_template
iv_bp_guid = lv_bp_guid
TABLES
it_imp_seltab = lt_imp_seltab
et_return = lt_return.
.... Error Handling
endif.
Good luck
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naresh,
i do this via a selection screen
have a look here:
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (20) text-021.
SELECTION-SCREEN POSITION 33.
PARAMETERS p_grp LIKE crmt_mktprof_keys-profile_template_id.
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_grp.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = space
fieldname = space
searchhelp = 'CRM_MKTPFTPL_PT'
SHLPPARAM = ' '
DYNPPROG = ' '
DYNPNR = '1000'
DYNPROFIELD = 'P_GRP-HIGH'
STEPL = 0
value = '*'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
SUPPRESS_RECORDLIST = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
selection_screen = 'X'
IMPORTING
USER_RESET =
TABLES
return_tab = lt_return_tab
EXCEPTIONS
FIELD_NOT_FOUND = 1
NO_HELP_FOR_FIELD = 2
INCONSISTENT_HELP = 3
NO_VALUES_FOUND = 4
OTHERS = 5
.
READ TABLE lt_return_tab INTO ls_return_tab INDEX 1.
CHECK sy-subrc EQ 0.
lv_template = ls_return_tab-fieldval.
reagrds
Frank
This is standard SAP behaviour. Before updating marketing attributes you have to read the current values first.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
i have the same problem.did you got a solution ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
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.