Skip to Content
Author's profile photo Extra Li

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.

CCLM_Attribute_01.jpg

CCLM_Attribute_02.jpg

CCLM_Attribute_03.jpg

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’.

CCLM_Attribute_04.jpg

CCLM_Attribute_05.jpg

CCLM_Attribute_06.jpg

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.

CCLM_Attribute_07.jpg

CCLM_Attribute_08.jpg

CCLM_Attribute_09.jpg

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’

CCLM_Attribute_10.jpg

CCLM_Attribute_11.jpg

2.3.2 Implement data extraction coding

CCLM_Attribute_12.jpg

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.

CCLM_Attribute_13.jpg

[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.

CC_KEY                CC_CONTENT

CUSTOM1           Z_RFC_FUBA_NAME

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:

CCLM_Attribute_14.jpg

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.

CCLM_Attribute_15.jpg

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:

SM_CCL: <IDENTIFIER><SID><Installation_Number>

Schedule the job to start information extraction.

CCLM_Attribute_16.jpg

[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.

CCLM_Attribute_17.jpg

CCLM_Attribute_18.jpg

2.7 Check Attribute Value in CCLM

T-Code CCLM -> navigation bar ‘Objects’ -> check attributes of the object.

CCLM_Attribute_19.jpg

CCLM_Attribute_20.jpg

[Reference]: CCLM Configuration Guide.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Extra thank you!

      Author's profile photo Mahadevan Venkata
      Mahadevan Venkata

      Thanks Extra.

      This is helpful.

      Mahadevan

      Author's profile photo Ian Stubbings
      Ian Stubbings

      Hi Extra

      Great blog. Thanks.

      I'd like to use the FM BAdI on the local SolMan system to assign a template id to an object but the interface is different when calling a local collector and it dumps as a result. Is there another FM that is used in this case or do just need to create my own?

      Thanks

      Ian

      AGS_CC_ADD_DATA.PNGRAGS_CC_GET_NEW_ATTRIBUTES.PNG

      Author's profile photo Extra Li
      Extra Li
      Blog Post Author

      Hi Stubbings,

      As I understood from the CCLM configuration guide. You have 2 ways to extract data for customer-specific attribute.

      Option1, In table AGS_CC_CUSTOM, maintain CC_KEY = <Custom1>, CC_CONTENT = /SDF/GET_CCLM_ATTR_VIA_BADI, in this way, you implement BADI /SDF/CCLM_ATTR_BADI in your managed system (you can also take local solman as your managed system). And in above documentation, i use this way.

      Option2,  In table AGS_CC_CUSTOM, maintain CC_KEY = <Custom1>, CC_CONTENT = Z_RFC_FUBA_NAME, in this way, you create you own FM Z_RFC_FUBA_NAME in your managed system, and set the attribute there, you can refer to the definition of BADI FM /sdf/cclm/attr_badi:

      - table: t_object_set which contains all custom code objects

      -  table: T_CCLM_attributes will be filled with the attribute calculated 

      And during the calling of AGS_CC_DATA in solution manager, it reads the configuration in table AGS_CC_CUSTOM for the lf_function_mod, and get attribute table in t_cclm_attributes from the FM (either BADI or your FM depending on your configuration) to feed table et_new_data, the et_new_data is going to update the attributes in CCLM.

      And in CCLM, if you are using local solman as managed system, you should choose to schedule the job under system <solman> instead of managed systems, otherwise standard program will try to use RFCs for your managed systems while calling the BADI FM, it then goes to the wrong way.

      Thanks,

      Extra

      Author's profile photo Ian Stubbings
      Ian Stubbings

      Hi Extra

      Thanks for the info. I'll take a look again.

      Cheers

      Ian

      Author's profile photo sandeep karnati
      sandeep karnati

      Hello Extra Li,

      I am trying to implement BADI in CCM to pull the data regarding z* programs data like tcode associated with z* programs and authorizaton object associated with z*program.

      Could you please help me in implementing BADI.

      Author's profile photo Ivan Timkin
      Ivan Timkin

      Hi Extra !
      Where is sample code that is attached below ? And how to do that in new version SM through tcode SM_WORKCENTER ?