SAP CRM — Create a Custom BOL for WEB-IC

bol-13

In this example we have only one relation ship and all the result and search structure belongs to the root node.

Now let us create the implementation class for this BOL. 

Create a new class Z_TEST_BOL_WEBIC using the class CL_CRM_GENIL_ABSTR_COMPONENT2  as super class. This is very important. If you didn’t inherit that super class they BOL object don’t understand your z class module. See the following screen shot for the bol implementation class module creation.

bol-14

Now you need to redifine the methods from the super class. Because we are planning this bol object for search let us redefine all the methods that are associated for search.See the following screen shot.

bol-15

Now you need to change the code in all the above method to fit your bol objects. First let us put our bol tables in this Get_Objects and Get_Model. See the following code cut and paste in the right methods.

  METHOD if_genil_appl_model~get_model.
* select the model from your z table
  SELECT * FROM ztest_model
      INTO CORRESPONDING FIELDS
    OF TABLE rt_relation_det.
ENDMETHOD
 

  METHOD if_genil_appl_intlay~get_objects.
  DATA: lr_object   TYPE REF TO   if_genil_container_object,
      lr_msg_cont TYPE REF TO   cl_crm_genil_global_mess_cont,
      lv_name_obj      TYPE    ztest_test_tbl-name,
      lr_attr_props       TYPE REF TO   if_genil_obj_attr_properties,
      l_result          TYPE  zes_test_tbl,
      lv_name           TYPE          crmt_ext_obj_name.

* all entries in the root list have the same type/name -> take first
  lr_object = iv_root_list->get_first( ).
  lr_msg_cont ?= iv_root_list->get_global_message_container( ).
  WHILE lr_object IS BOUND.
* make sure we got an entry.
* Note: the object from the root list must be either a root or access object.
*       Dependent objects will never be part of the root list.
    lv_name = lr_object->get_name( ).

    IF lr_object->check_attr_requested( ) = abap_true.
      CALL METHOD lr_object->get_key
        IMPORTING
          es_key = lv_name_obj.
      SELECT SINGLE * FROM ztest_test_tbl
        INTO CORRESPONDING FIELDS OF
        l_result WHERE name = lv_name_obj.
      lr_object->set_attributes( l_result ).
      lr_attr_props = lr_object->get_attr_props_obj( ).
      lr_attr_props->set_all_properties( if_genil_obj_attr_properties=>read_only ).
    ENDIF.

    lr_object = iv_root_list->get_next( ).
  ENDWHILE.
ENDMETHOD.

  METHOD if_genil_appl_intlay~get_dynamic_query_result.
  DATA:   lr_object       TYPE REF TO if_genil_cont_root_object,
          lt_result       TYPE TABLE OF zes_test_tbl,
          l_result        TYPE zes_test_tbl.

  SELECT * FROM ztest_test_tbl INTO TABLE lt_result.

  LOOP AT lt_result INTO l_result.
    lr_object = iv_root_list->add_object( iv_object_name = ‘TestRoot’
                              is_object_key  = l_result-name ).
    lr_object->set_query_root( abap_true ).
  ENDLOOP.
ENDMETHOD.

  METHOD if_genil_appl_model~get_object_props.
  SELECT * FROM ztest_object
    INTO CORRESPONDING FIELDS OF TABLE
    rt_obj_props.
ENDMETHOD.

Now compile the code and let us go the the BOL browser and execute this object and see if this is working.

Go to the Transaction GENIL_BOL_BROWSER.

Now give the bol component name. Ours is ZTBOL. See the following screen shots.

bol-16

13 thoughts on “SAP CRM — Create a Custom BOL for WEB-IC

  1. Hi Kumar,
    The article is great. Great worka dn effort I really appriciate it.
    I am wondering that how a transaction can be done. I need to create a BOL for a transaction (from ERP) in CRM. Can you please provide me soem idea that how it should be done. SHould a BOL be created for transaction or ….?
    Any kind of help would be great. I need to start the work ASAP and your help/feed back would a be great help.
    thanks

  2. Excellent blog/tutorial…. I understood every bit of it.. It is very clearly explained…
    Thank you for this.

  3. Hi,

    Thnks for the wonderfully demo ..

    However I am getting a short dump in the bol_browser .. when I double click on the value ???

    Thanks,
    Raghu

  4. Hi Kumar,

    Iam creating a custom BOL as in example provided by you, but a small clarification. Iam not understanding a entry which is in ztest_object table. Att structure ZES_SHWOFFER is entered as a entry in that table, but I cannot see this structure creation in entire example. Could you please help me, whether I should create this structure or not mandatory.

    Thanks,
    Charan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s