You can integrate a custom view (Web Dynpro screen component) in a step of your guided procedure. To do so, implement a component controller.
Recommendation
If you have multiple activities with different views, create these views under the same component controller.
You are familiar with the Web Dynpro tools in the ABAP Workbench (SE80
).
Create a component controller which implements the interface WD_IF_SISE_STEP
.
By default, the component controller contains the following:
the W_MAIN
window
the following methods of the interface controller:
IS_SAVE_ENABLED
: to enable/disable the Save
and Reset
pushbuttons in the toolbar
SAVE
: to save the changes made on the screen
SET_CHANGE_MODE
: to set the mode to Edit
or Read only
the REFRESH_LOG
event: This event can be triggered when the log table in the view must be refreshed.
You can use the following optional parameters:
To refresh the log of all activities in a step: R_STEP
To refresh the log of an activity only: R_ACTIVITY
The type of the parameters is class CL_SISE_STEP_ABS
.
the READ_ONLY
context element for the mode control.
READ_ONLY Attribute
Ensure that the view contains a reference to the activity performed in the view. The context attribute must be of type ref
to the type of the class that implements the activity.
This context attribute is instantiated by the framework by calling this view using outbound plugs. Via this context attribute, any method that is implemented in the activity class can be called.
An implementation of a default plug as the entry point of the view is shown in the following code example:
Syntax
METHOD HANDLEDEFAULT .
DATA LR_EX TYPE REF TO CX_ROOT.
TRY.
* Set corresponding activity object as attribute
WD_THIS->AR_ACTIVITY ?= WD_COMP_CONTROLLER->GR_STEP->GET_ACTIVITY( CL_SISE_ACT_CUSTOM_AGS=>C_ID_AGS_MNGD_RFC ).
CATCH CX_SISE_MODEL INTO LR_EX.
WD_COMP_CONTROLLER->SHOW_MSG( IR_EXCEPTION = LR_EX ).
ENDTRY.
ENDMETHOD.
To bind the context node MODE_CONROL
to the corresponding context node of the component controller, drag from the component controller to the view.
Binding the context node MODE_CONTROL to the component controller
To create the UI elements of the view, for any UI element that is to act at the action edit/read only, bind the Enabled
property to the inverted READ_ONLY
attribute. To do so, in the Define Content Binding
dialog box, select the Invert Attribute/Property
checkbox.
Binding the Enabled property to the inverted READ_ONLY attribute
Implement the coding on the view level, for example the actions when pushbuttons are pressed.
Implement the activity.
An implementation of the CHECK_SAPOSS
connection test is shown in the following code example:
Syntax
method ONACTIONCHECK_RFC .
TRY.
CALL METHOD wd_this->AR_ACTIVITY->CHECK_SAPOSS .
CATCH CX_SISE_LOG .
CATCH CX_SISE_MODEL .
ENDTRY.
WD_THIS->REFRESH_LOG( ).
endmethod.
To send the REFRESH_LOG
event to the framework and refresh the log table for the requested step or activity, use an implementation of the refresh_log
method:
Syntax
METHOD refresh_log .
WD_COMP_CONTROLLER->fire_refresh_log_evt(
r_step = wd_comp_controller->gr_step
r_activity = WD_COMP_CONTROLLER->GR_ACTIVITY
).
ENDMETHOD.
You can implement the following methods on the level of the component controller:
To enable or disable the Save
pushbutton in a view and save the view, use the GET_SAVE_VISIBILITY
method. This is useful, for example, to control steps independently if they are in the same component controller.
Syntax
method IS_SAVE_ENABLED.
CASE iv_name_of_view.
WHEN 'MAIN_VIEW'.
rv_enabled = abap_true.
WHEN OTHERS.
rv_visibility = abap_false.
ENDCASE.
endmethod.
To save information, use the SAVE
method. This allows save events to be triggered and handled in a view.
For more information about implementing the SAVE
method in a view, see, for example, the WD_SISE_CUSTOM_AGS
Web Dynpro component.
To update the UI according to the Change/Display mode context attribute, use the SET_CHANGE_MODE
method.
Syntax
method SET_CHANGE_MODE .
DATA:lo_nd_mode_control TYPE REF TO if_wd_context_node,
lo_el_mode_control TYPE REF TO if_wd_context_element.
DATA:lv_display_mode TYPE oax.
lo_nd_mode_control = wd_context->get_child_node( name = wd_this->wdctx_mode_control ).
lo_el_mode_control = lo_nd_mode_control->get_element( ).
lo_el_mode_control->set_attribute( name = `READ_ONLY` VALUE = iv_read_only ).
endmethod.
Recommended: To implement exception handling, implement the following methods at the level of the component controller of your custom view:
SHOW_MSG
SHOW_MSG_SY
For an implementation example, see the WD_SISE_CUSTOM_AGS
Web Dynpro component controller.
To create an outbound plug with a navigation link to the default inbound plug of the view, in the Defining the Component of Target View
field, select the view to which to navigate.
Defining the Component of Target View
Adapt the default method of the view so that the correct outbound plug is called depending on the view that is to be displayed.
Syntax
method HANDLEDEFAULT .
*SET global name OF view
wd_comp_controller->gr_step ?= r_step.
wd_comp_controller->gv_name_of_view = v_name_of_view.
CASE v_name_of_view.
WHEN 'MAIN_VIEW'.
wd_this->FIRE_TO_MAIN_VIEW_PLG( ).
WHEN OTHERS.
"Nothing
ENDCASE.
endmethod.
For the view, do the following:
To implement the inbound plug and ensure that the correct instance of the activity class is created, set the activity object as attribute.
To display an error message if an error during creation of the instance occurs, implement error handling.
Syntax
method HANDLEDEFAULT .
DATA lr_ex TYPE REF TO cx_root.
TRY.
* Set corresponding activity object as attribute
wd_this->ar_activity ?= wd_comp_controller->gr_step->get_activity( zcs_sise_act_custom_RFC=>C_CHECK_RFC ).
* Implement error handling
CATCH cx_sise_model INTO lr_ex.
wd_comp_controller->show_message( ir_exception = lr_ex ).
ENDTRY.
endmethod.
For more information about integrating the custom Web Dynpro screen component into a step of your guided procedure, see Maintaining and Activating a Guided Procedure.