Skip to Content
Technical Articles
Author's profile photo Abinash Nanda

Extending Generated (Function Module based) IDOC

As with the case for new generation 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.

Note : Unless there is a need to pass multiple customer specific fields or the standard IDOC structure has no extra fields, it is advisable to find some unused fields from the IDOC structure to pass the information needed. This way the IDOC regeneration and adjusting ALE function modules, if required, can be avoided.

Some examples of Generated IDOC offered for C4C integration are:


Unlike conventional 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 profile 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 complex 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 necessary 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 special logic might have been added to the generated ALE function modules. Check the original ALE function modules and copy the additional 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.


Similarly 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!!!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Divya Vemulapati
      Divya Vemulapati

      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.

      Author's profile photo Abinash Nanda
      Abinash Nanda
      Blog Post Author

      Hi Divya, please implement note 2820485, with which the BADI was made available.


      Best regards, Abinash

      Author's profile photo Rajashri Mankar
      Rajashri Mankar

      Hi Abhinash, Thank you for the post. Can u please tell how can we modify generated custom segment type?

      Author's profile photo Divya Vemulapati
      Divya Vemulapati

      Thank you!!!

      Can you able to change the basic IDoc type in Tcode: BDFG  for the message type: cod_equipment_save.


      Author's profile photo Abinash Nanda
      Abinash Nanda
      Blog Post Author

      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

      Author's profile photo Divya Vemulapati
      Divya Vemulapati

      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.

      Author's profile photo Abinash Nanda
      Abinash Nanda
      Blog Post Author

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

      Thanks, Abinash

      Author's profile photo Kumar Rituraj
      Kumar Rituraj

      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.



      Author's profile photo Divya Vemulapati
      Divya Vemulapati

      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,



      Author's profile photo SRIKANTH PALLEPATI

      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.





      Author's profile photo SRIKANTH PALLEPATI

      Resolved .

      Author's profile photo Dennis Vöpel
      Dennis Vöpel

      Hi Abhinash,

      is it also possible to add a custom field at the item level?

      I've already posted a question about this topic in the SAP Community Forum.