We can use transaction code "BDBG" to generate the required function modules and message type, IDoc type, etc....
The following gets generated automatically without coding or creating them manually.
1. Message Type
2. IDoc Type
4. Function module for Outbound processing
5. Function module for Inbound processing
You need to select the buiness object type and method and the rest of them are generated automatically.