Show TOC

 Integrating OITF into Your Applications

Raising an Event in Your Application

OITF follows a singleton pattern, that is, there is only one instance of OITF per application. Your application has to request this instance from the OITF factory and store it in one of its global variables. The following code sample illustrates this.

Data declaration

* -------------------------------------------------------------------- *

* Stores OITF instance

DATA: go_ioitf TYPE REF TO cl_com_ioitf VALUE IS INITIAL.

* -------------------------------------------------------------------- *

Request OITF Instance from OITF Factory

* -------------------------------------------------------------------- *

* Get OITF instance

DATA: lo_ex TYPE REF TO cx_com_ioitf VALUE IS INITIAL.

TRY.

CALL METHOD cl_com_ioitf_factory=>get_itf_instance

RECEIVING

ro_itf = io_ioitf.

* Catch exceptions

* CX_COM_IOITF

CATCH cx_com_ioitf INTO lo_ex.

* => this is an error situation because your application could

* not get an OITF instance. Your application must do its error

* handling here!

ENDTRY.

Raising an Event and Exception Handling

* -------------------------------------------------------------------- *

* Declare exception holders

DATA:

lo_ex_ehio_create_owTYPE REF TO cx_com_ioitf_ehio_create_ow

VALUE IS INITIAL,

lo_ex_indobj_lock TYPE REF TO cx_com_ioitf_indobj_lock

VALUE IS INITIAL,

lo_ex_state_determine TYPE REF TO cx_com_ioitf_state_determine

VALUE IS INITIAL,

lo_ex_gc_evaluation TYPE REF TO cx_com_ioitf_gc_evaluation

VALUE IS INITIAL,

lo_ex_event_relevance TYPE REF TO cx_com_ioitf_event_relevance

VALUE IS INITIAL,

lo_ex_tr_determine TYPE REF TO cx_com_ioitf_tr_determine

VALUE IS INITIAL,

lo_ex_action TYPE REF TO cx_com_ioitf_action

VALUE IS INITIAL,

lo_ex_business TYPE REF TO cx_com_ioitf_business

VALUE IS INITIAL,

lo_ex_behav_profile TYPE REF TO cx_com_ioitf_behav_profile

VALUE IS INITIAL,

lo_ex_customizing TYPE REF TO cx_com_ioitf_customizing

VALUE IS INITIAL,

lo_ex_custom_business TYPE REF TO cx_com_ioitf_custom_business

VALUE IS INITIAL,

lo_ex_technical TYPE REF TO cx_com_ioitf_technical

VALUE IS INITIAL,

lo_ex TYPE REF TO cx_com_ioitf

VALUE IS INITIAL.

* -------------------------------------------------------------------- *

* Create EventDataContainers

DATA:

* Application Context

lo_appl_ctx TYPE REF TO cl_isht_refmod_edc_a VALUE IS INITIAL,

* Individual Object Context

lo_iobj_ctx TYPE REF TO cl_isht_refmod_edc_o VALUE IS INITIAL.

* Create containers to hold ApplicationContext & IndividualObjectContext

CREATE OBJECT: lo_appl_ctx, lo_iobj_ctx.

* -------------------------------------------------------------------- *

* Supply ApplicationContext

* Generic (Event Name, Individual Object GUID, Triggering Object GUID)

lo_appl_ctx->event_name = iv_event_name.

lo_appl_ctx->iobj_guid = lv_iobj_guid.

lo_appl_ctx->triggering_object_guid = lo_appl_ctx->iobj_guid.

* For EHIO

lo_appl_ctx->ehio_structure-evhist_record-objectguid =

lo_appl_ctx->iobj_guid.

lo_appl_ctx->ehio_structure-evhist_record-eventtype =

iv_event_name.

GET TIME STAMP FIELD

lo_appl_ctx->ehio_structure-evhist_record-eventtstmp.

* ISHT(Demo) specific - attributes etcetra

lo_appl_ctx->isht_bin_ver = iv_bin_ver.

lo_appl_ctx->isht_exp_date_main = iv_exp_date_main.

lo_appl_ctx->isht_level = iv_level.

lo_appl_ctx->new_entitlement = is_new_entitlement.

* -------------------------------------------------------------------- *

* Raise Event

TRY.

* Raise Event

CALL METHOD lo_ioitf->raise_event

EXPORTING

io_appl_context = lo_appl_ctx

IMPORTING

eo_iobj_context = lo_iobj_ctx.

* Catch exceptions

* CX_COM_IOITF_EHIO_CREATE_OW

CATCH cx_com_ioitf_ehio_create_owINTO lo_ex_ehio_create_ow.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_ehio_create_ow->ex_class.

ev_ex_method = lo_ex_ehio_create_ow->ex_method.

ev_exception = lo_ex_ehio_create_ow->exception.

ev_ex = 'CX_COM_IOITF_EHIO_CREATE_OW'.

WRITE: / 'CX_COM_IOITF_EHIO_CREATE_OW'.

* CX_COM_IOITF_INDOBJ_LOCK

CATCH cx_com_ioitf_indobj_lock INTO lo_ex_indobj_lock.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_indobj_lock->ex_class.

ev_ex_method = lo_ex_indobj_lock->ex_method.

ev_exception = lo_ex_indobj_lock->exception.

ev_ex = 'CX_COM_IOITF_INDOBJ_LOCK'.

WRITE: / 'CX_COM_IOITF_INDOBJ_LOCK'.

* CX_COM_IOITF_STATE_DETERMINE

CATCH cx_com_ioitf_state_determine INTO lo_ex_state_determine.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_state_determine->ex_class.

ev_ex_method = lo_ex_state_determine->ex_method.

ev_exception = lo_ex_state_determine->exception.

ev_ex = 'CX_COM_IOITF_STATE_DETERMINE'.

WRITE: / 'CX_COM_IOITF_STATE_DETERMINE'.

* CX_COM_IOITF_GC_EVALUATION

CATCH cx_com_ioitf_gc_evaluation INTO lo_ex_gc_evaluation.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_gc_evaluation->ex_class.

ev_ex_method = lo_ex_gc_evaluation->ex_method.

ev_exception = lo_ex_gc_evaluation->exception.

ev_ex = 'CX_COM_IOITF_GC_EVALUATION'.

WRITE: / 'CX_COM_IOITF_GC_EVALUATION'.

* CX_COM_IOITF_EVENT_RELEVANCE

CATCH cx_com_ioitf_event_relevance INTO lo_ex_event_relevance.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_event_relevance->ex_class.

ev_ex_method = lo_ex_event_relevance->ex_method.

ev_exception = lo_ex_event_relevance->exception.

ev_ex = 'CX_COM_IOITF_EVENT_RELEVANCE'.

WRITE: / 'CX_COM_IOITF_EVENT_RELEVANCE'.

* CX_COM_IOITF_TR_DETERMINE

CATCH cx_com_ioitf_tr_determine INTO lo_ex_tr_determine.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_tr_determine->ex_class.

ev_ex_method = lo_ex_tr_determine->ex_method.

ev_exception = lo_ex_tr_determine->exception.

ev_ex = 'CX_COM_IOITF_TR_DETERMINE'.

WRITE: / 'CX_COM_IOITF_TR_DETERMINE'.

* CX_COM_IOITF_ACTION

CATCH cx_com_ioitf_action INTO lo_ex_action.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_action->ex_class.

ev_ex_method = lo_ex_action->ex_method.

ev_exception = lo_ex_action->exception.

ev_ex = 'CX_COM_IOITF_ACTION'.

WRITE: / 'CX_COM_IOITF_ACTION'.

* CX_COM_IOITF_BUSINESS

CATCH cx_com_ioitf_business INTO lo_ex_business.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_business->ex_class.

ev_ex_method = lo_ex_business->ex_method.

ev_exception = lo_ex_business->exception.

ev_ex = 'CX_COM_IOITF_BUSINESS'.

WRITE: / 'CX_COM_IOITF_BUSINESS'.

* CX_COM_IOITF_BEHAV_PROFILE

CATCH cx_com_ioitf_behav_profile INTO lo_ex_behav_profile.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_behav_profile->ex_class.

ev_ex_method = lo_ex_behav_profile->ex_method.

ev_exception = lo_ex_behav_profile->exception.

ev_ex = 'CX_COM_IOITF_BEHAV_PROFILE'.

WRITE: / 'CX_COM_IOITF_BEHAV_PROFILE'.

* CX_COM_IOITF_CUSTOMIZING

CATCH cx_com_ioitf_customizing INTO lo_ex_customizing.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_customizing->ex_class.

ev_ex_method = lo_ex_customizing->ex_method.

ev_exception = lo_ex_customizing->exception.

ev_ex = 'CX_COM_IOITF_CUSTOMIZING'.

WRITE: / 'CX_COM_IOITF_CUSTOMIZING'.

* CX_COM_IOITF_CUSTOM_BUSINESS

CATCH cx_com_ioitf_custom_business INTO lo_ex_custom_business.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_custom_business->ex_class.

ev_ex_method = lo_ex_custom_business->ex_method.

ev_exception = lo_ex_custom_business->exception.

ev_ex = 'CX_COM_IOITF_CUSTOM_BUSINESS'.

WRITE: / 'CX_COM_IOITF_CUSTOM_BUSINESS'.

* CX_COM_IOITF_TECHNICAL

CATCH cx_com_ioitf_technical INTO lo_ex_technical.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex_technical->ex_class.

ev_ex_method = lo_ex_technical->ex_method.

ev_exception = lo_ex_technical->exception.

ev_ex = 'CX_COM_IOITF_TECHNICAL'.

WRITE: / 'CX_COM_IOITF_TECHNICAL'.

* CX_COM_IOITF

CATCH cx_com_ioitf INTO lo_ex.

cl_com_ioitf_debug=>breakpoint( ).

ev_ex_class= lo_ex->ex_class.

ev_ex_method = lo_ex->ex_method.

ev_exception = lo_ex->exception.

ev_ex = 'CX_COM_IOITF'.

WRITE: / 'CX_COM_IOITF'.

ENDTRY.

* -------------------------------------------------------------------- *

* Get required information from Individual Object Context

ev_auth_code = lo_iobj_ctx->isht_auth_code.

* -------------------------------------------------------------------- *