CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Now a days it is a quite common scenario to enhance the sales order with the additional custom fields which will have to flow from CRM to ECC and vice versa. There are different ways to achieve this scenario like applying the Business Transaction Events or intermediate FM calls etc.. But comparatively this will be the better approach. In this blog I am going to explain the scenario of the additional filed (AET/EEWB) flow from CRM to ECC. In next blog will publish the data flow from ECC to CRM.

   Before the implementation better to check the all relevant settings of middle ware like sales document adapter object filter, SMOF tables and Administration Console.

  • Structures need to enhance by adding the additional field in the CRM

Sales Order Container

Structure of the table

Header

BAPE_VBAK

Item

BAPE_VBAP

Line Item

BAPE_VBEP

Finding the relevant structure:
  Please check the CRMD_ORDERADM_H and CRMD_ORDERADM_I to find the structure, you will find the DUMMY attribute, you will get this structure in the appending structure description. 

  • Structures need to enhance by adding the additional field in the ECC 

Sales Order Container

Structure of the table

Update Structure of the table

Header

VBAKOZ

VBAKOZX

Item

VBAPOZ

VBAPOZX

Line Item

VBEPOZ

VBEPOZX


           
Finding the relevant structure:

               Please check the VBAK,VBAP and VBEP to find the structure, you will find the DUMMY attribute, you will get this structure in the appending structure description.

          Note : All the OZX structure has to be appended with Update flag with char 1.


  • Now in CRM Side need to be implement CRM_DATAEXCHG_BADI enhancement.
               

 METHOD if_ex_crm_dataexchg_badi~crm_dataexch_after_bapi_fill.
 
                    <lfs_bapishd1x> TYPE bapisdhd1x.
    DATA : lwa_orderadm_h LIKE LINE OF it_bus_trans_msg-orderadm_h,
         lwa_bapirex    TYPE bapiparex,
         w_data(240)    TYPE c.
    

    LOOP AT it_bus_trans_msg-orderadm_h INTO lwa_orderadm_h.
        CLEAR lwa_bapirex.

     lwa_bapirex-structure = 'BAPE_VBAK'.
     lwa_bapirex-valuepart1+0(10) = lwa_orderadm_h-object_id.
     lwa_bapirex-valuepart1+10( field length) = lwa_orderadm_h-XXXXXXXXXXXX.


     APPEND lwa_bapirex TO ct_bapiparex.
     CLEAR lwa_bapirex.

     lwa_bapirex-structure = lc_bape_vbakx.
     lwa_bapirex-valuepart1+0(10) = lwa_orderadm_h-object_id.
     lwa_bapirex-valuepart1+10(1) = 'X'.

     APPEND lwa_bapirex TO ct_bapiparex.
     CLEAR lwa_bapirex.
      
    ENDLOOP.
  ENDMETHOD.

          Checking  the data :

                      Go to SMW01 and find the related sales order queue with name. Please check the data in extended structure, there e you will find the data in the segment.


  • Now the BAPIPAREX structure to be send to ECC sales documents to the internal ECC BAPI. So this will be possible by enhancing the BADI_SD_SALESDOCU_BAPI. This enhancement triggers any time while sales order data coming from any other systems like CRM, BI/BW and any third party system. So here we can maintain 2 ways to restrict the application from the required.
                       
        1. Check function module CRM0_READ_RFC_DEST. Pass the value 'CRM' to the importing parameter I_CONSUMER.
        2. Check the VBKLA(3) which is equals to the CRM, where sometimes it will be over crossed  by the scenarios which are also mmaintain in the ECC also. So better to avoid this.

Method : IF_BADI_SD_SALESDOCU_BAPI~MOVE_EXTENSIONIN

IF cs_vbakkom-vbkla(3) = 'CRM'. // better to use by sy-uname from the CRM0_READ_RFC_DEST
  DATA : lwa_bapirex    TYPE bapiparex.
      CLEAR : lwa_bapirex.
     
READ TABLE it_extensionin INTO lwa_bapirex WITH KEY structure = ‘BAPE_VBAK'.
        IF NOT lwa_bapirex IS INITIAL.
     cs_vbakkom-XXXXXXXXX = lwa_bapirex-valuepart1+10(field length).
     ENDIF.
     CLEAR : lwa_bapirex.
    READ TABLE it_extensionin INTO lwa_bapirex WITH KEY structure = ‘BAPE_VBAKX'.
     IF NOT lwa_bapirex IS INITIAL.
     cs_vbakkomx-XXXXXXXXX = lwa_bapirex-valuepart1+10(1).
     ENDIF.
ENDIF.


  • Now this communication structure to be added to the ECC side by using sales order MV45AFZZ include.
      Here we need to check the correct location of the include like move VBAK,MOVE VBAP, MOVE VBEP or SAVE user exits inside of the include. so that we can get better performance.Else it would be bit better if we find any other BAdI or User exit for the same.

        IF us_vbakkom-vbkla(3) = 'CRM'. // // better to use by sy-uname from the CRM0_READ_RFC_DEST
              IF NOT us_vbakkom IS INITIAL.
             vbak-XXXXXXXXX= us_vbakkom-XXXXXXX.
              ENDIF.
        ENDIF.