When configuration outbound iDocs and if you are creating iDoc files though a file port. You should specify the file name format for these outbound files. You may have different outbound iDocs and you should be able to differentiate each type by the file name.
For example Invoice iDocs can be prefixed as “810” and ASNs should be named as “856”. Lets assume you need your file to be named as 810_<iDoc Number>_<Date>_<Time>.
You should create a Z function module for this as no standard function module is configured in such a way that it would create the file name as above.
You can find the standard file name creation function modules using se37 and search with key words *EDI*PATH* or from EDI3 function group.
Create the Z function module to assign the file name.
Note that you can only import the iDoc control data records to create the file name. To create the function module you can copy a standard FM and change accordingly.
Function module coding
You can assign upto 3 parameters to the file name. In this example I have assigned the prefix (810 and 856) to the first parameter, iDoc number to the 2nd and date time stamp to the third. These variables will be separated by “_”.
Assign the function module to the file name generation configuration.
Assign the created function module to outbound port which is assigned to iDoc configuration in we21.