Skip to Content
Technical Articles

Extending Generated (Function Module based) IDOC

As with the case for new genration of IDOC types, most of the IDOC used in SAP Cloud for Customer (C4C) integration are Function module based IDOC, also known  as generated IDOC. In this case IDOC type and ALE interfaces are generated using transaction code BDFG (ALE Interfaces from Function Module), based on a complex data type, which is wrapped in a function module. You can find more information about it on SAP help portal at this link.

Some examples of Generated IDOC offered for C4C integration are:

  • COD_REPLICATE_SALES_ORDER01
  • COD_CONTRACT_CREATEFROM_DAT01
  • COD_PRODUCT_CATEGORY_SAVE01
  • COD_STOCK_REPLICATE01 etc..

Unlike conventioal IDOC, these IDOC types can not be extended using WE30. To extend these types of IDOC, we need to extend the underlying complex data type and regenerate the IDOC using BDFG. In this blog we will look at how to extend an generated IDOC step by step.

Steps to be followed:

  1. Enhance the data type
  2. Generate the IDOC type and ALE interface using BDFG, in customer namespace
  3. Adjust the partner profiel to use the new IDOC type
  4. Implement the appropriate BADI.

For this blog I am using the IDOC for equipment replication to C4C, COD_EQUIPMENT_SAVE01.

Note: We are in process of providing the relevant BADI for all IDOC types except COD_EQUIPMENT_SAVE01. This should be available with C4C 1911 release. Implement note 2820485, to use extension for IDOC type COD_EQUIPMENT_SAVE01.

The IDOC COD_EQUIPMENT_SAVE01, is based on Function Module COD_EQUIPMENT_SAVE, which uses the compex data type COD_S_EQUI_ROOT

As a first step, extend the data type based on your requirement using Append Structure in SE11, for example for this blog I have added a custom field at the header level directly under structure COD_S_EQUI.

Once the structure has been enhanced, we need to generate the ALE interfaces using BDFG.

Provide the Function module name and system will auto populate the Business Object type and Message Type.

Now change/edit the interface (F6)

Note: Don’t create a new Message Type, else the Initial load reports will not work as they use the standard message type name to find the correct ALE function modules.

Provide a name for IDOC type and Function Module name for ALE processing in customer namespace.

System will generate the IDOC, the ALE function modules and create the necessay linkages (advantage of using BDFG, developer need not worry about writing code to map to and from IDOC structure)

Note: For some IDOC types, there can be cases where some speical logic might have been added to the generated ALE function modules. Check the original ALE function modules and copy the addtional code to the newly generated ALE function module in customer namespace. As an example, the ALE function module for Sales Order replication to C4C (ALE_COD_REPLICATE_SALES_ORDER), has some additional logic to handle BINREL.

As a next step, update the partner profile to use the new IDOC type.

Finally implement the BADI to populate the extension field in the append structure. For Equipment replication the BADI is COD_SLS_SE_EQUIPMENT_REPL, which can be found in the main function module GET_EQUI_DATA_FOR_IDOC

Now let’s run a test by changing description for an equipment.

This will trigger the IDOC based on change pointers, we can find our extension segment in the outbound IDOC.

 

Similary for proxy based objects, one can use ABAP-based Metadata Repository (MDR) for creating data type enhancements, in case there is no JAVA based ESR system is available. Refer to SAP Note 1575707 for more information. You can also refer to the informative SCN blog by Florian on, MDR: Defining web services from ABAP without requiring PI

That’s all about this blog.

Happy Learning!!!

9 Comments
You must be Logged on to comment or reply to a post.
  • Hi Abhinash,

    Thank you for the post.

    I got the blog at the right time, even I am working on the same kind of requirement.

    But I didn’t find any badi COD_SLS_SE_EQUIPMENT_REPL and in the bdfg tcode i cannot able to change the interface for the message type cod_equipment_save.

    Could you please reply back.

    • Sorry I did not understand your query. But if you are asking can ALE interfaces be changed in BDFG, then yes it can be done. Are you getting any error message?

       

      Best regards, Abinash

  • Hi Abinash,

    I cannot able to change the IDOC type for the message type ‘COD_EQUIPMENT_SAVE’ in the tcode: BDFG. have you take any access key to change the IDoc type.

    • Please check with a ABAP consultant, I don’t think you are doing it right. Unfortunately I can’t provide consulting.

      Thanks, Abinash

    • Hi Divya,

      Once u click on change, you would see a warning in bottom, just press enter and it will allow further to create your message type. In your screenshot I can already see existing custom message type.

      Regards

      Rituraj

  • Hi Abhinash,

     

    I cannot able to implement the BADI COD_SLS_SE_EQUIPMENT_REPL.

    My requirement is to pass the EQUI custom table fields to the custom segment for the idoc (COD_EQUIPMENT_SAVE01).

    Thank you,

    Divya.

     

  • Thanks for the post .

     

    I have implemeted BADI but i was not able to replicate the custom fields data to outbound IDOC .if i do manual assignment (hardcoding

    CS_EQUI_DATAGENERALZZBOOK_REGION ’01’. ) in BADI implementation then those details are getting updated in IDOC .

     

    Could you please focus some light on data source to assign the data in BADI impl.

     

     

    Regards,

    Srikanth.