CRM 7 Web UI – Creating Views In this example we create 2 views in one window to select a business partner and then to search for orders for that business partner. In a second session, I’ll show you, once the orders are found, how one can click on a hyperlink on the order number in the rseults found to then display some details of the line items for that order. So let’s get started. Go to transaction BSP_WD_CMPWB and create a component. When prompted provide a window name. This will create a whole lot of classes and other stuff which you can add to a relevant transport. Once created you’ll see the following:
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CRM 7 Web UI – Creating ViewsIn this example we create 2 views in one window to select a business partner and then to search for
orders for that business partner. In a second session, I’ll show you, once the orders are found, how
one can click on a hyperlink on the order number in the rseults found to then display some details of
the line items for that order.
So let’s get started.
Go to transaction BSP_WD_CMPWB and create a component.
When prompted provide a window name.
This will create a whole lot of classes and other stuff which you can add to a relevant transport.
We now want to change this field from an ordinary input field into a field with a drop down. To do this
click on the View Structure tab. Open the Context folder, and open the BPNUMBER folder, then open
the Attributes folder. Right click on the BPNUMBER attribute and select Generate Getter and Setter
Methods. Once that has been done double click on the GET_P_BPNUMBER node and create the
method:
This will provide a blank implementation of this method where you can now put in the following code:
METHOD get_p_bpnumber. CASE iv_property. WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype. rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist. ENDCASE.ENDMETHOD.
To provide values in the drop down list we need to do a few things. Firstly we need to put an instance
attribute in the context class for the relevant attribute. Double click on the class shown just below the
attribute node. In my case the class is called ZL_ORDER_S_SEARCHCRITERI_CN00:
This will create a blank implementation of the method in which you can now put the following code:
method GET_V_BPNUMBER. data: lt_ddlb type bsp_wd_dropdown_table, ls_ddlb type bsp_wd_dropdown_line, ls_but000 type but000, lt_but000 like table of ls_but000. IF gr_ddlb is not bound. create object gr_ddlb exporting iv_source_type = 'T'.* get the values...*KEY 1 Types CHAR40*VALUE 1 Types TEXT80* initially add space to the dropdown for when there is no value there ls_ddlb-key = space. ls_ddlb-value = space. append ls_ddlb to lt_ddlb. select * from but000 into table lt_but000 where type = 1. if sy-subrc = 0. loop at lt_but000 into ls_but000. ls_ddlb-key = ls_but000-partner.
concatenate ls_but000-partner ls_but000-initials ls_but000-name_last into ls_ddlb-value separated by space. append ls_ddlb to lt_ddlb. endloop. endif. if lt_ddlb is not initial. gr_ddlb->set_selection_table( lt_ddlb ). endif. endif. rv_valuehelp_descriptor = gr_ddlb.endmethod.
Alternatively you could do a F4 value help on the field by implementing the code as shown below.
This uses search help ‘BUPAP’. If you want to use an Advanced Search Help you cannot use this –
this is for simple search helps only. When using a search help you would not implement the get_p
method. Note that you use the “struct” preface for the field name when using a Model node, for a
Value Node do not use the “struct” preface.
METHOD get_v_bpnumber. DATA: ls_map TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping, lt_inmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab, lt_outmap TYPE if_bsp_wd_valuehelp_f4descr=>gtype_param_mapping_tab. ls_map-context_attr = 'BPNUMBER'. "'struct.bpnumber'. ls_map-f4_attr = 'PARTNER'. APPEND ls_map TO lt_inmap. APPEND ls_map TO lt_outmap. CREATE OBJECT rv_valuehelp_descriptor TYPE cl_bsp_wd_valuehelp_f4descr EXPORTING iv_help_id = 'BUPAP' iv_help_id_kind = if_bsp_wd_valuehelp_f4descr=>help_id_kind_name iv_input_mapping = lt_inmap iv_output_mapping = lt_outmap.ENDMETHOD.
Now we need to configure our result list. Remember that we decided that we want this to display as a
table, so the configuration will look quite different. From the Model or Value node structure, you can
decide which fields you want to display and you can provide titles for each column. There are a few
other things that you can do, but I’ll leave that up to you to discover.
The following screenshots show some editing done to the htm created for our views. Because the
view group context does not exist in our scenario, the code to determine display mode would cause a
run time error. We therefore need to comment out this line of code. To do so we embrace it with the
following tags: <%– … –%> as below:
To find the htm file, double click on the node shown under the View Layout section:
Give the Event Name “SEARCH”. This will create a blank implementation of a method
EH_ONSEARCH which will be triggered when the button is pressed. Implement the following code in
the event handler. This will populate the BTAdminH model node of the resultList view via the custom
controller. The results will then be viewed in the table you created.
METHOD eh_onsearch. DATA lr_iterator TYPE REF TO if_bol_bo_col_iterator. DATA lr_bo TYPE REF TO if_bol_bo_property_access. DATA lv_bp TYPE bu_partner. DATA: lr_result TYPE REF TO if_bol_entity_col, ent TYPE REF TO cl_crm_bol_entity, enth TYPE REF TO cl_crm_bol_entity, lr_qs TYPE REF TO cl_crm_bol_query_service. lr_iterator = me->typed_context->bpnumber->collection_wrapper->get_iterator( ). IF lr_iterator IS BOUND. lr_bo = lr_iterator->get_first( ). IF lr_bo IS BOUND. lr_bo->get_property_as_value( EXPORTING iv_attr_name = 'BPNUMBER' IMPORTING ev_result = lv_bp ). lr_qs = cl_crm_bol_query_service=>get_instance( 'BTQuery1O' ).