Professional Documents
Culture Documents
Applies to: SAP CRM 7.0. For more information, visit the Customer Relationship Management homepage. Summary A summary of creating Custom Genil/Bol components for Z-tables with relationship. We have extended the blog from this SDN Blog. http://wiki.sdn.sap.com/wiki/display/CRM/Extend+BOL+Model+BT+with+custom+table+type+relations hip Authors : Dhananjay Raskar and Kavindra Joshi Company: Fujitsu Consulting Created on: 14 September 2010 Authors Bio Dhananjay & Kavindra are SAP CRM consultant at Fujitsu Consulting India.
Table of Contents
Defining the Object Table Defining the Model Table Defining the Component Set/Component Defining the Zstructures and Ztables Order Table Order Structure Item Table Item Structure Shipment Table Shipment Structure
Creating your ZGenil Class , ZAPI class , Zorder class , ZItem Class , ZShipment class
Dont change the name of the Objects as defined in the document. If you change the names of the objects, do change the same in the code of the classes that you would implement to fetch respective objects. Also if you have defined Ztables, then also define your Zstructures and use your custom classes to get the data for Orders , Items , Partners & Shipments. 2) Defining the Model Table
Dont change the name of the relations. If you want to change the name of the relationship , then do update the coding in your respective classes. 3)Defining the Component Set/Component Customizing Settings for defining Custom GENIL Object Use SPRO Tcode.
Click on Ok Define Comp Name, Class Name Object Table Name and Model Table Name
Define Comp Set for your Compo. Select Compo Set and double click on Component assignment
Order Table
Order Table 1
Item Table
Item Structure
Shipment Table
Shipment Structure
5) Creating your ZGenil Class , ZAPI class , Zorder class , ZItem Class , ZShipment class Create a GENIL Class for the component. In my case I created ZKAVINDRA_GENIL_DEMO. As already explained , the GENIL class has to be inherited from CL_CRM_GENIL_ABSTR_COMPONENT.( I did the basic things so that I can have data in my Ztable.If you need to need to implement a full blooded scenario you need to implement all the methods of the interface as they would be needed by different operations) On the lines of these standard classes, Z classes needs to be Implemented for the following classes. "CL_CRM_GENIL_SAMPLE_COMP" -> Main GenIL handler class Above class must Implement IF_GENIL_APPL_INTLAY and IF_GENIL_APPL_MODEL or directly inherit from the class CL_CRM_GENIL_ABSTR_COMPONENT. Make sure that instead of calling the standard classes you are calling the Z classes for Order, Item, Partner and Shipment.
Implement the following methods for the class ZCL_CRM_GENIL_SAMPLE_COMP (Your GENIL class ) a) METHOD if_genil_appl_model~get_model. *CALL METHOD SUPER->IF_GENIL_APPL_MODEL~GET_MODEL * RECEIVING * RT_RELATION_DET = * . SELECT * FROM zdcrms_gil_model INTO CORRESPONDING FIELDS OF TABLE rt_relation_det.
ENDMETHOD. b) METHOD if_genil_appl_model~get_object_props. *CALL METHOD SUPER->IF_GENIL_APPL_MODEL~GET_OBJECT_PROPS * RECEIVING * RT_OBJ_PROPS = * . DATA: ls_method TYPE crmt_genil_obj_method_def. FIELD-SYMBOLS: <line> TYPE crmt_obj_properties. SELECT * FROM zdcrms_gil_sobj INTO CORRESPONDING FIELDS OF TABLE rt_obj_pro ps. * insert methods READ TABLE rt_obj_props WITH KEY object_name = 'Order' ASSIGNING <line>. "#EC NO TEXT IF sy-subrc = 0. ls_method-method_name = 'createFollowUp'. "#EC NOTEXT ls_method-param_struct = ''. ls_method-return_type = 'Order'. "#EC NOTEXT APPEND ls_method TO <line>-methods. ls_method-method_name = 'renumberItems'. "#EC NOTEXT ls_method-param_struct = 'CRMT_GENIL_ITEM_RENUM_PARAM'. ls_method-return_type = 'OrderItem'. "#EC NOTEXT APPEND ls_method TO <line>-methods. ls_method-method_name = 'repeatInput'. "#EC NOTEXT ls_method-param_struct = 'BAPITLINE'. ls_method-return_type = 'TDLINE'. "#EC NOTEXT APPEND ls_method TO <line>-methods. ENDIF. ENDMETHOD. c) METHOD if_genil_appl_intlay~create_objects. *CALL METHOD SUPER->IF_GENIL_APPL_INTLAY~CREATE_OBJECTS * EXPORTING * IV_OBJECT_NAME = ** iv_number =1 * IT_PARAMETERS = * IV_ROOT_LIST = * . DATA: ls_parameters TYPE crmt_genil_order_create, lt_request_obj TYPE crmt_request_obj_tab.
f)