*Object Value Selector in ABAP* In this Blog, I have narrated my experience of using OVS help for populating material in my Sales order creation scenario. For populating Material table, we have provided Object Value Selector (OVS) that will call Bapi which takes Customer Number and Sales Area Data as input and list out all the materials corresponding to that particular Customer for that particular sales area. On selecting one of the listed materials from the output list, the corresponding material name and material description field will get populated. On Clicking the OVS Input Help for Material, we will get the shown Selection screen. On Entering the Required Details and clicking the “Start Search” Button, Bapi will be executed which will list out all the possible materials as shown below. On Selecting one of the Material from the OVS Output list and clicking the “Copy” button, the material name and description field will get populated. *Introduction About Object Value Selector* Generic help like value help can only be used for the field to which it is binded i.e. its scope is limited to that structure to which it is binded. But there are scenarios where we need a search help that allow multiple input fields to be populated or take multiple fields for search criteria. In this case, OVS comes into picture. OVS provide us with the selection screen that can contain multiple input fields to which our selection criteria can be restricted and displaying results values that can be used to populate different input fields. OVS makes use of the PHASE MODEL. We have two components in picture: OVS component and Consumer component. At certain point of time, OVS Component requires some information from consumer component. For this, OVS component fires OVS event. The parameter PHASE_INDICATOR is used to indicate the type of information requested. An event handler method in the consumer component subscribes to the OVS event and collects the information requested. For handling back this information to the OVS component, it makes use of certain methods in the OVS component. The reference to the object OVS_CALLBACK_OBJECT containing these methods is provided by the OVS event. These methods include: SET_CONFIGURATION(), SET_INPUT_STRUCTURE(), SET_OUTPUT_TABLE(). *Phase_Indicator has four phases: Phase 0,1,2,3.* For Detail about different phases, you can go through the link. [http://help.sap.com/saphelp_erp2005/helpdata/en/30/d7fa41c915da6fe10000000a1550b0/content.htm | http://help.sap.com/saphelp_erp2005/helpdata/en/30/d7fa41c915da6fe10000000a1550b0/content.htm] *CODE :*
1. Declare the WDR_OVS Component in the used component list in your WD component.
2. In the Property tab of your view in which the OVS help has to be implemented, declare the usage of the WDR_OVS interface controller in the “used Web Dynpro Controller” list.
3. In the Component controller’s context, in the attribute to which OVS help has to be provided, select “Object Value Selector” as Input Help Mode and select the OVS Component decalred in the OVS Component usage through the help given to the right.
4. Declare the event handler method in the Method tab of the view that subscribe to OVS event.