This website is not affiliated with, sponsored by, or approved by SAP AG.

Operation before or after CRM_ORDER_SAVE

CRM related discussion only

Moderators: Snowy, thx4allthefish, Lost Identity

Operation before or after CRM_ORDER_SAVE

Postby nepriceputu » Mon Oct 08, 2012 11:47 am

Hi fans,

In very new to CRM even tho it's up for some time, but I have some background of ABAP.
The requirement that I'm stuck on is: "At save, send a request to another external software create some additional documents".
So i figured I start with the function CRM_ORDER_SAVE, but I couldn't find any exits or badi's that I could modify to add my code, so I've modified the function itself for the time being (I will revert the function back to it's original state after I find a more elegant solution with your help).
Even so, I have a problem gathering the necessary data to send to the external program.
I read and read stuff about the buffer (memory) side of things, and the DB side of things.
So I know about functions like CRM_ORDER_READ, CRM_ORDER_READ_OW, and variations :P
My problem is ... these don't work ... at all.
I require data from the ACTIVITY_H (crmd_activity_h) custom added fields and from the SERVICE_OS table (crmd_srv_subject). If some of these fields are available in the DB even before save, the others are not (ie. SERVICE_OS), so I tried reading the buffer with no luck.

Here is a sample of my code:
Code: Select all
  DATA: ls TYPE LINE OF  crmt_object_guid_tab,
        lt TYPE crmt_object_guid_tab,
        lt_req TYPE crmt_object_name_tab,
        activity_h    TYPE  crmt_object_name  VALUE 'ACTIVITY_H',
        activity_i    TYPE  crmt_object_name  VALUE 'ACTIVITY_I',
        orderadm_h    TYPE  crmt_object_name  VALUE 'ORDERADM_H',
        orderam_i     TYPE  crmt_object_name  VALUE 'ORDERADM_I',
        service_os    TYPE  crmt_object_name  VALUE 'SERVICE_OS'.

  MOVE '5EF3FCC339EB1ED284AAC96D9CF17238' TO ls.
  APPEND ls TO lt.

  APPEND activity_h TO lt_req.
  APPEND activity_i TO lt_req.
  APPEND orderadm_h TO lt_req.
  APPEND orderam_i  TO lt_req.
  APPEND service_os TO lt_req.

  CALL FUNCTION 'CRM_ORDER_READ'
   EXPORTING
     it_header_guid                    = lt
     it_requested_objects              = lt_req

      CALL FUNCTION 'CRM_ORDER_READ_OW'
         EXPORTING
           it_header_guid                    = lt
           it_requested_objects              = lt_req
         IMPORTING
           et_service_os                     = lt_service_os
          CHANGING
            cv_log_handle                     = lv_log_handle
         EXCEPTIONS
           DOCUMENT_NOT_FOUND                = 1
           ERROR_OCCURRED                    = 2
           DOCUMENT_LOCKED                   = 3
           NO_CHANGE_AUTHORITY               = 4
           NO_DISPLAY_AUTHORITY              = 5
           NO_CHANGE_ALLOWED                 = 6
           OTHERS                            = 7
                  .
        CALL FUNCTION 'CRM_LINK_GET_OW'
          EXPORTING
            iv_guid_hi                      = ls_records_to_insert-guid
            iv_objname_hi                   = 'ORDERADM_H'
            iv_objname_set                  = 'SERVICE_OS'
            iv_inherit_from_str             = false
         IMPORTING
            et_link                          = lt_link
         EXCEPTIONS
            invalid_input_data             = 1
            no_allocated_obj_found         = 2
            undefined_internal_error       = 3
            others                         = 4
                  .


One of the problems might be the place (as in the data is not available right before save, or something) or the FM call is wrong.

Can you guys shade some light into this?

Thank you
nepriceputu
 
Posts: 2
Joined: Fri May 06, 2011 5:34 am

Return to CRM :: SAP CRM

Who is online

Users browsing this forum: No registered users and 4 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.