Header Ads

SAP CRM Most useful BADIs (Updating) .


Check out YouTube channel for great photography tutorials





ORDER_SAVE BADI is used at the time of saving order.
1st called CHECK_BEFORE_SAVE - Useful for check if the values are filled as expected, or if any obligatory field is unfilled. If you launch the exception, the document will be not saved giving an opportunity to the user to change the document again.

2nd called PREPARE - The method that is used to manipulate document data before it gets saved. It's is good to fill some fields automatically, based on user's inputs.

3rd called CHANGE_BEFORE_UPDATE - Here you cannot anymore manipulate the document. It's used to do some extra work while the document is being saved, such as for example, to launch an action by analyzing some complex validations or send notifications by email and so on...
  
   
 COM_PARTNER_BADI to check the partners.
 CRM_DATAEXCHG_BADI for data exchange from CRM to ECC and vice versa
 PARTNER_UPDATE

      CHANGE_BEFORE_UPDATE Business Partner Created or Changed
      CHANGE_BEFORE_OUTBOUND BP Was Created or Changed but Not Sent



BADI CRM_BP_UIU_DEFAULTS

The code below will allow us to default the country field as "US" each time a user creates an new account.

ASSIGN cr_me->('TYPED_CONTEXT') TO <typed_context>.
  IF sy-subrc = 0.
    lr_typed_context ?= <typed_context>.
    IF lr_typed_context IS BOUND.
      ASSIGN lr_typed_context->('STANDARDADDRESS') TO <context_node>.
      IF sy-subrc = 0.
        TRY.
            lr_node            ?= <context_node>.
          CATCH cx_sy_move_cast_error.  "EC_NOHANDLER
        ENDTRY.
        IF lr_node IS BOUND.
          lr_coll_wrapper ?= lr_node->collection_wrapper.
          IF lr_coll_wrapper IS BOUND.
            TRY.
                lr_current ?= lr_coll_wrapper->get_current( ).
                CHECK lr_current IS BOUND.
                lr_current->set_property( iv_attr_name = 'COUNTRY'
                           iv_value = 'US' ).
              CATCH cx_sy_move_cast_error.
 
            ENDTRY.
 
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.

CRM_ORDER_STATUS :

The CRM_ORDER_STATUS badi is used to control the events when the specific status is set. We can use the methods of the BADI interface

BEFORE_CHANGE which checks the validations before the status is set , if the validation fails you can stop setting the status by raising the  exception NOT_ALLOWED.

AFTER_CHANGE method is used to perform any other functions after the status is set.

To trigger the BADI you have to create an implementation with the filter by giving the status value ( which will the concatenated user status and status profile) . You can give the filter type as CRMT_STATUS_GENERAL and provide the filter values.

  IF is_status_wrk-user_stat_proc EQ 'ZAGM'
    AND is_status_wrk-check_only IS NOT INITIAL
    AND is_status_wrk-txt04 EQ 'SD82'
      OR is_status_wrk-txt04 EQ 'PF82'
      OR is_status_wrk-txt04 EQ 'BI82' )
        .
    RAISE not_allowed.
  ENDIF.

  IF is_status_wrk-user_stat_proc EQ 'ZAG_PDS'
    OR is_status_wrk-user_stat_proc EQ 'ZAG_LM'
    OR is_status_wrk-user_stat_proc EQ 'ZAG_SD'
    OR is_status_wrk-user_stat_proc EQ 'ZAG_DECO' )
    AND is_status_wrk-check_only IS NOT INITIAL
    AND is_status_wrk-txt04 EQ 'REVS' )
        .
    RAISE not_allowed.
  ENDIF.


Enhancement spots : 

CRM_MOBILE_SMARTPHONE  
CRM_MKTPL* for all the marketing related BADIs 
************


CRM_ACC_SEARCH     BAdI for Account Search
CRM_ACE_INBOUND_BADI     CRM Accruals: Change Data for Accrual Engi
CRM_ACE_POSTING_BADI     Post Accruals from CRM to FI
CRM_BSP_ACCMOD                     BSP Model Access Class
CRM_BSP_BAB                     BAdI for the Blueprint Application Builder
CRM_CCM_SND                     External Porcessing of Dispute Cases via C
CRM_CIC_ASP_BPSEARCH     IC WinClient: ASP, client indep. business
CRM_CIC_ASP_REM_INFO     IC WinClient: ASP, retrieve information in
CRM_COMPL_TPOP_CHANGE_PRICE     Pricing Enhancement
CRM_CONS_UPDATE     BAPI_SALES_CONS_PROXY_UPLOAD: Customer Exi
CRM_IC_EXT_INIT_BADI     IC WebClient Rule Driven Interaction initi
CRM_IC_F4_SYSTEM     Determination of system properties for F4-
CRM_IC_MCM_PHN_BADI     IC WebClient - MCM Phone Number Business A
CRM_QM_NOTIF                     BADI for Mapping CRM Transaction -> Qualit
CRM_SAF_DT                    SAF: Diagnosis checks
CRM_SAF_IS                    SAF: Generic information security services
CRM_SAF_KB                    SAF: BADI Definition for knowledge reposit
CRM_SAF_SE                    SAF: Generic search/index services
CRM_SDEXCHG_BADI     BAdI for Data Exchange Sales Documents CRM
CRM_SRV_ACCT_TOOL     CRM Service: Account Assignment Tools
CRM_SRV_AUTOLOG_BADI     CRM Service: BAdI for Automatic Determin.
CRM_SRV_GROUP_BADI     CRM Service: Logistics Integration - Group
CRM_SRV_MAP_PO_BADI     CRM Service: Log. Integration - Cust.-Spec
CRM_SRV_MAP_PR_BADI     CRM Service: Log. Integration - Cust.-Spec
CRM_SRV_MAP_RS_BADI     CRM Service: Log. Integration - Cust.-Spec
CRM_TIMEIMPORT_BADI     Time Management Data Import BADI


***************************************************************

Finding a BADI using Buffer trace - Transaction ST05 (Screenshots)

SAP Enhancements → Business Add-in (BADI)
 How do we find the BADI's associate for a transaction using 'Buffer Trace' (SQL Trace)?
→ Start transaction 'ST05' (Performance Analysis).
→ Set flag field "Buffer trace"
 Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)
→ Push the button "Activate Trace". Start transaction in a new GUI session.
→ Go back to the Performance trace session.
→ Push the button "Deactivate Trace".
→ Push the button "Display Trace".
→ The pop-up screen "Set Restrictions for Displaying Trace" appears.
→ Now, filter the trace on Objects:
     → V_EXT_IMP
     → V_EXT_ACT
→ Push button "Multiple selections" button behind field Objects
→ Fill: V_EXT_IMP and V_EXT_ACT
 Here goes the possible list of BADI for the respective transaction

Powered by Blogger.