Recently I had a requirement of providing search help to POWL selection screen field. Twist part was, search help result should be depend on the other POWL selection screen field’s value.
SAP has provided an Interface IF_POWL_OVS which could be used to provide OVS search help to POWL.
First create OVS event handler class by implementing the interface IF_POWL_OVS. As prerequisite, set the class name as OVS handler for the required field. This should be done in GET_SEL_CRITERIA method of POWL Feeder class, Pass the class name to OVS_HANDLER_NAME.
The interface has four separate methods HANDLE_PHASE0, HANDLE_PHASE1, HANDLE_PHASE3 and HANDLE_PHASE4. Implementation is similar to like other OVS implementation.
HANDLE_PHASE0 to set configuration like title, selection mode, ROW count etc. Here SET_CONFIGURATION method of I_OVS_CALLBACK called.
HANDLE_PHASE1 to define selection fields and default values of search help. Here SET_INPUT_STRCTURE method of I_OVS_CALLBACK called. This is optional, only required if dialog selection required to restrict search result. (Search help type C – Complex Dialog)
HANDLE_PHASE2 to build the search help result. Here SET_OUTPUT_TABLE method of I_OVS_CALLBACK called with result set.
HANDLE_PHASE3 to export result value back to entry field by setting value for the context attribute.
Here I want emphasis more HANDLE_PHASE2 method to provide dynamic result. PHASE2 used to build search result set. POWL interface has provided one additional importing parameter IT_RELATED_FIELDS which has POWL selection screen fields. This importing table could be used to get selection criteria of POWL.
The IT_RELATED_FIELDS contain field called M_ID which is nothing but selection screen field name which we had given during defining GET_SEL_CRITERIA method. For each selection screen field, the importing table contains the properties like type (Parameter / Select Option), as check box, as drop down, read only etc.Values which are been selected on the screen will be available at Field M_VALUE (For Parameter) and MT_RANGE_TABLE (For Select Option).
My requirement was to provide business Partner value help for each voyage which has been selected on POWL screen. Hence I have to read which voyage has been selected. To get voyage I have read the IT_RELATED_FIELDS with M_ID = S_003 (Screen field name of Voyage field).
From the screen shot we can notice I’m reading voyage by passing M_ID = S_003 (Voyage) which is nothing the screen name I defined for voyage in GET_SEL_CRITERIA method. ET_R_VOYAGE of type RSELOPTION.
Later I used the voyage information to get partner related to it. The final result set as output for search result list display. And so on.