cancel
Showing results for 
Search instead for 
Did you mean: 

ovs for select-option field

Former Member
0 Kudos

Hi,

I have created select-options with five field , for 2 fields i am not getting f4 help to select the values.

i want to add f4 help for those?

thanks all,

Accepted Solutions (0)

Answers (3)

Answers (3)

shahid
Product and Topic Expert
Product and Topic Expert
0 Kudos

on ovs sel

trigger the below mode

{METHOD ovs_sel .

IF i_ovs_data-m_selection_field_id = 'BSTKD'.

po_ovs( i_ovs_data ).

ELSEIF i_ovs_data-m_selection_field_id = 'POSEX'.

po_ovs( i_ovs_data ).

ELSEIF i_ovs_data-m_selection_field_id = 'VBELN_GRP'.

ovs_sow( i_ovs_data ).

ELSEIF i_ovs_data-m_selection_field_id = 'PS_PSP_PNR1'.

ovs_wbs1( i_ovs_data ).

ELSEIF i_ovs_data-m_selection_field_id = 'PS_PSP_PNR3'.

ovs_wbs3( i_ovs_data ).

ELSEIF i_ovs_data-m_selection_field_id = 'PS_POSNR'.

ovs_bwbs( i_ovs_data ).

ENDIF.

ENDMETHOD.}

shahid
Product and Topic Expert
Product and Topic Expert
0 Kudos

sample code for OVS

method OVS_SOW .

* 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

      description type string,
      sow_id type string,
    end of lty_stru_input.
  types:
    begin of lty_stru_list,
*   add fields for the selection list here
      vbeln type vbeln_va,
      ktext type vbak-ktext,
    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_vbeln       type string,
        lv_desc        type string.

  CASE i_ovs_data-m_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 = `SOW_ID`.  "must match a field name of search
      ls_text-value = 'SOW ID'."wd_assist->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( key = '019' )."`WBS Level1`. .
      insert ls_text into table lt_label_texts.

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


      ls_text-name = `KTEXT`.  "must match a field in list structure
      ls_text-value = `SOW Description`.". "wd_assist->get_text( `002` ).
      insert ls_text into table lt_column_texts.

      ls_text-name = `VBELN`.  "must match a field in list structure
      ls_text-value = `SOW_ID`. "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` ).

      i_ovs_data-m_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
      i_ovs_data-m_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 i_ovs_data-m_ovs_callback_object->query_parameters IS NOT BOUND.
******** TODO exception handling********
      endif.
      ASSIGN i_ovs_data-m_ovs_callback_object->query_parameters->*
                              TO <ls_query_params>.
      IF NOT <ls_query_params> IS ASSIGNED.
******** TODO exception handling
      ENDIF.


     CONCATENATE '*' <ls_query_params>-sow_id '*' INTO <ls_query_params>-sow_id .
     CONCATENATE '*' <ls_query_params>-description '*' INTO <ls_query_params>-description .
     lv_vbeln =  <ls_query_params>-sow_id.
     lv_desc  =  <ls_query_params>-description.

    REPLACE ALL OCCURRENCES OF '*' IN lv_vbeln WITH '%' .
    REPLACE ALL OCCURRENCES OF '*' IN lv_desc WITH '%' .

  if lv_vbeln ne ' ' and lv_desc ne ' '.
  select  vbeln
          ktext
          from VBAK into table lt_select_list where auart = 'ZSOW' AND
                                                   ( vbeln LIKE lv_vbeln AND
                                                     ktext  LIKE lv_desc AND
                                                     AUGRU  NE '902').
  elseif lv_vbeln eq ' ' and lv_desc ne ' '.
  select  vbeln
          ktext
          from VBAK into table lt_select_list where auart = 'ZSOW' AND
                                                     ktext  LIKE lv_desc AND
                                                     AUGRU  NE '902' .
   elseif lv_vbeln ne ' ' and lv_desc eq ' '.
    select  vbeln
            ktext
            from VBAK into table lt_select_list where auart = 'ZSOW' AND
                                                       vbeln  LIKE lv_vbeln AND
                                                       AUGRU  NE '902' .
   endif.

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

      i_ovs_data-m_ovs_callback_object->set_output_table( output = lt_select_list ).


    WHEN if_wd_ovs=>co_phase_3.
*   apply result

      IF i_ovs_data-m_ovs_callback_object->selection IS NOT BOUND.
******** TODO exception handling
      ENDIF.

      ASSIGN i_ovs_data-m_ovs_callback_object->selection->* TO <ls_selection>.
      IF <ls_selection> IS ASSIGNED.
        i_ovs_data-m_ovs_callback_object->context_element->set_attribute(
                               name  = i_ovs_data-m_ovs_callback_object->context_attribute
                               value = <ls_selection>-VBELN ).
      ENDIF.
  ENDCASE.

endmethod.

Edited by: ssm on Aug 3, 2011 2:03 PM

Edited by: ssm on Aug 4, 2011 12:43 PM

Former Member
0 Kudos

Hi Vani,

If search help is available at dictionary level, you get by default, if not available you have to create OVS Help.

Check this Selectoptions with OVS help...

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/707f0d73-94f0-2d10-97a2-a3776e2118d8

Cheers,

Kris.

Former Member
0 Kudos

Hi,

when i click on f4 its doing to dump.

the error message is:

OVS: Methode SET_OUTPUT_TABLE Cannot Be Called .

I want ovs for plant field alone..

can u just post sample code for this?

Thank u

former_member199125
Active Contributor
0 Kudos

Hi Vani,

I have some sample code for ovs.But if i Paste entire code, it doesn;t look good. So am posting phase 2 code in ovs handler.

or you can check in http://www.saptechnical.com/Tutorials/WebDynproABAP/OVS/page1.htm

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 amatnr = bmatnr where

( amatnr like lv_matnr and bmaktx like lv_maktx and b~spras = 'EN').

ovs_callback_object->set_output_table( output = lt_select_list ).

Edited by: sanasrinivas on Aug 4, 2011 7:36 AM

Former Member
0 Kudos

Hi Vani,

Please past your code, so that we can suggest you where you are wrong..

Cheers,

Kris.

Former Member
0 Kudos

METHOD on_ovs_lst_doc_type .

  • 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

doc_type TYPE zpm_de_types,

doc_text TYPE zpm_de_tset_name,

END OF lty_stru_input.

TYPES:

BEGIN OF lty_stru_list,

  • add fields for the selection list here

doc_type_op TYPE zpm_de_types,

doc_text_op TYPE zpm_de_tset_name,

END OF lty_stru_list.

DATA: ls_search_input TYPE lty_stru_input,

wa_ZF02_TYPS_T type ZF02_TYPS_T,

lt_select_list TYPE TABLE OF ZF02_TYPS_T, "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 ZF02_TYPS_T. "lty_stru_list.

DATA: lv_doc_type TYPE string.

DATA: lv_doc_type1 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 = `DOC_TYPE`. "must match a field name of search

  • ls_text-value = `Doc Type`. "wd_assist->get_text( `001` ).

  • INSERT ls_text INTO TABLE lt_label_texts.

*

  • ls_text-name = `DOC_TEXT`. "must match a field name of search

  • ls_text-value = `Doc desc`. "wd_assist->get_text( `001` ).

  • INSERT ls_text INTO TABLE lt_label_texts.

*

  • ls_text-name = `DOC_TYPE_OP`. "must match a field in list structure

  • ls_text-value = `Doc Type`. "wd_assist->get_text( `002` ).

  • INSERT ls_text INTO TABLE lt_column_texts.

*

  • ls_text-name = `DOC_TEXT_OP`. "must match a field in list structure

  • ls_text-value = `Doc desc`. "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.

DATA lo_nd_vn_ovs_pr_list TYPE REF TO if_wd_context_node.

DATA lo_el_vn_ovs_pr_list TYPE REF TO if_wd_context_element.

DATA ls_vn_ovs_pr_list TYPE wd_this->element_vn_ovs_pr_list.

DATA lv_cha_ovs_doc_type LIKE ls_vn_ovs_pr_list-cha_ovs_doc_type.

  • navigate from <CONTEXT> to <VN_OVS_PR_LIST> via lead selection

lo_nd_vn_ovs_pr_list = wd_context->get_child_node( name = wd_this->wdctx_vn_ovs_pr_list ).

  • get element via lead selection

lo_el_vn_ovs_pr_list = lo_nd_vn_ovs_pr_list->get_element( ).

  • get single attribute

lo_el_vn_ovs_pr_list->get_attribute(

EXPORTING

name = `CHA_OVS_DOC_TYPE`

IMPORTING

value = lv_cha_ovs_doc_type ).

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 = ???

lv_doc_type = <ls_query_params>-doc_type.

lv_doc_type1 = <ls_query_params>-doc_text.

REPLACE ALL OCCURRENCES OF '*' IN lv_doc_type WITH '%' .

REPLACE ALL OCCURRENCES OF '*' IN lv_doc_type1 WITH '%' .

********

IF lv_doc_type NE ' ' AND lv_doc_type1 NE ' '.

SELECT types text FROM zf02_typs_t INTO TABLE lt_select_list

WHERE typeset = 'PR' AND language = 'EN'

AND types LIKE lv_doc_type

AND text LIKE lv_doc_type1

ORDER BY types ASCENDING.

ELSEIF lv_doc_type EQ ' ' AND lv_doc_type1 NE ' '.

SELECT types text FROM zf02_typs_t INTO TABLE lt_select_list

WHERE typeset = 'PR' AND language = 'EN'

AND text LIKE lv_doc_type1

ORDER BY types ASCENDING.

ELSEIF lv_doc_type NE ' ' AND lv_doc_type1 EQ ' '.

SELECT types text FROM zf02_typs_t INTO TABLE lt_select_list

WHERE typeset = 'PR' AND language = 'EN'

AND types LIKE lv_doc_type

ORDER BY types 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.

                • 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 = `DOC_TYPE`

value = <ls_selection>-TYPES ).

ovs_callback_object->context_element->set_attribute(

name = `DOC_TEXT`

value = <ls_selection>-TEXT ).

  • or

  • ovs_callback_object->context_element->set_static_attributes(

  • static_attributes = <ls_selection> ).

ENDIF.

ENDCASE.

ENDMETHOD.

Former Member
0 Kudos

Hi Vani,

It is difficult to understand that, You asked about PLANT(WERKS) field OVS, check this..

TYPES: BEGIN OF TY_VBELN, 
       VBELN TYPE T001W-WERKS,
         END OF TY_VBELN.

DATA: IT_VBELN TYPE TABLE OF TY_VBELN.

DATA: LT_VBELN TYPE TABLE OF T001W-werks,
      WA_VBELN LIKE LINE OF LT_VBELN,
      FIELDNAME TYPE STRING,
      LV_VBELN TYPE REF TO DATA.

FIELD-SYMBOLS: <LT_OVS_RESULT> TYPE TY_VBELN,
               <LT_SEL_OPT_RESULT> TYPE STANDARD TABLE,
               <FS_VBELN> TYPE TABLE,
               <FIELD> TYPE data.

*Getting select option from application source type
LV_VBELN = WD_THIS->M_HELPER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'VBELN' ).
ASSIGN LV_VBELN->* TO <FS_VBELN>.

CASE I_OVS_DATA-M_OVS_CALLBACK_OBJECT->PHASE_INDICATOR.
*  WHEN IF_WD_OVS=>CO_PHASE_0.

  WHEN IF_WD_OVS=>CO_PHASE_1.

WHEN IF_WD_OVS=>CO_PHASE_2.
SELECT WERKSINTO TABLE it_vbeln          // Here write your select query based on your requirement.
FROM T001W
WHERE ERNAM = LV_SYNAM.

I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SET_OUTPUT_TABLE( OUTPUT = IT_VBELN ).
WHEN IF_WD_OVS=>CO_PHASE_3.
  ASSIGN I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SELECTION->* TO
<LT_OVS_RESULT>.
  ASSIGN I_OVS_DATA-MT_SELECTED_VALUES->* TO <LT_SEL_OPT_RESULT>.
  FIELDNAME = I_OVS_DATA-M_SELECTION_FIELD_ID. "Removing RCF_
  ASSIGN COMPONENT FIELDNAME OF STRUCTURE <LT_OVS_RESULT> TO <FIELD>.
  INSERT <FIELD> INTO TABLE <LT_SEL_OPT_RESULT>.
ENDCASE.

Cheers,

Kris.