Start of Content Area

Procedure documentation Controlled Terminations in Exception Situations  Locate the document in its SAP Library structure

Use

In the subroutines of the form class library exception situations may occur (for example, unexpected data inconsistencies), where the printing of a form must be subject to a controlled termination. Controlled means that before leaving the print module, the open form process is closed so that the next document can be printed in the mass run.

Prerequisites

To terminate the print transaction, use only one of the two macros. All other message activities could disrupt the global print process.

Procedure

If you want to terminate the print transaction of an (application) form, call one of the following macros:

·        MAC_PRINT_CANCEL
In MAC_PRINT_CANCEL the error parameters are transferred in the macro parameters 1 to 7:

¡        &1 – Message type (for example, E )

¡        &2 – Message number (for example, 100)

¡        &3 – Message class (for example, EZ)

¡        &4 to &7 – Message parameters 1 to 4

·        MAC_PRINT_CANCEL_REPEAT
If a module called has triggered an exception in a subroutine with the macro MAC_MSG_PUTX, you can forward the corresponding message with the macro MAC_PRINT_CANCEL_REPEAT.
The only parameter you have to specify here is the message type.

This graphic is explained in the accompanying textTerminations within GET or FILL subroutines end with the printing of the current form, but do not delete the texts printed in the form up to this point in the spool. Therefore, checks, such as for data consistency, should always be completed before a text is issued.

Example

CALL FUNCTION ..’ABCDE’

   EXPORTING

     

   IMPORTING

     

   EXCEPTIONS

      NOT_FOUND   =  1

      OTHERS           =  2.

IF SY-SUBRC NE 0.

  MAC_MSG_PRINT_CANCEL

         ‘E’ SY-MSGNO SY-MSGID SY-MSGID SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

 

End of Content Area