2011 Feb 01 7:14 AM
Hi All,
I would like to share an update which I have followed for one of my implementation project.
Following document will help you, if you want to replicate some of the data from ISU to CRM Service contract custom fields, which is not the standard replication practice.
[Middleware Replication-ISU Installation Facts into CRM Service Contract|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/30e51278-00f0-2d10-89a9-ee3d76447650]
Appreciate your feedback.
Cheers,
Suraj
2011 Feb 01 7:34 AM
Hello Suraj,
May I ask you to post the mentioned code samples (IMHO it si not poissbile to have documents embedded in a PDF document.
Cheers,
Fritz
2011 Feb 01 8:07 AM
Hi Fritz,
As requested following are the code samples-
For ISU System BAdI "ECRM_CRM_DOWNLOAD" as below:
X_CONTRACTPOS TYPE ECRM_CRMCONTRACT_DATA_POS Item Data (Enhanced)
XY_CONTRACTPOS TYPE ECRM_CRMCONTRACTPOS Transfer Structure: Contract Status from CRM to IS-U
XY_CONTRACTPOSX TYPE ECRM_CRMCONTRACTPOSX Transfer Structure: Contract Status from CRM to IS-U
TXY_CONTRACTCONF TYPE ECRM_CRMCONTRACTCONF_TAB Configuration Container
TXY_CONTRACT_STATUS_DATES TYPE ECRM_CRMCONTRACT_STATUS_DAT_T Status and Date Tab
METHOD if_ex_ecrm_crm_download~crm_download_fill_data_new.
*...Local data declaration
DATA : l_c_string1 TYPE string1,
ls_contractconf TYPE ecrm_crmcontractconf.
IF x_contractpos-partner IS NOT INITIAL AND
x_contractpos-everh-anlage IS NOT INITIAL.
SELECT SINGLE string1
FROM ettifn
INTO l_c_string1
WHERE anlage = x_contractpos-everh-anlage.
IF sy-subrc EQ 0.
MOVE : x_contractpos-partner TO ls_contractconf-partner,
x_contractpos-everh-contractpos TO ls_contractconf-ref_guid,
'OPERAND' TO ls_contractconf-attr_name,
l_c_string1 TO ls_contractconf-value.
CALL METHOD me->fill_container
EXPORTING
ip_contractconf = ls_contractconf
ip_value = ls_contractconf-value
ip_name = 'Operand'
CHANGING
li_contractconf = txy_contractconf.
ENDIF.
ENDIF.
ENDMETHOD.
-
VALUE( IP_CONTRACTCONF ) TYPE ECRM_CRMCONTRACTCONF Configuration Container
VALUE( IP_VALUE ) TYPE TEXT70 Error message text - long text of the error
VALUE( IP_NAME ) TYPE CU_CHARC Characteristic Name
VALUE( LI_CONTRACTCONF ) TYPE ECRM_CRMCONTRACTCONF_TAB Configuration Container
METHOD fill_container.
DATA : l_c_contractconf TYPE ecrm_crmcontractconf.
FIELD-SYMBOLS : <contractconf> TYPE ecrm_crmcontractconf.
l_c_contractconf = ip_contractconf.
READ TABLE li_contractconf ASSIGNING <contractconf> WITH KEY ref_guid = ip_contractconf-ref_guid
attr_name = ip_name.
IF sy-subrc EQ 0.
<contractconf>-value = ip_value.
ELSE.
l_c_contractconf-value = ip_value.
l_c_contractconf-attr_name = ip_name.
INSERT l_c_contractconf INTO TABLE li_contractconf.
ENDIF.
ENDMETHOD.
For CRM system BAdI "ECRM_DOWNLOAD" as below:
IP_MTR_TYPE TYPE /NPC/MTRTYPE Meter Type
IP_REF_GUID TYPE CRMT_OBJECT_GUID GUID of a CRM Order Object
CP_CS_TRANS_MSG TYPE BAD_BUS_TRANSN_MESSAGE Transaction Messaging BDoc
METHOD fill_container.
DATA: li_flds_upt_orderadm_i TYPE TABLE OF smog_sfldn.
FIELD-SYMBOLS : <orderadm_i> TYPE bad_orderadm_i_mess.
READ TABLE cp_cs_trans_msg-orderadm_i ASSIGNING <orderadm_i> WITH KEY guid = ip_ref_guid.
IF sy-subrc EQ 0.
APPEND 'ZZ_METER_TYPE' TO li_flds_upt_orderadm_i.
CALL FUNCTION 'SMO_SNDBITS_SETX'
EXPORTING
structurename = 'BAD_ORDERADM_I_MESS'
ddic = 'X'
TABLES
sfields = li_flds_upt_orderadm_i
CHANGING
sndbits = <orderadm_i>-sendbits
EXCEPTIONS
structure_not_found = 1
wrong_fieldname = 2
OTHERS = 3.
<orderadm_i>-zz_meter_type = ip_mtr_type.
ENDIF.
-
IS_CONTRACT_DATA TYPE ECRM_ISU_CONTRACT_DATA2
CS_BUS_TRANS_MSG TYPE BAD_BUS_TRANSN_MESSAGE Transaction Messaging Business Document
METHOD if_ex_ecrm_download~ecrm_download_fill_data.
DATA : ls_contractconf TYPE ecrm_isu_contractconf2,
ls_orderadm_i TYPE bad_orderadm_i_mess.
LOOP AT is_contract_data-t_contractconf INTO ls_contractconf.
READ TABLE cs_bus_trans_msg-orderadm_i INTO ls_orderadm_i WITH KEY guid = ls_contractconf-ref_guid.
IF sy-subrc EQ 0.
MOVE : ls_contractconf-value TO ls_orderadm_i-zz_meter_type.
CALL METHOD me->fill_container
EXPORTING
ip_mtr_type = ls_orderadm_i-zz_meter_type
ip_ref_guid = ls_orderadm_i-guid
CHANGING
cp_cs_trans_msg = cs_bus_trans_msg.
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDMETHOD.
Cheers,
Suraj
2012 Mar 20 8:32 PM
Hi Suraj,
Thanks very much.
Our requirement is replicating the Business agreement data from CRM to ECC, so I found the below BAdI: ECRM_UPLOAD (in CRM) and ECRM_CRM_UPLOAD (in ECC) , I'm not sure whether these are available for our senario?
One more question, how to debug the badi you mentioned? My breakpoint seems no effect when I debug.
Look forwards to you reply. Thanks again.