14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8

Business Object Processing Framework (BOPF)

The method you do want to redefine is GET_EXTERNAL_IDS. The default behavior of

the BOPF change documents is to keep track of object changes by using the GUID.

Because this number will not mean anything to anybody, you have to add in a humanfriendly

reference number as well (in this case, the monster number) so that you

can work out what monsters have actually been changed. The code for redefining

this method to handle your monster object is shown in Listing 8.23. This method

gets called because you added structure /BOFU/CDTCEXTID to your monster object

in Transaction SCDO. Code in the standard SAP class looks to see if that structure

has been added, and if it has, then the GET_EXTERNAL_IDS method is called.

In the code in Listing 8.23, first the inco ming node is queried to make sure the

object being changed is the monster header. If so, then a loop is performed of all

header records being changed (usually on ly one), and the external ID (monster

number in this case) is extracted from the header record and exported into table

ET_EXTERNAL_IDS.

METHOD /bofu/if_cdo_creation~get_external_ids.

* Local Variables

DATA: ls_ext_id LIKE LINE OF et_external_ids,

ls_monster_node TYPE zsc_monster_header.

CASE iv_node_key.

WHEN zif_monster_c=>sc_node-monster_header.

LOOP AT it_node_data INTO ls_monster_node.

ls_ext_id-key = ls_monster_node-key.

ls_ext_id-ext_id = ls_monster_node-monster_number.

INSERT ls_ext_id INTO TABLE et_external_ids.

ENDLOOP.

WHEN OTHERS.

RETURN.

ENDCASE.

ENDMETHOD.

Listing 8.23 Redefining a Standard BOPF Change Document Method

Later, you’ll see that the redefined meth od shown in Listing 8.23 adds an extra

entry into the change document database tables to store the external ID (monster

number) and link it to the GUID of the business object.

Linking all the Change Document Components Together in the IMG

Finally, you’ll need to link up all the jigsaw pieces you’ve created relating to

change documents and put them all together in a configuration table. Go into the

348

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

Saved successfully!

Ooh no, something went wrong!