Skip to Content

If you need to know, how generate one event when one claim was changed, you need to work with Callback Functions.

For this, access the transaction CRMV_EVENT.

Select the transaction category BUS200031, in the moment 80 (Save Document):

CRMV_EVENT.JPG

   FUNCTION ZCRM_CLAIM_EVENT_CHANGE.
*”———————————————————————-
*”*”Interface local:
*”  IMPORTING
*”     REFERENCE(IT_HEADER_GUID) TYPE  CRMT_OBJECT_GUID_TAB OPTIONAL
*”———————————————————————-

*ZCLAIM     E0001 ZEME  Em Edição
*ZCLAIM     E0002 ZEAP  Em Aprovação
*ZCLAIM     E0003 ZCAN  Cancelada
*ZCLAIM     E0004 ZREJ  Rejeitada
*ZCLAIM     E0005 ZAPR  Aprovada

  TABLES: TJ30T.

  DATA: GT_JEST   LIKE CRM_JEST OCCURS 100 WITH HEADER LINE.
  DATA: GV_GUID   TYPE CRMT_OBJECT_GUID.
  DATA: GV_OBJKEY TYPE SWEINSTCOUOBJKEY,
        GV_OBJTYPE TYPE SWETYPECOUOBJTYPE,
        GV_GUIDI   TYPE CRMT_OBJECT_GUID,
        GV_OPROD   TYPE CRMT_ORDERED_PROD_DB.

  CLEAR: GV_OPROD.

  READ TABLE IT_HEADER_GUID INDEX 1 INTO GV_GUID.
  CHECK SYSUBRC EQ 0.

  GV_OBJTYPE = ‘Z2000311’.
  GV_OBJKEY  = GV_GUID.

  SELECT SINGLE GUID
    FROM CRMD_ORDERADM_I
    INTO GV_GUIDI
   WHERE HEADER       = GV_GUID
     AND ORDERED_PROD NE GV_OPROD.
  IF GV_GUIDI IS INITIAL.
    SELECT SINGLE GUID
      FROM CRMD_ORDERADM_I
      INTO GV_GUIDI
     WHERE HEADER   = GV_GUID
       AND ITM_TYPE EQ ‘ZSR2’.
  ENDIF.
  IF GV_GUIDI IS NOT INITIAL.
* Se existir em tabelas é porque se trata de uma modificação
    CALL FUNCTION ‘SWE_EVENT_CREATE’
      EXPORTING
        OBJTYPE           = GV_OBJTYPE
        OBJKEY            = GV_OBJKEY
        EVENT             = ‘Changed’
      EXCEPTIONS
        OBJTYPE_NOT_FOUND = 1
        OTHERS            = 2.
  ENDIF.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Susan Keohan

    Hi Felipe,

    This is very nice – if I ever get to CRM, I will be looking back on it.

    Have you considered using SAP_WAPI_CREATE_EVENT instead of SWE_EVENT_CREATE?

    I am just curious.

    Thanks,Sue

    (0) 

Leave a Reply