cancel
Showing results for 
Search instead for 
Did you mean: 

Script to fetch in a folder and call FM EDI_DATA_INCOMMING

Former Member
0 Kudos

Hi All,

I am trying a inbound file to idoc scenario to post an idoc. The idoc files are presently placed in a folder in application server.

When the script is run the idoc file should get picked from the folder in Application server and pass it to the FM EDI_DATA_INCOMMING. I am using the below script.

startrfc -3 -d Q11 -u USER_ID -p P1234 -c CLN -l EN -h HOST_NAME -s 10 -F EDI_DATA_INCOMING -E PORT=EXT u2013E

PATHNAME=E:\usr\sap\File

This gives error .

Can you plz let me know if the script is correct and why I get the error . I have specified all parameters in the script.

Also if Instead of a folder in Application Server , I need to pick the file from an external FTP Folder, what would be the script?

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

markus_doehr2
Active Contributor
0 Kudos

> startrfc -3 -d Q11 -u USER_ID -p P1234 -c CLN -l EN -h HOST_NAME -s 10 -F EDI_DATA_INCOMING -E PORT=EXT u2013E

> PATHNAME=E:\usr\sap\File

>

> This gives error .

...and which error? What's in the resulting dev_rfc.trc?

> Can you plz let me know if the script is correct and why I get the error . I have specified all parameters in the script.

> Also if Instead of a folder in Application Server , I need to pick the file from an external FTP Folder, what would be the script?

We do the same thing using a script for our external logistics. I wrote a script like (excerpt):


      ncftpget -u $USER -p $PASSWORD -a -DD -e $ERRLOG -d $DEBUGLOG \
                $IP $LOCAL_DIR $REMOTE_DIR/$REMOTE_SHP
...

for i in `$LOCAL_DIR/*`
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=PRACHT
done;
...

Markus

Former Member
0 Kudos

Hi Sudheendra,

I recommend you to implement this scenario on PI.

Best regards,

Orkun Gedik

markus_doehr2
Active Contributor
0 Kudos

> I recommend you to implement this scenario on PI.

A full blown ABAP + Java system to do a simple FTP? Technically this may the better idea, yes, but keep in mind that PI is licensed separately and that you pay for each external transfer (in MB).

Given the ease of the protocol (FTP), the amount of data transferred and the fact, that a PI system is basically the most high-maintenance-system available to do such a simple task I'd recommend sticking with scripting and easy protocols.

Markus

Former Member
0 Kudos

>> A full blown ABAP + Java system to do a simple FTP? Technically this may the better idea, yes, but keep in mind that PI is

>> licensed separately and that you pay for each external transfer (in MB).

>> Given the ease of the protocol (FTP), the amount of data transferred and the fact, that a PI system is basically the most high->> maintenance-system available to do such a simple task I'd recommend sticking with scripting and easy protocols.

If it is a simple upload operation, that's correct. But on the contrary, that kind of scenarios need to handle many technical prerequisites, for example managing a process chain, using QRFC modules, monitoring the BPM steps and so on, that are already exist and configured on PI. So, of course you can do all these developments in an ABAP program or in a script. But, in order to be at the safe side, you need to be sure that all the processes are completed successfully, and it requires to develop many ABAP code lines and configurations.

I faced many scenarios on my customers, like this and most of the scenarios are need a complex process chain. In short, that kind of scenarios mostly running on PI system.

Best regards,

Orkun Gedik

Former Member
0 Kudos

Orkun, We don't have PI in our landscape yet,so we need to use the script only.

Markus, Thanks for the script.

Can you please give few more details about the script you gave.

ncftpget -u $USER -p $PASSWORD -a -DD -e $ERRLOG -d $DEBUGLOG \

$IP $LOCAL_DIR $REMOTE_DIR/$REMOTE_SHP

...

for i in `$LOCAL_DIR/*`

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=PRACHT

done;

Can we use this to post an inbound idoc?

Also our main intention is to trigger the FM EDI_DATA_INCOMMING. Does this help to trigger the function module.

markus_doehr2
Active Contributor
0 Kudos

> If it is a simple upload operation, that's correct. But on the contrary, that kind of scenarios need to handle many technical prerequisites, for example managing a process chain, using QRFC modules, monitoring the BPM steps and so on, that are already exist and configured on PI. So, of course you can do all these developments in an ABAP program or in a script.

We have workflows, that are triggered in case an error comes up where the user with a simple click can step to the document in question and check what went wrong - and can run corrections or take appropriate actions, workflow supported.

> I faced many scenarios on my customers, like this and most of the scenarios are need a complex process chain. In short, that kind of scenarios mostly running on PI system.

I don't doubt that. If a PI is in place anyhow (or any other middleware) this may make sense. But having a second system in place which need to be monitored (in worst case with BPM on SolMan as a third instance) makes monitoring, if the resources are not there, quite a big challenge.

I doubt that in our case PI would do any good; my premise is always "keep it simple". Mileage may vary.

Markus

markus_doehr2
Active Contributor
0 Kudos

Orkun, We don't have PI in our landscape yet,so we need to use the script only.

>

> Markus, Thanks for the script.

>

> Can you please give few more details about the script you gave.

> ncftpget -u $USER -p $PASSWORD -a -DD -e $ERRLOG -d $DEBUGLOG \

> $IP $LOCAL_DIR $REMOTE_DIR/$REMOTE_SHP

> ...

>

> for i in `$LOCAL_DIR/*`

> 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=PRACHT

> done;

>

> Can we use this to post an inbound idoc?

You asked about a script, I gave you an excerpt how to get the data (ncftpget) and how to post the doc ($PROGRAM is 'startrfc'9.

> Also our main intention is to trigger the FM EDI_DATA_INCOMMING. Does this help to trigger the function module.

Yes - $FUNCTION is here EDI_DATA_INCOMING.

Markus

Former Member
0 Kudos

>> We have workflows, that are triggered in case an error comes up where the user with a simple click can step to the document in question and check what went wrong - and can run corrections or take appropriate actions, workflow supported.

The sound is coming very good

>> I don't doubt that. If a PI is in place anyhow (or any other middleware) this may make sense. But having a second system in place which need to be monitored (in worst case with BPM on SolMan as a third instance) makes monitoring, if the resources are not there, quite a big challenge.

It is a very good point from a basis admin perspective, but regarding my experiences users are facing many unexpected problems, if they don't choose to run on a message broker like PI. For example, they are facing with typical OS problems, changing OS passwords and so on is making hard to identify root cause of the problem. This is because, there are many different points needs to be checked. On the PI you can monitor and handle all these steps on the same box. Well, this is a option to run the integrations on a message broker or not.

>> my premise is always "keep it simple". Mileage may vary.

I am on the same line with you

Please don't misunderstand me, but I am not trying to sell PI license to him Just giving a hint regarding my experiences

Best regards,

Orkun Gedik

Former Member
0 Kudos

Hi Orkun,

Well, my experience is different. We do have PI that we needed for a Rosettanet data transfer.

PI is so complicated and unusable by standard level 1 exploitation people that we try now to avoid using it as much as we can.

The fact that this product uses both abap and java stacks is a nightmare.

We keep now our interfaces as simple and stupid as possible (good old scripting with SFTP ) and they are much more reliable now...

So the lesson is : there is no absolute truth, what is very good in an organization may be very bad in an other organizaion and vice versa !

Regards,

Olivier

markus_doehr2
Active Contributor
0 Kudos

> PI is so complicated and unusable by standard level 1 exploitation people that we try now to avoid using it as much as we can.

> The fact that this product uses both abap and java stacks is a nightmare.

I agree.

We will have to install it for a business case we do with SCM/SNC. We had a POC environment before and setting this up and make it work was... well... challenging, to say the least. Without a proper education on the full system it's nearly impossible to run it as a business critical instance - if you have to run three dozen other systems too leaving alone setting a up a monitoring for it.

With FTP I have one logfile, just one to look into to find out a problem beyond what's in the ERP system and this logfile can be seen through a SAPGUI. So for those very few cases where something with the technical transfer is going wrong, we can solve 98 % of the problem by just reading the text. With PI we would have at least 4 queues in the PI and 2 in the ERP to watch and check (depending whether it's done with ABAP and/or Java) PLUS all the things, that can happen aside from that (starting with kernel patches, database issues on the PI, Java parameters etc. etc.) The list of potential errors occuring in a full blown ABAP + Java system is MUCH (!!) higher, than what can happen during a transfer and a 'startrfc' - given that simple case.

Of course, if you have environments with dozens or hundreds of such transfers to different locations with different payloads you need a tool, I totally agree - athough I have to admit that SAP PI would still be one of the last choices if I have a choice.

Markus

Former Member
0 Kudos

Hi Markus,

After looking into your comments on the scenario, I am planning to implement the script as per your suggestion.

The problem I am facing is, I am a ABAP Consultant and do not have much Basis knowledge or OS level access to check and run the script .

Can you please give me step by step procedure to implement this FTP Script.

Basically I have idoc file already placed at FTP server .

I need to know how to create this script and where to place it in the Application server and How to schedule it so that the files get picked up as and when they are available .

Do we have to pick the file from FTP Sever and place in the folder at application server in this scenario ?

Thanks in advance.

Awaiting your valuable inputs.

markus_doehr2
Active Contributor
0 Kudos

Unfortunately I can't write this script for you, I don't know what OS tools are available, I don't know PATHs, whether this is to be scheduled on an OS level or if there is a external scheduler available etc.

I suggest you ask the OS guys responsible for that system to do it for you if you can't do it yourself.

Markus

Former Member
0 Kudos

Hi Markus,

Thanks for the reply, I needed a clarification from you.

The IDOC file will be stored in the FTP folder. so by using this script you suggested Are we storing the file in some folder in our sap application server ? or Directly processing the file and calling the functaionl module (EDI_DATA_INCOMMING) by passing the necessary parameters ?

Regards,

Edited by: Sudheendra Puthuraya on Nov 16, 2011 2:27 PM

markus_doehr2
Active Contributor
0 Kudos

> The IDOC file will be stored in the FTP folder. so by using this script you suggested are we storing the file some folder in our sap application server or Directly processing the file and calling the functaionl module (EDI_DATA_INCOMMING) by passing the necessary parameters ?

Yes.

We download the file to a certain directory (on the central instance in our case), we create a copy of the file in another directory for archiving reason, then we start 'startrfc' with the parameters necessary and function module EDI_DATA_INCOMING to import it into the SAP system. The file is automatically deleted if the import succeeded (just the technical import, not the update in the SAP system).

A cron job is running every some minutes (externally scheduled on the OS) to check for new files.

Markus

Former Member
0 Kudos

Hi Markus,

I along with basis consultant wrote the script on the smilar lines as yours. We could not directly use your script is a unix command.

We are running on windows 2008 SR2 OS . We wrote few scripts with different parameters each time none of them works. Below are the 4 scripts that we have run one by one . None of them work. They are giving similar error

can you please check and let us know if there are any mistake in any of the below scripts?

The path name specified in the script is where we have placed the IDOC that we want to process.

Script A

E:\usr\sap\EC1\SYS\exe\uc\NTAMD64\startrfc.exe -3 -d EC1 -u usr1 -p pwd1 -c 210 -l EN -h 172.XX.X.XX -s 20 -F EDI_DATA_INCOMING -E PORT=XXR_PRT1 u2013E PATHNAME:
BR1ER1QI02\sapmnt\trans\Interface\EDI\Inbound\IDOC1.txt

Script B

======================================================================================

E:\usr\sap\ERQ\SYS\exe\uc\NTAMD64\startrfc.exe -3 -d EC1 -u usr1 -p pwd1 -c 210 -l EN -h 172. XX.X.XX -s 20 -F EDI_DATA_INCOMING -E PORT= XXR_PRT1 u2013E PATHNAME= IDOC1.txt

Script C

======================================================================================

startrfc.exe -3 -d EC1 -u usr1 -p pwd1 -c 210 -l EN -h 172.XX.X.XX -s 20 -F EDI_DATA_INCOMING -E PORT= XXR_PRT1 u2013E PATHNAME:
BR1ER1QI02\sapmnt\trans\Interface\EDI\Inbound\ IDOC1.txt

Script D

======================================================================================

startrfc.exe -3 -d EC1 -u usr1 -p pwd1 -c 210 -l EN -h 172.XX.X.XX -s 20 -F EDI_DATA_INCOMING -E PORT= XXR_PRT1 u2013E PATHNAME= IDOC1.txt

Error we are getting:

=======================================================================================

RFC Call/Exception: SYSTEM_FAILURE

Group Error group 104

Key RFC_ERROR_SYSTEM_FAILURE

Message Error at OPEN '
BR1ER1QI02\sapmnt\trans\Interface\EDI\Inbound\' (ch

eck file)

Its pretty urgent. Any help on this is highly appreciable.

Thanks

markus_doehr2
Active Contributor
0 Kudos

> We are running on windows 2008 SR2 OS .

Ugh.. Windows and scripting is... tedious...

> We wrote few scripts with different parameters each time none of them works. Below are the 4 scripts that we have run one by one . None of them work. They are giving similar error

> can you please check and let us know if there are any mistake in any of the below scripts?

> =======================================================================================

> RFC Call/Exception: SYSTEM_FAILURE

> Group Error group 104

> Key RFC_ERROR_SYSTEM_FAILURE

> Message Error at OPEN '
BR1ER1QI02\sapmnt\trans\Interface\EDI\Inbound\' (ch

> eck file)

Is that directory available for the user executing the script?

Check with

dir \\BR1ER1QI02\sapmnt\trans\Interface\EDI\Inbound

Markus

Former Member
0 Kudos

Yes Markus, The user executing the script has all authorization for the folder in which the file is placed.

Former Member
0 Kudos

Hi Markus,

I modified the windows script slightly to have the gateway services option also.

E:\usr\sap\ERQ\SYS\exe\uc\NTAMD64\startrfc -3 -d ERQ -u xxx -p yyy -c 200 -l E -h DEVSERV1 -s 20 -g DEVSERV1 -x sapgw20 -F EDI_DATA_INCOMING -E PATHNAME:
DEVSERV1\sapmnt\trans\Interface\idocfile -E PORT=TESTPORT1

Still it is giving the same error .

RFC Call/Exception: SYSTEM_FAILURE

Group Error group 104

Key RFC_ERROR_SYSTEM_FAILURE

Message Error at OPEN '
BIDERQCI03\sapmnt\trans\Interface\' (check file)

Any pointers

markus_doehr2
Active Contributor
0 Kudos

> Message Error at OPEN '
BIDERQCI03\sapmnt\trans\Interface\' (check file)

The user <sid>adm can't open the file.

I asked before what you get as outupt of

dir \\BIDERQCI03\sapmnt\trans\Interface

Markus