cancel
Showing results for 
Search instead for 
Did you mean: 

Processing Inbound IDOC's from FTP.

Former Member
0 Kudos

Hi,

I have an issue where IDOC's (WPUBON01 & DEBMAS01) are being saved in ftp folder and once these IDOC's are saved, we have to process it in SAP System, i would like to know the simple way of having these IDOC's processed in Unix based SAP system as the IDOC's will be coming in at Real time evey minutes or Seconds.

is there a way to do it with out ABAP process i mean just by using the Unix Scripts or by triggering the SAP background job.

Accepted Solutions (0)

Answers (1)

Answers (1)

markus_doehr2
Active Contributor
0 Kudos

> is there a way to do it with out ABAP process i mean just by using the Unix Scripts or by triggering the SAP background job.

You can use a simple Unix script with "startrfc" and calling EDI_DATA_INCOMING as user <sid>adm (excerpt - not the full script):

#! /bin/ksh
DEST=<SID>
SYSTEMID=<SID>
USER=<SU01-USERNAME>
PASSWORD=<PASSWORD>
CLIENT=<CLIENT>
LANG=<LANGUAGE>
MSGSERVER=<MESSAGESERVER>
SYSTEM=<SYSTEMNUMER>
GATEWAY=<GATEWAYHOST>
GWSERV=<GATEWAYSERVICE>
FUNCTION=EDI_DATA_INCOMING
PROGRAM=/usr/sap/<SID>/SYS/exe/run/startrfc
LOGONGROUP=<LOGONGROUP>

for i in `ls <directory>`
do
        $PROGRAM -balanced -3 -d $DEST -u $USER -p $PASSWORD -c $CLIENT \
            -I $LANG -s $DEST -F $FUNCTION -g $LOGONGROUP \
            -h $MSGSERVER -E PATHNAME=$i -E PORT=<WE20-PORT>
done;

You can schedule that using cron to run every minute.

You have to take care of:

- not trying to import not-yet-completely-transferred files (we use a certain naming convention such as uploading with a prefixed "tmp" and after the upload is complete renaming the file. This must be done on the FTP sender side however)

- not try to import the same file twice. You may avoid that by setting a lock (tempfile) and check for it each time the script runs. If it exists, exit the script.

Markus