Skip to Content
avatar image
Former Member

order_save badi, how to know the caller (ECC or CRM system)

Hi,

In Order_save badi we have few lines of code that needs to be executed only when the order is created or changed in CRM system. If the order is changed or if we get delta changes from ECC system, i want to bypass the code in order_save badi.

Any idea how to retrieve the system (ECC or CRM) calling in order_save badi.

Thank you

Anji

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 05, 2017 at 11:11 PM

    Hi Anji,

    • Once the customizing settings, e.g. scenario A, is ready in system, create or change of orders in ECC is replicated to CRM. The data from ECC is sent to CRM and bdoc is created. BDoc data is exported to CRM_ORDER_MAINTAIN and finally to CRM_ORDER_SAVE. This is standard behavior which means CRM_ORDER_SAVE is always called to save in CRM system the create or change data of orders from ECC system.

    here is the call stack

    25 FUNCTION CRM_ORDER_SAVE SAPLCRM_ORDER_API

    24 FUNCTION CRM_DOWNLOAD_BTMBDOC SAPLCRM_DOWNLOAD_BTMBDOC

    23 FUNCTION CRM_DOWNLOAD_BTMBDOC_VAL SAPLCRM_DOWNLOAD_BTMBDOC

    • Once CRM_ORDER_SAVE is called, all the active order_save badi s are called.

    When crm_order_save is called, there is no way to get to know this is a replication from ECC or creation in CRM, in another word who calls crm_order_save.

    ,

    ,

    Here are some ideas regarding "Any idea how to retrieve the system (ECC or CRM) calling in order_save badi."

    ,

    1, original system (LOGICAL_SYSTEM) in orderadm_h

    Currently, CRM supports 2 scenarios only, standard and A.

    If you are using scenario A, the original system will always be crm. this field in this case will not provide any help.

    If you are using standard scenario, you may refer to note 541113. If the order is created in ECC, crm cannot change it and origianl system is ecc. If order is created in CRM, anyone change it in ecc, there will be an information that the original system or the order will be changed to ecc and then crm will not be able to change it according to note 541113. So once your order_save badi is called, you may check orderadm_h-LOGICAL_SYSTEM.

    ,

    2, if you simply want to get erp destination in your crm order_save badi,

    you may call FM crm_get_erp_system without any importing data.

    or you may call FM SMOF_READ_SMOFERPSH like below.

    call function 'SMOF_READ_SMOFERPSH'
    exporting
    i_sitetypeid = 'SMOF_ERPSITE'
    tables
    t_erpsites = gt_smof_erpsh.

    Spencer

    Add comment
    10|10000 characters needed characters exceeded