martedì 26 giugno 2012

Make unlimited BSP configurations

Create a custom table (i.e.: ZCA_CONFIG_SW) with following fields:


Insert records using the standard object type and name of custom configuration you want to display:


Search the standard callback class in standard table BSP_DLC_OBJ_TYPE; the image below displays the standard callback class for object type BT108_LEA (Leads): 


Now we know that class CL_CRM_UIU_BT_OBJTYPE_CALLBACK is the standard callback class: create a copy from the standard and rename it, then add code in method IF_BSP_DLC_OBJ_TYPE_CALLBACK~GET_OBJECT_SUB_TYPES of custom copied class and activate it:

    data: LT_CONFIG_SW type standard table of ZCA_CONFIG_SW,
        LS_CONFIG_SW type ZCA_CONFIG_SW.

...

    select CONFIGURAZIONE
    from ZCA_CONFIG_SW
    into corresponding fields of table LT_CONFIG_SW where OBJECT_TYPE eq IV_OBJECT_TYPE.

  loop at LT_CONFIG_SW into LS_CONFIG_SW.
    append LS_CONFIG_SW-CONFIGURAZIONE to RESULT.
  endloop.

Last point is a customizing step: Customer Relationship Management -> UI Framework -> UI framework definition -> Define UI object types
Add an entry defining object type and z-callback class and save it (see image below):


Now when the popup for configuration creation is raising up, type the object type changed and click on match code for object subtype: all custom configuration names will be displayed