Using the EPO File Runtime allows importing files into a SAP system.
EPO File Runtime provides a standard procedure for importing any type of files into SAP with automated logging. File imports are done binary. All files can be stored in full in the EPO Connector logging tables.
Notice, that the table size of table /EPO1/XMLDATA will grow according to the files imported. Use programm /EPO1/EXC_REORG_LOGS for deleting outdated data records.
File import into SAP is achieved with program /EPO1/EXC_FILERUNTIME
Inhaltsverzeichnis
File Import Process Overview
1) In EPO Connector Customizing there must be an
a) EPO Service containing a logical file path and a filename with or without masking (*) and an
b) EPO Operation defining the file protocol, the processing function module, the pre- and post- exit-function modules and the logging
2) Running program /EPO1/EXC_FILERUNTIME in dialog or in background as SAP job
All matching files in the source directory are selected and processed in a loop.
a) The pre-exit function module is called: For example set foreign keys fkey1 to fkey4
b) The processing function module is called: Process the file in SAP and call a SAP function
c) The post-exit function module is called: For example move processed files into "done" and "error" folders
EPO Connector Customizing
Call the EPO Connector transaction tree with /EPO1/EXC. Then open branch "EPO Connector Configuration".
EPO Service for File Runtime
Transaction /EPO1/SERVICES12
The necessary settings are:
Service: Name of EPO Service. Must be chosen here.
Operation mandatory: Should be checked
FILE path: It is recommended using a logical file path. Set it up with transaction FILE. In the "FILE path" the following placeholders are replaced at runtime by the EPO Connector: <SYSID> with sy-sysid, <HOST> with sy-host and <CLIENT> with sy-mandt. All other variables described in transaction FILE will be replaced with SAP standard functions.
FILE name: The file name is matched by using CP (contains pattern) with the existing files in the source folder. Therefore * and + can be used for file name masking. In the "FILE name" the following placeholders are replaced at runtime by the EPO Connector: <SYSID> with sy-sysid, <HOST> with sy-host and <CLIENT> with sy-mandt. All other variables described in transaction FILE will be replaced with SAP standard functions.
Example setting
Example setting in transaction FILE
EPO Operation for File Runtime
Transaction /EPO1/EPORTIN12
The necessary settings are:
Service: Name of EPO Service
Operation: Name of operation. Must be chosen here.
NR object: Number range object for transactional logging. Default is /EPO1/NOR
NR Range Number: Number range number for transactional logging. Default for Inbound is 00. Must be set up first using transaction /EPO1/NOR or SNRO.
Protocol: 1 = FILE must be chosen.
Processing type: S = Synchronous means that the "Processing Function Module" is called when importing files. A = Asynchronous means, that files will be imported and stored in the EPO Connector tables (depending on the settings, see next parameters), but the "Processing Function Module" is not called. In this case processing must be triggered with transaction /EPO1/EPORTINPROC (=program /EPO1/IN_PROCESS_XML) separately.
EPO header: X means that general logging information like date, user, file size will be stored per imported file with a unique EPO Connector transaction id.
Message (+hd): NX means that each imported file will be stored be stored with a unique EPO Connector transaction id. Header information will be stored, too.
Meta data (+hd): Currently there is no meta data assigned with EPO Connector File Runtime interfaces.
Attachmen. (+hd): EPO Connector File Runtime interfaces cannot have attachments.
Compress: Message data (the imported files) will be stored compressed using gzip.
Do not commit work: One of the first thing the EPO Connector does is storing header and message data and calling a "COMMIT WORK". When setting this checkbox there will be no commit work from the EPO Connector.
Processing FM: The processing function module handling incoming data. The interface of any EPO Connector processing function module must fit to the definition. Therefore it is strongly recommended copying one of the provided processing fms like /EPO1/GFMC_PROCESSINGFM or /EPO1/ERX_PROCESSING_FILE_RT.
Another FM is /EPO1/PROCESSFM_IDOC_IN for creating IDocs from XML-Files.
RFC destination: The processing FM can be called using an RFC destination.
FILE no import twice: When selected there will be a check on the filename. If a file with the same name has been imported before, there will be an error message for this file and it will not be imported again. File names are stored in table /EPO1/FILES
FILE exit FM pre: The function module /EPO1/FILE_IN_USER_EXIT_PRE can be copied to a Z-function module, which can be entered here. This exit is called for each uploaded file before storing and processing. A typical usage is putting the file name into one of the foreign key fields fkey1 to fkey4.
FILE exit FM post: The function module /EPO1/FILE_IN_USER_EXIT_POST can be copied to a Z-function module, which can be entered here. This exit is called after the processing. A typical usage is moving files into archive folders like success and error using SM69 operating system functions. There is example coding in the template function module /EPO1/FILE_IN_USER_EXIT_POST.
Monitoring profile: By using monitoring profiles there can be alerts triggered in form of e-mails. Those alerts can be triggered at runtime or periodically.
Example setting
Running Report /EPO1/EXC_FILERUNTIME
Transaction /EPO1/FILERT = Report /EPO1/EXC_FILERUNTIME reads all files of the configured directory, filters it according to the configured file name. All matching files will then be imported into SAP within a loop. For each imported file the pre-exit function module is called (if configured), then the processing function module will be called next and at last the post-exti function module is called.
Selection Screen of report /EPO1/EXC_FILERUNTIME
Service: Name of configured EPO Service
Operation/soapAction: Name of configured operation
Version: Name of configured version
Message: This variable is only given as import parameter to the pre-exit function module. No other usage.
Foreign key 1 to 4: Setting foreign keys with fixed values for EPO Connector logging. Note, that those foreign keys can be overwritten in the pre-exit function module (default fkey4 will be the filename) or in the processing function module.
Production mode: File import and processing (only when S=Synchronous is configured) will be done and the EPO Connector logs are written (depending on configuration).
Test mode: File import and processing (only when S=Synchronous is configured) will be done, but the parameter I_TESTMODE of the processing function module will be set to "X". No EPO Connector logs are written! Make sure the processing function module uses the parameter I_TESTMODE!
Handling dynamic Filenames
File names will be matched using the ABAP command CP = contains pattern. The file name with masking must be configured within the EPO Connector Service.
Example 1: CLFMAS_*.xml
Example 2: CLFMAS_*
Example 3: CLF+++_*.xml
Example CLFMAS_* files displayed with transaction AL11
Processing files
File handling must be done in the so called "Processing function module".
File data is given in import parameter I_REQUESTXML in binary form (ABAP TYPE XSTRING).
File handling for XML and JSON files
The EPO Connector provides various features for easily converting such files into ABAP variables. EPO Consulting will be happy supporting you.
File handling for other files
In most cases it is recommended handling the files binary.
Moving files into archive folders
Moving files into archive folders can be programmed either in the processing function module or in the post-exit function module. In the template post-exit function module /EPO1/FILE_IN_USER_EXIT_POST there can a sample handling be seen using 2 logical file pathes, one for success and one for error cases.
For moving files there must be operation system commands set up using transaction SM69.
Monitoring EPO File Runtime
Checking and reprocessing single file imports
Like any other EPO Connector interface checking and reprocessing is possible using the transaction
Setting up alerts using EPO Connector Monitoring profiles
See general description of EPO Connector Monitoring profiles.