cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Phase Indicator?

Former Member
0 Kudos

Hi All.

How to use Phase Indicator? Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member515618
Active Participant
0 Kudos

Hi,

Please find the code snippet below.

I have explained in detail about the different phase indicator as and when they come up.

----


  • Types (ty_)

----


TYPES:

BEGIN OF ty_severity_list,

severe TYPE ccihe_severe,

severetxt TYPE ccihe_severetxt,

END OF ty_severity_list,

BEGIN OF ty_input,

severe TYPE ccihe_severe,

END OF ty_input,

----


  • Local objects (lo_)

----


DATA: lo_nd_record_risk TYPE REF TO if_wd_context_node,

lo_el_record_risk TYPE REF TO if_wd_context_element.

----


  • Local tables (lt_)

----


DATA: lt_severity_list TYPE STANDARD TABLE OF ty_severity_list,

lt_column_texts TYPE wdr_name_value_list,

----


  • Local structures (ls_)

----


ls_severity_list TYPE ty_severity_list,

ls_text TYPE wdr_name_value,

ls_record_risk TYPE wd_this->element_record_risk,

----


  • Local variables (lv_)

----


lv_window_title TYPE string,

lv_zzsevere LIKE ls_record_risk-zzsevere,

lv_zzseveretxt LIKE ls_record_risk-zzseveretxt.

----


  • field symbols(fs_)

----


FIELD-SYMBOLS: <fs_selection> TYPE ty_severity_list.

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

lo_nd_record_risk = wd_context->get_child_node( name = wd_this->wdctx_record_risk ).

  • get element via lead selection

lo_el_record_risk = lo_nd_record_risk->get_element( ).

CASE ovs_callback_object->phase_indicator.

WHEN if_wd_ovs=>co_phase_0. "configuration phase, may be omitted

*Here you set

*The window title, the heading, or the column heading of the output table displayed ass hit list

*We can also set the selectability property, Basically the number of records that can be selected.

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

ls_text-value = wd_assist->if_wd_component_assistance~get_text( key = '010' ).

INSERT ls_text INTO TABLE lt_column_texts.

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

ls_text-value = wd_assist->if_wd_component_assistance~get_text( key = '011' ).

INSERT ls_text INTO TABLE lt_column_texts.

lv_window_title = wd_assist->if_wd_component_assistance~get_text( key = '012' ).

ovs_callback_object->set_configuration(

column_texts = lt_column_texts

window_title = lv_window_title

col_count = 2

row_count = 10 ).

WHEN if_wd_ovs=>co_phase_1.

*This section is optional.

*This is to set the Selection view of the OVS component and default values on the screen.

*Here you can define the fields using which we can be used for further restricting the hitlist.

*The method SET_INPUT_STRUCTURE is provided for this purpose. If this not called, then the hitlist is displayed immediately.

ls_input-severe = '1'.

ovs_callback_object->set_input_structure( ls_input ).

*If the above method is called in some other phases then it would raise an error message.

WHEN if_wd_ovs=>co_phase_2.

*In this phase we can fetch the records to build the hitlist. The restrictions entered on the screen defined in phase 1 can be fetched from instance attribute QUERY_PARAMETERS of the event *parameter OVS_CALLBACK_OBJECT. Use method SET_OUTPUT_TABLE of the event parameter OVS_CALLBACK_OBJECT.

SELECT a~severe

b~severetxt

INTO CORRESPONDING FIELDS OF TABLE lt_severity_list

FROM ccihc_sv AS a INNER JOIN

ccihc_svtxt AS b ON asevere EQ bsevere

WHERE aratingcat EQ bratingcat AND

a~ratingcat = 'ZAN' AND

b~langu = sy-langu.

ovs_callback_object->set_output_table( output = lt_severity_list ).

WHEN if_wd_ovs=>co_phase_3.

*The result of the search was displayed in the results view of the OVS component and when user selects a record(s) on the hitlist displayed. The cursor comes to this phase and the selected *values can be fetched by reading the instance attribute SELECTION of the result parameter OVS_CALLBACK_OBJECT.

ASSIGN ovs_callback_object->selection->* TO <fs_selection>.

IF <fs_selection> IS ASSIGNED.

lv_zzsevere = <fs_selection>-severe.

lv_zzseveretxt = <fs_selection>-severetxt.

  • get single attribute

lo_el_record_risk->set_attribute( name = `ZZSEVERE`

value = lv_zzsevere ).

  • get single attribute

lo_el_record_risk->set_attribute( name = `ZZSEVERETXT`

value = lv_zzseveretxt ).

ENDIF.

ENDCASE.

Do let me know in case you need any more details.

Regards,

Sravan Varagani

former_member515618
Active Participant
0 Kudos

To add to the above details, the following are the instances when different phases are called during runtime.

Phase indicators IF_WD_OVS=>CO_PHASE_0, IF_WD_OVS=>CO_PHASE_1 and IF_WD_OVS=>CO_PHASE_2 are all called before the hit list is displayed of no restrictions fields are set in IF_WD_OVS=>CO_PHASE_1.

If restrictions are set then, IF_WD_OVS=>CO_PHASE_0 and IF_WD_OVS=>CO_PHASE_1 are called to set the hit list layout, and design the restriction screen. Once user enters the values on this screen and clicks on OK, Phase indicator is set to IF_WD_OVS=>CO_PHASE_2. Here built the hitlist and set as output.

Now the screen is displayed with the value help and when user clicks on any of the records and hits OK, then Phase indicator is set to IF_WD_OVS=>CO_PHASE_3 and the selected record can be read and set to the context.

Hope this helps.

Regards,

Sravan Varagani

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sravan.

Yes. and I would like to know how it work ? and do you have the example program?

Thank you.

former_member515618
Active Participant
0 Kudos

Hi Yinglak,

Are you refering to Phase indicator in OVS value help?

Regards,

Sravan Varagani