Skip to Content
Author's profile photo Former Member

Outbound IDOC By Change Pointers And Customized Triggering Events

To illustrate the configuring steps required to  trigger an customized outbound IDOC whenever there is change in particular
field through standard transaction code by setting change pointers for that particular field and triggering customized events/workflow task.

1.    Introduction to Change Pointers:

     Through Change Pointer’s mechanism if any master data field value is changed in SAP like Material master, Vendor master etc. through standard t-code like MM01,MM02, VA01,VA02, the corresponding records will be created in change pointers table(BDCP,BDCPS) and simultaneously events will get triggered to generated the required outbound IDOC’S.

     In order to configure Change Pointer mechanism, we need to develop and do the settings as described in the following steps taking Vendor Master as an example.

2.     IDOC Basic Type:

      The basic element of any IDOC is Basic Type. There are standard BASIC TYPE available like CREMAS05,MATMAS05 which can be customized i.e. the structure can be extended to insert customized segments as per the requirement. We can create a new BASIC TYPE or extend the standard BASIC TYPE using the transaction WE30, WE31.

  • Create IDOC segment ZMMPU_DOCK using WE31 having custom fields as per the requirement
    Untitled.png
  • Create IDOC extension Z_CREMAS05 using WE30 for standard basic type CREMAS05

     Untitled.png

3.     IDOC Message Type:

     Create a new message type through the tcode WE81

Untitled.png

     Assign the message type created through WE81 to the desired BASIC TYPE using the transaction WE82

Untitled.png

4.     Activate Change Pointers Generally/Message Type:

     Activate the change pointers generally using t-code BD61.

Untitled.png

     Activate the change pointer  for above message type using t-code BD50

Untitled.png

5.     Assign Change Items to Message Type:

      Assign the table LFA1 and the corresponding filed as per the requirement to above created message type using t-code:BD52

Untitled.png

6.     Business Object Repository:

     

     The program that needs to be called when change pointers triggers an event is developed in BOR using t-code SWO1      

     Create one method RUNBD21 and two events CREATE and CHANGE as shown in the following figure.

                  
Untitled.png

     In the program ZCHGPOINT.RUNBD21, call an method of class in which function module will be called to process and outbound IDOC passing the parameter ‘MESSAGE TYPE’

Untitled.png

                    In ZCL_BD21=>ZCL_BD21_TEST put the below logic

                       select single idocfbname
                             from tbdme into lv_idocfbname

          where mestyp = ‘MESSAGE_TYPE’ created above

    call function lv_idocfbname
         exporting
              message_type = ‘MESSAGE_TYPE’ created above
         exceptions
              error_code_1.

7.     Link Change Document object and BOR:

     The BOR created in above step will be required to be linked Vendor change document  object KRED using SWEC

Untitled.png
      Similarly make an entry for CHANGE event of BOR ZCHGPOINT

8.     Workflow Task:

     Create an customized task in order to link it to BOR above created. Standard Task is created using t-code PFTC

Untitled.png
     In the trigeering events table mention the CREATE and CHANGE event of BOR ZCHGPOINTUntitled.png

 

9.     Create Function Module

     The processing logic required to generate outbound IDOC needs to be implemented in this FM.

Untitled.png
  In FM the following logic needs to be implemented

     a.     Fetch  change pointers record from table BDCP for the corresponding message type using the FM CHANGE_POINTERS_READ with parameters as

    • MESSAGE_TYPE = Import parameter MESSAGE_TYPE
    • CREATION_DATE_HIGH = Import parameter
      CREATION_DATE_HIGH
    • CREATION_TIME_HIGH = Import parameter
      CREATION_TIME_HIGH
    • READ_NOT_PROCESSED_POINTERS = ‘X’

     b.     For all the records fetched in step a ) check if BDCP-tabname = ‘LFA1’   THEN collect vendor number LIFNR = BDCP-tabkey+3(10)

     c.     Thus in above step we can get vendor number for which any field is being changed through XK01/XK02 and the correspoing change pointer is triggered.

     d.     Now populate segment ZCREMAS_05 as per the requirement and post the IDOC using MASTER_IDOC_DISTRIBUTE or STANDARD master idoc BAPI

     e,     Call the FM CHANGE_POINTERS_STATUS_WRITE to update all processed change pointer id

10.     Configure Message type with Function Module:

     The message type created ZMMVE_CREMAS01 needs to be linked with FM created ZFM_TRIGGER_IDOC

Untitled.png

Conclusion

By completing the above configuration steps we will able to trigger outbound IDOC whenever there is change in particular field value through standard transaction.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Maheshwari, Nice document to read... Could yuo please giveme the transaction code to Configure Message type with Function Module. Regards, Sasi

      Author's profile photo Former Member
      Former Member

      Got the transaction to Configure Message type with Function Module.. It's using BD60.

      Author's profile photo Priyesh Shah
      Priyesh Shah

      Hi jeet maheshwari, you have created a Object Type on which previous object Type is it modelled.?

      Author's profile photo Priyesh Shah
      Priyesh Shah

      All Queries Solved .... no issues left.

      Author's profile photo Glen Michael Cruz
      Glen Michael Cruz

      Hi Priyesh,

       

      Can you still remember how you go about the creation of BOR?

      Author's profile photo Gowrinath Gundu
      Gowrinath Gundu

      Hi Maheshwari,

      Thanks for sharing the document. Is it possible to pass object key to Task.

      Please clarify.

      Thanks,

      Gowrinath.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Yes Gownianth, Its  possible to pass the key in BOR to task.