CCLM: How to create own attribute and implement BADI to extract value
1 General Information
1.1 About this document
This document is about how to create own attributes in CCLM and implement BADI to extract data and set value for own created attribute, a step by step guide will be provided with snapshots.
The next chapter has implementation details.
1.2 Technical Prerequisite
In this version, detail authorization and technical prerequisite is not discussed. In General, authorization role SAP_CCLM_ALL (with authorization object: SM_CC_AUTH with the ID ‘SM_CC_LIB’ and activity 20 = Change library definition) has to be assigned to user who is responsible in this implementation.
SAP Note 1978139-Custom Code Library: Collection of Custom Attributes via BADI should be implemented to avoid data collection error.
2 Implementation Details
In this document we describe a scenario to create an attribute to keep old package information of custom attribute, in order that in case development class of object is changed, we have different old value and new value.
2.1 Create attribute
T-Code CCLM -> navigation bar ‘Library Definition’ -> tab ‘Attribute’, click button ‘Create’ to create new attribute.
2.2 Assign attribute to custom object
After attribute creation, you have to assign the defined attribute to custom code object in order to show it in the attribute list of object when you browse the “Objects” navigation panel.
Transaction Code ‘CCLM’ -> ‘Library Definition’ -> Tab ‘Objects and Assigned Attributes’.
2.3 Implement BAdI
Once you have defined your custom attributes and know which ones of them should be maintained automatically via a custom collector, then you have to define a customer individual RFC function module or a BADI implementation in your managed system(s) to retrieve the data for the custom attributes and pass it back to CCLM.
As a template please use the existing RFC function module /SDF/GET_CCLM_ATTR_VIA_BADI or implement directly the BAdI /SDF/CCLM_ATTR_BADI. Here we implement BAdI /SDF/CCLM_ATTR_BADI as example.
In managed system, T-code SE18.
Implement method ‘GET_ATTRIBUTES’ to extract data and set CCLM attribute.
2.3.1 Create data type
Create a data type (structure) for attribute in managed system.
T-Code SE11 -> Data Type ‘ZAGS_CC_DATA’
2.3.2 Implement data extraction coding
Sample code is attached below.
2.4 Set up the custom collector in CCLM configuration
Next step is to propagate the new customer specific function module (or specific function module which calls the BADI implementation) to the CCLM. For this please define a unique identifier in CCLM customizing table AGS_CC_CUSTOM. If you are using the BAdI implementation, please use the value CC_CONTENT = /SDF/GET_CCLM_ATTR_VIA_BADI.
T-Code SE16, table AGS_CC_CUSTOM, add one entry as below for the custom attribute.
[Comment]: For a subset of for all customer specific fields you should define this unique identifier. This unique identifier is the link between the generic data extractor job and the used function module while running the extraction. E.g. CUSTOM1 as example.
Here we directly use the name of the attribute ‘ZOLDPK’ as CC_KEY.
2.5 Define a new customer field’s extractor job
For every group of customer fields you should define your own extractor entry. This has the benefit to schedule this job independent for subsets of customer attributes. But will also give you the flexibility to schedule this job only for selected systems. Maintain the table AGS_CC_EXTACTOR with the following schema
Job name: SM_CCL: <CUSTOM1>
in this example the < CUSTOM1> must be the same as the CC_KEY in the AGS_CC_CUSTOM, in our example <CUSTOM1> is ‘ZOLDPK’. Example:
This customizing will define a new collector entry in the CCLM settings calling the CCLM standard program RAGS_CC_GET_NEW_ATTRIBUTES every week at 6 AM in the morning.
T-Code SE16, table AGS_CC_EXTRACTOR, add one entry as below.
2.6 Schedule the custom collector job
Once you have executed the step before, go to the navigation bar Settings (before SP10, in case ST-PI> SP10, go to solman_setup or directly start job in SM37) on the left and select the system where you want to schedule the job. A new entry should appear with job name:
Schedule the job to start information extraction.
[Comment]: In case upper version of ST-PI (> SP10), you might not have Settings in navigation bar, then you can either go to solman_setup -> CCLM or directly go to SM37 to create/copy a batch job for this.
2.7 Check Attribute Value in CCLM
T-Code CCLM -> navigation bar ‘Objects’ -> check attributes of the object.
[Reference]: CCLM Configuration Guide.