Creating ABAP Classes with Interface IF_RS_BBS_BADI_HANDLER

Procedure

  1. In the SAP Easy Access menu, choose Tools → ABAP Workbench → Development → Class Builder.
  2. Enter a name for the object type (in the example: ZCL_IM_RS_BBS_BADI_HANDLER_DET).
  3. Choose Create.
  4. Save the class interface.
  5. Choose the Interfaces tab page.
  6. Specify the interface IF_RS_BBS_BADI_HANDLER.
  7. Save your entries. By saving your entries, the methods of the interface become visible.

    More information:

  8. Select the Methods tab page.
  9. Create method CLASS_CONSTRUCTOR. Since the method does not exist in the interface, you must create it manually. To do so, copy the coding in the example.
  10. Change the method IF_RS_BBS_BADI_HANDLER~GET_TARGETS in order to obtain an input help under Report in the maintenance transaction for the sender-receiver assignment.
  11. Change the method IF_RS_BBS_BADI_HANDLER~CALL_URL in order to create the URL and append the required parameters.
  12. Activate the class interface.

Example

The example adds a new entry Drilldown to Details in the dropdown box under Report Type when you create or change the sender-receiver assignment (see method CLASS_CONSTRUCTOR). The input help under Report contains the three entries Details of Product, Details of Customer and Search at Google (see method ...GET_TARGETS).

methodCLASS_CONSTRUCTOR.* This text appears in dropdown box of new jump target in transaction RSBBSif_rs_bbs_badi_handler~n_text = 'Drilldown to Details'.* Define what calls can be handledif_rs_bbs_badi_handler~n_url_call    = rs_c_true.  if_rs_bbs_badi_handler~n_sapgui_call = rs_c_false.endmethod.methodif_rs_bbs_badi_handler~get_targets.  data:    ls_f4_list     typersbbs_s_f4_list.* These entries ("Details of Product" and "Details of Customer") appear as value helpclearls_f4_list.  ls_f4_list-icon= icon_complete.  appendls_f4_list toe_t_f4_list.  appendls_f4_list toe_t_f4_list.  appendls_f4_list toe_t_f4_list.endmethod.methodif_rs_bbs_badi_handler~call_url.  data:    l_sx_mapping                typersbbs_sx_mapping,    l_s_range                   typerrrangesid,    l_query                     typestring,    l_data_provider             typestring,    l_structure                 typestring,    l_structure_member          typestring,    l_characteristic            typestring,    l_characteristic_value      typestring,    l_characteristic_drill_down typestring.  casei_onam.    when'CUSTOMER'.      readtablei_thx_mapping intol_sx_mapping withkeyfieldnm = '0D_PH2'.      readtablel_sx_mapping-range intol_s_range index1.      l_characteristic_value = l_s_range-low.      readtablei_thx_mapping intol_sx_mapping withkeyfieldnm = '1KYFNM'.      readtablel_sx_mapping-range intol_s_range index1.      casel_s_range-low.        when'0D_INV_QTY'.        when'0D_NETSALES'.      concatenate* Initial URL'/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY='l_query* Filter characteristic'&BI_COMMAND_1-BI_COMMAND_TYPE=SET_SELECTION_STATE''&BI_COMMAND_1-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1='l_data_provider        '&BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-SELECTIONS-SELECTION_1=SELECTION_INPUT_STRING''&BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-SELECTIONS-SELECTION_1-SELECTION_INPUT_STRING='l_characteristic_value        '&BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-CHARACTERISTIC='l_characteristic* Filter key figure'&BI_COMMAND_2-BI_COMMAND_TYPE=SET_SELECTION_STATE''&BI_COMMAND_2-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1='l_data_provider        '&BI_COMMAND_2-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-SELECTIONS-SELECTION_1=SELECTION_INPUT_STRING''&BI_COMMAND_2-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-SELECTIONS-SELECTION_1-SELECTION_INPUT_STRING='l_structure_member        '&BI_COMMAND_2-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-CHARACTERISTIC='l_structure* Drill down new characteristic'&BI_COMMAND_3-BI_COMMAND_TYPE=DRILL_DOWN''&BI_COMMAND_3-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1='l_data_provider        '&BI_COMMAND_3-CHARACTERISTIC='l_characteristic_drill_down      intor_url.    when'PRODUCT'.*     PRODUCT is equivalent to CUSTOMERwhen'GOOGLE'.      readtablei_thx_mapping intol_sx_mapping withkeyfieldnm = '0D_PH2'.      readtablel_sx_mapping-range intol_s_range index1.      concatenate'http://www.google.com/search?q='l_s_range-low intor_url.  endcase.endmethod.
        type-pools icon.        ls_f4_list-objnm = 'PRODUCT'.  ls_f4_list-txtlg = 'Details of Product'.    ls_f4_list-objnm = 'CUSTOMER'.  ls_f4_list-txtlg = 'Details of Customer'.      ls_f4_list-objnm = 'GOOGLE'.  ls_f4_list-txtlg = 'Search at Google'.                    l_query = 'TK_RRI'.      l_data_provider = 'DP_1'.      l_structure = '44U3MQMQ9244NORNFYM5XRCRB'.      l_characteristic = '0D_PH2'.                              l_structure_member = '44U3MQUES0PU6BB3LSOI7TBH3'.           l_structure_member = '44U3MR23AZBJOXUJRMQUHVA6V'.      endcase.      l_characteristic_drill_down = '0D_CUSTOMER'.