Customizing SD and MM Output Control to Create IDocs 
For Sales and Distribution (Export IDocs)
Customizing sales and distribution (SD) to create IDocs requires the following:
Maintaining these two areas involves defining the output type AES1, assigning the medium 6 (EDI) to AES1, and assigning the program RSNASTED to the procedure to trigger IDoc creation.
Maintaining Output Determination for Billing Documents
Assigning Layout-sets and Programs

Under Customizing for Maintain output determination for billing documents, select Maintain output types, and then select AES1 and choose Goto ® Details. In the Access Sequence field (on the General Data tab), enter
Select Maintain Access Sequences, add the access sequence 0004 for Sales Organization/Customer.
Select Assign Output Types to Partner Functions, and then assign the partner function SH (for ship-to party) to output type AES1.
Select Maintain Output Determination Procedure, and add the procedure V10000 for controlling billing output.
Select Assign Output Determination Procedures, and assign the procedure V10000 and the output type RD00 to billing document type F8. F8 is the pro forma invoice based on the delivery document.
Then choose Sales and Distribution ® Foreign Trade/Customs ® Printing/Communication ® Assign Forms for Export Billing Documents. To output type AES1, Application V3, assign both the program RNASTED for triggering IDoc creation and the FORM routine EDI_PROCESSING.
For Materials Management (Import IDocs)
Customizing materials management (MM) to create IDocs requires the following:
Defining Access Sequences for Purchase Orders
Defining Message Types for Purchase Orders