Conversion of Notifications to Time Ticket Logs

Scenario

You use the test program RPCO_BS_INT_TEST to create subscriptions for the value change of tags. If the values of these tags change, PCo generates a notification and sends it to the Business Suite systems that were assigned as PCo destination systems in the notification template used. The system uses the notification content (header data, error messages, expressions) to generate application log entries. The test program can be used to display these application logs.

Conversion

You need a new class for processing notifications. This new class inherits from the class CL_PCO_NOTIF_HANDLER and redefines the instance method EXECUTE. Additionally, the BAdI BADI_S_PCO_HANDLE_NOTIF must be implemented for the filter value APPLICATION = SAPTESTING.

Implementation of a Class for Processing Notifications (Class CL_PCO_SAPTESTING_NOTIF)

Program Blocks

  • Setting the severity level to error when error messages are part of the notification

  • Generating an application log entry that contains the name and description of the notification

  • Evaluating the transferred expressions and generating the relevant application log entries

    Converting the expressions to instances of the exception class CX_PCO_BS_INT since these can be converted to application logs easily

  • Adding error messages to the application log

  • Saving the application log and updating the changes

ABAP Code for the Method EXECUTE (Class CL_PCO_SAPTESTING_NOTIF)

  1. Define the method parameters:

    Parameter

    Type

    Data Type

    Optional

    Description

    IT_ERROR_MSG

    Import

    Type PCO_T_QUERY_MESSAGE_OBJ

    x

    Error messages for the notification (object instance)

    IT_EXPR_DATA

    Import

    Type PCO_T_EXPR_DATA

    x

    PCo expression data

    IS_APPL_HANDLE

    Import

    Type PCO_S_APPL_HANDLE

    x

    PCo: Data structure for application handle

    IS_NOTIF_HEADER

    Import

    Type PCO_S_NOTIF_HEADER

    x

    PCo: Header data notification

    IV_TEST_MODE

    Import

    Type BOOLE_D

    x

    'X': Test mode

  2. Assign the exception class CX_PCO_BS_INT (PCo Suite Integration: Exception class).

  3. Copy the ABAP code provided in the document (page 26 to 27) attached to SAP Note 1576651 Information published on SAP site to the method EXECUTE.

Implementation of Class CL_PCO_IM_SAPTESTING_NOTIF for the BAdI Implementation

Program Blocks

This class enables the return of the name of the class that processes the notifications (CL_PCO_SAPTESTING_NOTIF) if the application name of the application handle has the value SAPTESTING.

ABAP Code for Method IF_EX_S_PCO_HANDLE_NOTIF~GET_CLASS_NAME

  1. Create the following parameters for the method:

    Parameter

    Type

    Data Type

    Optional

    Description

    IS_APPL_HANDLE

    Import

    Type PCO_S_APPL_HANDLE

    No

    PCo: Data structure for application handle

    EV_CLASS_NAME

    Export

    Type SEOCLSNAME

    No

    Name of the class that processes the notification(s)

  2. Assign the exception class CX_PCO_BS_INT (PCo Suite Integration: Exception class).

  3. Copy the following ABAP code to the method:

    METHOD if_ex_s_pco_handle_notif~get_class_name.
    * Processing of notifications is executed with the help of classes that
    * inherit super class CL_PCO_NOTIF_HANDLER.
    * Based on entered application handle information this BAdI
    * implementation returns the name of handler class
    
      CONSTANTS:
        lc_appl_name_saptesting  TYPE pco_s_appl_handle-appl
          VALUE 'SAPTESTING',
        lc_class_name_saptesting TYPE seoclsname
          VALUE 'CL_PCO_SAPTESTING_NOTIF'.
    
      CLEAR: ev_class_name.
    
      IF is_appl_handle-appl = lc_appl_name_saptesting.
        ev_class_name = lc_class_name_saptesting.
      ENDIF.
    
    ENDMETHOD.