二维码

[教程] USING CALLBACK CLASSES FOR CREATING SUB OBJECTS FOR VIEW CONFIGURATION

Twilight发表于 2016-01-16 01:02Twilight 最后回复于 2016-01-16 01:02 [复制链接] 3871 0

Open the class that we have created in the chapter UI OBJECT TYPE AND DESIGN OBJECTS.  If you remember, we have assigned this class as a CALLBACK class to the newly created object type as below. It implements the interface IF_BSP_DLC_OBJ_TYPE_CALLBACK.
Sub object 1.jpg

Go and place the code shown below and activate the method.
Sub object 2.jpg
  1. METHOD if_bsp_dlc_obj_type_callback~get_object_sub_types.

  2.   IF iv_object_type = 'ZOBJECT_TUT'.
  3.     APPEND 'SUBOBJECT1' TO result.
  4.     APPEND 'SUBOBJECT2' TO result.
  5.   ENDIF.

  6. ENDMETHOD.
复制代码

Based on the UI OBJECT TYPE, we simply adding two new sub objects.  Save and activate the class. Now go to ui component  and any view configuration tab. Click on new configuration .

Give the UI object type in the object type field and press f4  in the sub object type field. now f4 gives three possible values. One is default and another two are the values that we have defined in the method.
Sub object 3.jpg

So along with the UI object type, we can define two new configurations using SUBOBJECT1 and SUBOBJECT2.
I just made  one new configuration  with UI OBJECT TYPE and SUBOBJECT1.
Sub object 4.jpg

If I want to load this configuration, I need to code as shown below in the do config determination as discussed in the chapter DO CONFIG DETERMINATION.
  1. METHOD do_config_determination.

  2.   me->set_config_keys( EXPORTING iv_object_type = 'ZOBJECT_TUT' iv_object_sub_type = 'SUBOBJECT1' iv_propagate_2_children = '' ).

  3. ENDMETHOD.
复制代码

When I test the application. I got below output as per the new configuration. I can also create one more new configuration with UI OBJECT TYPE ZOBJECT _TUT and sub object type SUBOBJECT2.
Sub object 5.jpg
回复

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表