Skip to Content

Add the component wdr_ovs in your component.

1.PNG

Go to your view, Inside of the view select properties tab and add component usage.pop up will come like this screen shot. Inside  of the pop up select interface controller.

2.PNG

After selection of interface controller the screen should be like this.

3.PNG

Go to component controller context and create node and attributes .

4.PNG

When creation of attributes the input help mode should be object value selector

5.PNG

When creation of attributes click f4 help for ovs component usage. One pop up shows the component usage which already you added in component.

6.PNG

Go to  context tab in view and map the node from component controller context to view context,

7.PNG

After mapping  the screen should be like this.

8.PNG

Go to layout tab in view and create one label for input field .The type should be label  and create one input field for this label with type of input field like label.

9.PNG

IN Property of label give text name as Vendor number.

10.PNG

In Properties  of label fill the field label for (input field).

11.PNG

In properties of input field bind the value from context node.

12.PNG13.PNG

Value now binded.

13.PNG

Create one event handler method in view. when you select the ovs from popup some coding automatically generate in inside of method.

14.PNG

Then click on that method coding already there, we have to change some coding depends upon our search help field. Field name and field text for start search.

15.PNG

Modify the program like below .

  declare data structures for the fields to be displayed and
* for the table columns of the selection list, if necessary
   types:
     begin of lty_stru_input,
*   add fields for the display of your search input here
       lifnr type lifnr,
       name1 type name1_gp,
     end of lty_stru_input.
   types:
     begin of lty_stru_list,
*   add fields for the selection list here
        lifnr type lifnr,
       name1 type name1_gp,
     end of lty_stru_list.

   data: ls_search_input  type lty_stru_input,
         lt_select_list   type standard table of lty_stru_list,
         ls_text          type wdr_name_value,
         lt_label_texts   type wdr_name_value_list,
         lt_column_texts  type wdr_name_value_list,
         lv_window_title  type string,
         lv_group_header  type string,
         lv_table_header  type string.

   field-symbols: <ls_query_params> type lty_stru_input,
                  <ls_selection>    type lty_stru_list.

   case ovs_callback_object->phase_indicator.

     when if_wd_ovs=>co_phase_0.  “configuration phase, may be omitted
*   in this phase you have the possibility to define the texts,
*   if you do not want to use the defaults (DDIC-texts)

       ls_text-name = `LIFNR`“must match a field name of search
      ls_text-value = `VENDOR NUMBER`. “wd_assist->get_text( `001` ).
       insert ls_text into table lt_label_texts.

        ls_text-name = `NAME1`“must match a field name of search
       ls_text-value = `VENDOR NAME`. “wd_assist->get_text( `001` ).
       insert ls_text into table lt_label_texts.

       ls_text-name = `LIFNR`“must match a field in list structure
       ls_text-value = `VENDOR NUMBER`. “wd_assist->get_text( `002` ).
       insert ls_text into table lt_column_texts.

       ls_text-name = `NAME1`“must match a field in list structure
       ls_text-value = `VENDOR NAME`. “wd_assist->get_text( `002` ).
       insert ls_text into table lt_column_texts.

*      lv_window_title = wd_assist->get_text( `003` ).
*      lv_group_header = wd_assist->get_text( `004` ).
*      lv_table_header = wd_assist->get_text( `005` ).

       ovs_callback_object->set_configuration(
                 label_texts  = lt_label_texts
                 column_texts = lt_column_texts
                 group_header = lv_group_header
                 window_title = lv_window_title
                 table_header = lv_table_header
                 col_count    = 2
                 row_count    = 20 ).

     when if_wd_ovs=>co_phase_1.  “set search structure and defaults
*   In this phase you can set the structure and default values
*   of the search structure. If this phase is omitted, the search
*   fields will not be displayed, but the selection table is
*   displayed directly.
*   Read values of the original context (not necessary, but you
*   may set these as the defaults). A reference to the context
*   element is available in the callback object.

       ovs_callback_object->context_element->get_static_attributes(
           importing static_attributes = ls_search_input ).
*     pass the values to the OVS component
       ovs_callback_object->set_input_structure(
           input = ls_search_input ).

     when if_wd_ovs=>co_phase_2.
*   If phase 1 is implemented, use the field input for the
*   selection of the table.
*   If phase 1 is omitted, use values from your own context.

       if ovs_callback_object->query_parameters is not bound.
******** TODO exception handling
       endif.
       assign ovs_callback_object->query_parameters->*
                               to <ls_query_params>.
       if not <ls_query_params> is assigned.
******** TODO exception handling
       endif.

*     call business logic for a table of possible values
*     lt_select_list = ???
select LIFNR NAME1 from lfa1 into table lt_select_list .
       ovs_callback_object->set_output_table( output = lt_select_list ).

     when if_wd_ovs=>co_phase_3.
*   apply result

       if ovs_callback_object->selection is not bound.
******** TODO exception handling
       endif.

       assign ovs_callback_object->selection->* to <ls_selection>.
       if <ls_selection> is assigned.
         ovs_callback_object->context_element->set_attribute(
                                name  = `LIFNR`
                                value = <ls_selection>-LIFNR ).

         ovs_callback_object->context_element->set_attribute(
                                name  = `NAME1`
                                value = <ls_selection>-NAME1 ).
*      or
*        ovs_callback_object->context_element->set_static_attributes(
*                               static_attributes = <ls_selection> ).

       endif.
   endcase.

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

        1. Jason Lax

          Delete + repost is one way: another is to click Report Abuse in the actions box to notify a moderator of the action required.

          I’ve now moved this ‘blog’ (really should be a document, actually) to WD ABAP.

          (0) 
          1. Marilyn Pratt

            And I’ve removed it from Abuse but it would be great to see this as a document.  Just create a new document under create and you can cut and paste the contents of this blog there

            (0) 

Leave a Reply