Show TOC

 Remapping Generic Messages

In some cases, users may need to remap messages. For example, a caller may on the one hand use the Currency Key field (CURKY), but a called method, on the other hand, may instead use the field “CURRENCY_KEY” .

Note Note

The information presented in this topic exceeds the general knowledge that is required to create (or migrate) infotypes in(to) this release. Individuals who have particular expertise in this subject matter or who desire deeper knowledge of this issue may nonetheless consult this topic for reference.

End of the note.

In situations like these, it may be necessary to ignore all fields and enforce a specific field list, and therefore substitute a technical message with an error message that is more informative and user-friendly. The following procedure summarizes the actions to be taken when generic message remapping is required.

  1. In order to remap certain fields, you must first create a local remapping class, by means of which the corresponding source code is inserted into your local type declarations.

    To remap messages that pertain to currency keys, insert the following source code, which presupposes that you have defined lcl_msg_curky_remap as a local remapping class.

    CLASS lcl_msg_curky_remap DEFINITION FINALINHERITING FROM cl_hrpa_message_generic_remap.PROTECTED SECTION.METHODS remap REDEFINITION.ENDCLASS.

  2. Once the local remapping class is defined, you must actually implement the corresponding source code in all local instances of your class, as demonstrated below.

    To continue with the previous example, implement the source code as follows. CLASS lcl_ msg_curky_remap IMPLEMENTATION. METHOD remap.CLASS lcl_msg_curky_remap DEFINITION FINALINHERITING FROM cl_hrpa_message_generic_remap.PROTECTED SECTION.METHODS remap REDEFINITION.ENDCLASS.ENDMETHOD.ENDCLASS.

  3. Finally, once your implementation is in place, you may invoke it with the following command.

    To continue with the previous example, implement the source code as follows.

    DATA remapper TYPE REF TO if_hrpa_message_handler.CREATE OBJECT remapper TYPE lcl_msg_curky_remap EXPORTING message_handler = message_handler.