14.01.2020 Views

ABAP_to_the_Future

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8

Business Object Processing Framework (BOPF)

EXPORTING iv_node = zif_monster_c=>sc_node-monster_header

it_key = it_key

IMPORTING et_data = lt_monster_header ).

READ TABLE lt_monster_header INTO ls_monster_header INDEX 1.

CHECK sy-subrc EQ 0.

* Use the model to actually perform the logic check

lo_monster_model =

zcl_monster_model=>get_instance( ls_monster_header-monster_number ).

TRY.

lo_monster_model->validate_howl_action( ls_monster_header ).

CATCH zcx_monster_exceptions INTO lo_monster_exception.

DATA: ls_key LIKE LINE OF it_key.

READ TABLE it_key INTO ls_key INDEX 1. "Only one line

"This key (node) has failed at the job of being consistent

INSERT ls_key INTO TABLE et_failed_key.

"Create the bottle for our message

eo_message = /bobf/cl_frw_factory=>get_message( ).

* Now we send the error message in the format BOPF

* desires

DATA: ls_location TYPE /bobf/s_frw_location,

lo_message TYPE REF TO /bobf/cm_frw_core.

ENDTRY.

ls_location-node_key = is_ctx-node_key.

ls_location-key = ls_key-key. "I heard you the first time

CREATE OBJECT lo_message

EXPORTING

textid = lo_monster_exception->if_t100_message~t100key

severity = /bobf/cm_frw=>co_severity_error

symptom = /bobf/if_frw_message_symptoms=>co_bo_inconsistency

lifetime = /bobf/if_frw_c=>sc_lifetime_set_by_bopf

ms_origin_location = ls_location.

"Put the message in the bottle

eo_message->add_cm( lo_message ).

ENDMETHOD. "Execute Howling Status Action Validation

Listing 8.18 Coding an Action Validation

334

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!