In this wiki, I am trying to explain you how we can enhance ELM functionality in SAP CRM 7.0
Lets look at first important thing in ELM i.e. mapping formats, creating a mapping format on CRM web UI is a very important and essential step while working on ELM. In mapping formats, we specify which field of input data file is mapped to which field of ELM, available in mapping formats. After creating the mapping format it generated a mapping format id and same would be used as a filter in the ELM BADI (CRM_MKTLIST_BADI discussed later in this blog). We can create as many mapping formats as we want but don't forget to add the corresponding mapping format ID in the filter list of CRM_MKTLIST_BADI implementation. Click here to learn more about mapping formats.
Let’s discuss about what all things you, as Technical Consultant, have, to meet the Customer's expectations / reuirements.
In general, the fields available in standard SAP CRM system, to create the mapping formats, are not sufficient to meet the customer requirements, hence, there is need to have custom fields in mapping formats to read Customer specific input data file (or List).
For this purpose following structures can be enhanced by creating append structures.
- CRMT_MKTLIST_ORG_EXT - For Business Partners with category Organization
- CRMT_MKTLIST_PER_EXT - For Business Partners with category Person
- CRMT_MKTLIST_LEA_EXT - For Leads (Business Transaction)
- CRMT_MKTLIST_ACT_EXT - For Activities (Business Transaction)
Note: The enhancement category for above structures is character-type or numeric, so components in the append structures should be created accordingly.
As soon as the append structures are created and activated, respective fields would start appearing as available fields for the mapping formats.
Now, the next step is how to handle these fields for our purpose, SAP has delivered one BADI for this purpose where a Technical Consultant can access these fields and write the logic as per Customer’s requirement. The BADI name is ‘CRM_MKTLIST_BADI’ and SAP has also delivered the default implementation class ‘CL_DEF_IM_CRM_MKTLIST_BADI’ for this BADI.
Let’s look at the methods of this BADI:
| Method | Description |
| DELETE_TEMP_DATA | Clear Temporary Data |
| TARGET_GROUP_CREATION | Create Target Group |
| TARGET_GROUP_CREATION_WITH_MC | Create Target Group using Marketing Contacts |
| DUPLICATE_CHECK | Duplicate Check |
| POSTAL_CHECK | Postal Check |
| MAP_AND_CONVERT_DATA | OBSOLETE |
| CREATE_BUSINESS_PARTNERS | Create Business Partners |
| BP_ADDITIONAL_PROCESSING | Additional processing after Business Partner creation |
| AFTER_TG_CREATION | Additional processing after Target Group creation |
| AFTER_DELETE | Additional processing after list deletion |
| CREATE_BUSINESS_TRANSACTIONS | Create Business Transactions |
| CHECK_BEFORE_DELETE | Check Business Partners to be deleted |
| CREATE_MARKETING_CONTACTS | Create Marketing Contacts |
Before the implementation of this BADI, my suggestion is to create a copy of the default implementation class. Now, create an implementation of this BADI and use the newly copied class as the implementation class in your BADI implementation.
In your implementation class now you will have following additional methods (From default implementation class) apart from above mentioned methods of BADI.
| Method | Description |
| CREATE_ORGANIZATION | Create organization |
| CREATE_PERSON | Create person |
| ADD_INTL_ADDR_VERSION | Add International Address Version |
| CONTP_ADD_INTL_ADDR_VERSION | Add International Address Version to relationship |
| CREATE_ACTIVITIES | Create Activities |
| CREATE_LEADS | Create Leads |
| FILL_HEADER_DATA | Prepare Lead/Activity/Order Header |
| UPDATE_ORGANIZATION | Update Organization - Trusted Source |
| UPDATE_PERSON | Update Person - Trusted Source |
Scenario: Create BP with BP Role:
Now, let’s discuss a scenario where the Customer wants all the Business Partners should be created in a specific BP Role for both categories (Organization and Person). For example Business Partners with Organization category should created in Account or Competitor BP Role where as Business Partners with Person category should be created in Employee or Contact BP Role.
As BP Role field is not available in the standard fields list, delivered by SAP, to create mapping formats, so first enhance the following structures with BP Role field:
- CRMT_MKTLIST_ORG_EXT - For Business Partners with category Organization
- CRMT_MKTLIST_PER_EXT - For Business Partners with category Person
Field Name: ZZRLTYP
Field Type : BU_PARTNERROLE
Now you can access BP Role filed (ZZRLTYP) and write your logic in CREATE_ORGANIZATION, UPDATE_ORGANIZATION, CREATE_PERSON and UPDATE_PERSON methods. For this example you can use FM BAPI_BUPA_ROLE_ADD_2' to add a BP Role to a BP.
In the same way, we can enhance Leads or Activities structures, depending on the customer’s requirement. CREATE_LEADS or CREATE_ACTIVITIES method of the BADI implementation class can be used to write custom logic.
Debugging the implementation of CRM_MKTLIST_BADI
Debugging of CRM_MKTLIST_BADI implementation is not just put a break point in the implementation class and debug. Click here to learn how to debug ELM BADI.
Campaign Element Issue and its resolution
As per standard behaviour it is necessary to provide campaign or campaign element in the input file to create leads and activities, otherwise it displays an error message saying 'Initial campaign ID provided'. To overcome this issue, there is an option to use CHECK_RESPONSE method of CL_CRM_MKTLIST_MR_CHECK_TOOLS and write the logic to remove corresponding error message with message class CRM_MKTLIST_MR and message id 281, by doing an implicit enhancement at the end of the method implementation. We should also not use FM CRM_MKTLIST_FILL_DOCFLOW in CREATE_LEADS and CREATE_ACTIVITIES method otherwise it will add another error message related to campaign not determined.
Important Point
In case you are using sy-uname some where in your logic to access current logged in user in ELM BADI implementation, it will work well in debug mode and you will see correct logged in user. But when you will use ELM in normal mode (Not in Debug mode) sy-uname wouldn't give you the current logged in user as workflow user (i.e. WF-BATCH) is configured to run ELM.
We can find the current user from table crmd_mktlist_h based current list guid.
Refer the following discussion for adding Long Text(Notes) to BP: