cancel
Showing results for 
Search instead for 
Did you mean: 

how to disable a input field in OVS search

Former Member
0 Kudos

Hi friends,

I have crated a OVS search help for matnr.

i have two input field like matnr and mat desc.. user can enter any value and hit SEARCH..

im getting results.

Now i want to hardoced a value of matnr = 001.. and make this field read only..

how can we do it..

i just took a example of matnr and mat desc. to make u understand easily...

kindly help.

Niraja

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi niraja,

For the field to the set the property Read-only you can check the check box in the view context-->attribute

their you can set the field read-only..

Regards,

Sravanthi

Former Member
0 Kudos

Hi Guys,

I didnt designed the layout for the input fields in my OVS component layout.

In OVS event handler.. i just used set_configurtion and defined the label texts for my input fields.

thats it.

So i dont have any option in property to set read only in the layout.

can u tell me how else i can do this in my code to make it ready only.

Niraja

bryan_cain
Contributor
0 Kudos

That's what I was trying to tell you - You can't make it read only.

If you leave MATNR out of the phase 1 entirely the user will not be able to edit it. You can still user MATNR in the phase 2 part of your code, even if it's not in phase 1.

pranav_nagpal2
Contributor
0 Kudos

Hi Nirija,

To customize your search help i would suggest usage of freely program search help....

regards

Pranav

Former Member
0 Kudos

not solved

Former Member
0 Kudos

Hi Niraja,

yes you can pass the values eventhough OVS is in readonly mode.

The F4 help value cannot be placed in to it.

Regards,

Shashikanth. D

Former Member
0 Kudos

shashikant,

I didnt get what u mean, can u explain me.

i want that field to be displayed with default hardcoeded value and need it as READ ONLY

Former Member
0 Kudos

Hi Niraja,

In the context, you will be creating an attribute with some name and say type as 'MATNR'.

There you might have set the Input help as 'OVS', and might have given some name of the OVS component.

There in the context properties of the attribute, you have a property called 'DEFAULT VALUE'.

There you can fill the value which you want.

This will appear in OVS by default.

Read only can be set in the Layout, for the respective attribute UI element.

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

You can initialize the value for MATNR in the phase 1 of the eventhandler method for OVS. Try refer the code segment below. Am initializing the values for MATNR & MAKTX fields in the lines:

ls_search_input-matnr = 'D*'.
ls_search_input-maktx = '*'.

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

Regards,

Uday

Below is the complete code from my eventhandler method:

method ON_OVS .
" declare data structures for the fields to be displayed and for the table columns of the selection list
  types:
    begin of lty_stru_input,
"   add fields for the display of your search input here
      matnr type string,
      maktx type string,
    end of lty_stru_input.
  types:
    begin of lty_stru_list,
"   add fields for the selection list here
      matnr type string,
      maktx type string,
    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.

  data: lv_matnr type mara-matnr,
        lv_maktx type makt-maktx.

  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 don't want to use the defaults (DDIC-texts)

      ls_text-name  = `MATNR`.  "must match a field name of search
      ls_text-value = `Material Number`. "wd_assist->get_text( `001` ).
      insert ls_text into table lt_label_texts.

      ls_text-name  = `MAKTX`.
      ls_text-value = `Material Description`.
      insert ls_text into table lt_label_texts.

      ls_text-name = `MATNR`.  "must match a field in list structure
      ls_text-value = `Col1 -> Material Number`. "wd_assist->get_text( `002` ).
      insert ls_text into table lt_column_texts.

      ls_text-name = `MAKTX`.  "must match a field in list structure
      ls_text-value = `Col2 -> Material Description`. "wd_assist->get_text( `002` ).
      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 = lv_group_header
                window_title = lv_window_title
                table_header = lv_table_header
                col_count    = 2
                row_count    = 10 ).


    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 ).

" Setting the default values to be displayed in the selection screen

    ls_search_input-matnr = 'D*'.
    ls_search_input-maktx = '*'.

"     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.

      assign ovs_callback_object->query_parameters->*
                              to <ls_query_params>.
      lv_matnr = <ls_query_params>-matnr.
      lv_maktx = <ls_query_params>-maktx.

replace all occurences of: '*' in lv_matnr with '%',
                           '*' in lv_maktx with '%'.

select a~matnr
       b~maktx into corresponding fields of table lt_select_list up to 10 rows
                 from mara  as a inner join
                 makt as b on a~matnr = b~matnr where
                 ( a~matnr like lv_matnr and b~maktx like lv_maktx and b~spras = 'EN' ).

"     call business logic for a table of possible values
"     lt_select_list = ???

      ovs_callback_object->set_output_table( output = lt_select_list ).


    when if_wd_ovs=>co_phase_3.
"   apply result

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

        concatenate 'Description from MAKT:'
                    <ls_selection>-MAKTX
                    into <ls_selection>-MAKTX separated by space.

        ovs_callback_object->context_element->set_attribute(
                               name  = `MAKTX`
                               value = <ls_selection>-MAKTX ).
      endif.
  endcase.
endmethod.

Former Member
0 Kudos

Uday,

how can i make that matnr field read only??

Niraja

bryan_cain
Contributor
0 Kudos

As far as I know what you're looking to do can't be done in an OVS.

To get a similar result (where the user can only edit 1 field, but you still do the lookup on 2 fields), just leave MATNR out of phase 1 entirely. The only field in phase 1 is now MAKTX, and you can hard code (or read, as the case may be) MATNR in phase 2.