Ads

ABAP WebDynpro Input Help

How to Create Input Help in WebDynpro ABAP

Input Help in WebDynpro ABAP,is 5th step duty of dynpro developer to create it.This is the most important topic in webdynpro components .What is the input help ,it is like a search help for user request in the screen field of any applications that is custom F4 help to display possible values for certain screen field .So to provide or creating input help for screen field in dynpro component .Ok now let us learn creating input help.


We can reuse existing search helps from the ABAP dictionary.However ,there are not available search helps for all data types in the system.One way of creating Input Help is to include OVS (Object Value Selection )value help,is implemented by system side effort.After enetering OVS value help for context attribute ,while the run time,The OVS component is then automatically triggered when a user presses the F4 button for a selected input field ,simultaneously ,Dialog box also created automatically on the screen.

Component WDR_OVS provides a view in which the search results can be displayed as a table. The component also contains a selection view that can be used to restrict the search value.
 method dynpro_inhelp .
  data: l_node          type ref to if_wd_context_node,
        l_data_selected type if_v_main=>element_sv_data_selected.
  l_node = wd_context->get_child_node( 'SV_DATA_SELECTED' ).
  l_node->get_static_attributes(
     importing
       static_attributes = l_data_selected ).
  l_node = wd_context->get_child_node( 'Material_NODE' ).
  l_node->set_attribute( name  = 'OBJID'
                         value = l_data_selected-OBJID ).
endmethod.



OVS Help 


method ON_OVS .
Declare data structures for the fields to be displayed and table columns of the selection list

  types:
    begin of lty_stru_input,
Add fields for the display of your search input .
      Stu_Id   type string,
      Name type string,
    end of lty_stru_input.
  types:
    begin of lty_stru_list,
Add fields for the selection list .
      short type short_d,
      stext type stext,
    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:  type lty_stru_input,
                     type lty_stru_list.
  DATA : lv_short TYPE string,
         lv_stext TYPE string.
  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 = `STU_ID`.  "must match a field name of search
      ls_text-value = `Student id`.
      INSERT ls_text INTO TABLE lt_label_texts.
      ls_text-name = `NAME`.  "must match a field name of search
      ls_text-value = `student name`.
      INSERT ls_text INTO TABLE lt_label_texts.
      ls_text-name = `SHORT`.
      ls_text-value = `student id`.
      INSERT ls_text INTO TABLE lt_column_texts.
      ls_text-name = `STEXT`.
      ls_text-value = `student name`.
      INSERT ls_text INTO TABLE lt_column_texts.
      ovs_callback_object->set_configuration(
                label_texts  = lt_label_texts
                column_texts = lt_column_texts
                group_header = 'Job Abbreviation'
                col_count    = 2
                row_count    = 10 ).
    when if_wd_ovs=>co_phase_1.  "set search structure and defaults
      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.
Exception Handling
      endif.
      assign ovs_callback_object->query_parameters->*
                              to .
      if not  is assigned.
      endif.
*     call business logic for a table of possible values
*     lt_select_list = ???
      lv_short = -Stu_Id.
      lv_stext = -Name.
      REPLACE ALL OCCURRENCES OF '*' IN lv_short WITH '%' .
      REPLACE ALL OCCURRENCES OF '*' IN lv_stext WITH '%' .
      IF lv_short NE ' ' AND lv_stext NE ' '.
        SELECT short stext  FROM STable INTO TABLE lt_select_list
        WHERE plvar = '01' AND otype = 'C' AND langu = 'EN' AND
            endda GE sy-datum AND ( short LIKE lv_short AND
            stext LIKE lv_stext )
            ORDER BY short ASCENDING.
      ELSEIF lv_short EQ ' ' AND lv_stext NE ' '.
        SELECT short stext FROM STable INTO TABLE lt_select_list
        WHERE plvar = '01' AND otype = 'C' AND langu = 'EN' AND
            endda GE sy-datum AND stext LIKE lv_stext
            ORDER BY short ASCENDING.
      ELSEIF lv_short NE ' ' AND lv_stext EQ ' '.
        SELECT short stext FROM STable INTO TABLE lt_select_list
        WHERE plvar = '01' AND otype = 'C' AND langu = 'EN' AND
            endda GE sy-datum AND short LIKE lv_short
            ORDER BY short ASCENDING.
      ENDIF.
      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.
Exception Handling
      endif.
      assign ovs_callback_object->selection->* to .
      if  is assigned.
        ovs_callback_object->context_element->set_attribute(
                               name  = `STU_ID`
                               value = -short ).
        ovs_callback_object->context_element->set_attribute(
                               name  = `NAME`
                               value = -stext ).
      endif.
  endcase.
endmethod.
From this post ,we have learnt creating the Search help or input help(F4) for webdynpro components.

Comments

Popular posts from this blog

BADI Interview Questions in SAP ABAP

Sample SAP ABAP Programming Examples for Practice

Module Pool Programming Interview Questions and Answers in SAP ABAP

Step by Step tutorial on BDC Session Method Program in SAP ABAP

SAP ABAP Interview Questions and Answers for 10 Years Experienced