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)

lo_monster_model->howl_at_the_moon( ls_howl_request ).

* Error Handling Time

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 an error message in the format the BOPF Framework

* 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 Action

Listing 8.16 Executing an Action

When you test this in Transaction /BOBF/TEST_UI, the result is truly beautiful.

Call up a list of all your mo nsters, select one, click Execute Action, and you’ll

magically get a pop-up asking you to fill in the import parameter for the action

(Figure 8.23). Once you’ve done that, the howling commences (Figure 8.24).

As you can imagine, being able to te st a user command before you have even

started writing the main application and are still really at the data modeling stage

is a wonderful step forward. The earlier you can do testing, the better.

330

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

Saved successfully!

Ooh no, something went wrong!