An action is an (atomic) operation that is performed in response to an event. OITF enables you to define actions that can be performed as part of event handling by OITF. An action is not mandatory as the OITF allows you to either change the state of an object or perform an action.
An action is represented by an ABAP class that implements the action interface
IF_COM_IOITF_AC
as specified by the OITF.
You define and register actions in Customizing by choosing
. To define an action, you name your action, for example, MY_ACTION. Using transaction
SE24
you create a
Usual ABAP Class
with the name
CL_MY_ACTION
. You specify
IF_COM_IOITF_AC
on the
Interfaces
tab, and choose the method
IF_COM_IOITF_AC~EXECUTE
on the
Methods
tab. At this point you can enter the necessary code. using the following template:
METHOD if_com_ioitf_ac~execute.
* Before you can access the Application Context you must convert it
* into the format that you specified for the corresponding Event.
DATA: lo_my_appl_ctx TYPE REF TO cl_my_appl_ctx VALUE IS INITIAL.
lo_my_appl_ctx ?= io_appl_context.
* If your event expects something in return then create the
* Object Context that you specified for the corresponding
* Event.
* DATA: lo_my_iobj_ctx TYPE REF TO cl_my_iobj_ctx VALUE IS INITIAL.
* CREATE OBJECT lo_my_iobj_ctx.
* --> Begin: Put your code
* You can access the information in Application Context or
* Object Context as follows -
* lv_iobj_guid = lo_my_appl_ctx->iobj_guid.
* lo_my_iobj_ctx->rc = lv_rc.
* ...and so on!
* --> End: Put your code
* Return Object context
* co_iobj_context ?= lo_my_iobj_context.
ENDMETHOD.
For example, action ISHT_AC_SET_MAINT of High Tech’s Software Entitlement Demo application has been implemented as follows:
*&---------------------------------------------------------------------*
*& METHOD if_com_ioitf_ac~execute *
*& *
*& This method is executed when additional maintenance is purchased *
*& for the Perpetual Entitlement. *
*& *
*& The attributes set by this Action are - *
*& 1. ISHT_LEVEL - Support Level *
*& 2. ISHT_EXP_DATE_MAIN - Maintenance Expiration Date *
*& 3. ISHT_MAINT_EXPIRED - Maintenance Expired Flag *
*&---------------------------------------------------------------------*
METHOD if_com_ioitf_ac~execute.
* -------------------------------------------------------------------- *
* Cast ApplicationContext container into your ApplicationContext
* container.
DATA: lo_appl_ctx TYPE REF TO cl_isht_refmod_edc_a VALUE IS INITIAL.
CALL METHOD cl_com_ioitf_casting_manager=>cast
EXPORTING
io = io_appl_context
CHANGING
co = lo_appl_ctx.
* -------------------------------------------------------------------- *
* Reset Maintenance Expired flag
DATA: lv_maint_expired TYPE isht_maint_expired VALUE IS INITIAL.
* -------------------------------------------------------------------- *
* Supply Support Level, Maintenance Expiration Date and Maintenance
* Expiration Flag.
*TRY.
CALL METHOD me->exe
EXPORTING
io_appl_context= io_appl_context
iv_level = lo_appl_ctx->isht_level
iv_exp_date_main = lo_appl_ctx->isht_exp_date_main
iv_maint_expired = lv_maint_expired.
* CATCH CX_COM_IOITF_ACTION .
*ENDTRY.
* -------------------------------------------------------------------- *
ENDMETHOD.
Below is the list of actions registered for the High Tech Software Entitlement Demo application.
Action |
Description |
Action Class |
---|---|---|
ISHT_AC_EXP_MAINT |
ISHT: Obj RefModel - Expire Maintenance |
CL_ISHT_AC04 |
ISHT_AC_RVK_ENTIT |
ISHT: Obj RefModel - Revoke Entitlement |
CL_ISHT_AC06 |
ISHT_AC_SET_MAINT |
ISHT: Obj RefModel - Set Maintenance |
CL_ISHT_AC01 |
ISHT_AC_SET_REG |
ISHT: Obj RefModel - Set Registration |
CL_ISHT_AC02 |
ISHT_AC_UPD_BIN_VER |
ISHT: Obj RefModel - Update Binary Version |
CL_ISHT_AC03 |
ISHT_AC_UPG_PROD |
ISHT: Obj RefModel - Upgrade Product |
CL_ISHT_AC05 |