Preliminary note: this project was developed on SAP Netweaver 7.02 SP11 with GW 2.0 SP04 Developer edition available here… so actually there’s no need for a CRM system to be able to play with it (despite the title of this blog), as soon as component WEBCUIF is installed on your system. Also you may want to check part II and III of this blog post here:
When I’m testing my applications I often need to create the same “sample” data again and again. For example: one business partner with valid address data and bank account information, one contract account, two sales orders, one equipment, etc…. and it takes me forever when I need to create this kind of data model from scratch when the previous one is definitely out of service. So I decided to develop a “Master Data Generator” which allows me to create everything in one click, based on a simple-and-easy-to-use customizing view. Nugget is available on Assembla.
Here is how it works:
1) Give your master data model a name and description. For example “PART_BIM : Partner for test 1”. Also a component set name should be entered so the application will know which BOL objects can be used within this master data template.
2) Now comes the real stuff: create your objects’ hierarchy within the selected template
Here you give every BOL object you need an identification name, and customize the way it should be created by the application. If one object has no predecessor, the system will try to create it via the factory class of the corresponding bol object name (third column). If a predecessor is entered (4th column), the object is created via the relationship mentionned in 5th column.
3) For root objects, you can also fill-in creation parameters:
4) At the end, for root and dependent objects you can fill-in all the values you need to create the data model that suits your needs:
- Add constant values to attributes. For example ‘NICE’ in city field.
- Add system variable attributes. Pattern ‘<VARIA[xxx]>’ where xxx is a system variable, will fill-in the attribute with the corresponding value at runtime.
- Add BPATH expressions. Pattern ‘<BPATH[xxx:yyy]>’ will trigger get_property_by_bpath on xxx entity for yyy bpath expression.
- Add values from the structure that you set as importing parameter of this tool (see below where I explain how to start this master data generator) if you use pattern ‘<STRUC[xxx]>’ (of course xxx should be a valid field of the DDIC structure).
- Add complex calculations based on method call. Pattern ‘<METHO[xxx|param1|param2|…]>’ will call method xxx with a table of parameters param1, param2, etc. where those parameters can be the result of expressions… Example of complex expression with method call: <METHO[ZCL_MY_CLASS=>GET_GUID|<BPATH[POD:./@GUID_INDOB]>]>
Obviously this is giving me enough options to cover 95% of my needs 🙂
And for the last 5%, I’m using a few more options that are also available:
5) Take full control when creating the object hierarchy:
Via ‘Multiline’ column you can duplicate the corresponding object (and sub-objects) as much as needed.
The ‘Create’ column allows you to force the object creation, otherwise the application would update the existing dependent object if any.
‘Filter’ is used in case no relationship can retrieve the exact record you need.
‘Differ’ option allows you to prevent commit( ) from being triggered after a root object has been created (hence it makes sense for root objects lines only).
And last but not least, you can use wrapper relationship if you need to, provided you name your relationship ‘WrapTo_xxx’ and the corresponding logic to wrap your entity is available in GET_ENTITY_WRAPPER method of class ZCL_CRM_MDD_GENERATOR.
DATA lr_generator TYPE REF TO zcl_crm_mdd_generator.
DATA ls_param TYPE <your parameter structure that will be used in <STRUC[…]> pattern>.
DATA lr_collection TYPE REF TO cl_crm_bol_bo_col.
CREATE OBJECT lr_generator.
lr_collection = lr_generator->create_tmpl( iv_template = <your template id> is_param = ls_param ).
Enjoy the result in SLG1 where every processed step is listed with one piece of information:
I’ve got a few ideas for further enhancements already, including:
– Create a WebUI component to help us fill-in the master data template customizing (SAP GUI view cluster is not really user friendly).
– BRF+ formula integration
… Or I’ll just wait and see if someone at SAP doesn’t come up with the same kind of tool and add it to standard delivery in the future 🙂