cancel
Showing results for 
Search instead for 
Did you mean: 

Command line: Shell Script code for File Adapter

Former Member
0 Kudos

Hi Experts,

My Scenario is file to file without ESR i.e. no mapping is there.

There is a foreground job from ABAP which puts the file in the directory.But sometimes when this job is being writing the file in directory, sender communication channel picks the file and send the incomplete file.

I have set one parameter in the advanced tab of sender communication channel i.e. "Msec to wait before modification check" as a default value of 5000 msec.But still the issue is not resloved.

Now I have decide to go with 'Run operating System command before/after message processing' option in File Sender adapter.

Can Anyone help me with the script code and way to implement it.

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You might want to increase the Msec to wait before modification check value from 5000 msec to higher values and see whether that helps. Also you can control the communication channels externally throught script. You can drop the file first and restart the channel after that. This way you can start the channel as desired.

Please check this blog. This is one approach

http://scn.sap.com/community/pi-and-soa-middleware/blog/2007/05/04/control-communication-channels-ex...

Former Member
0 Kudos

Thanks Baskar for your help.

But this will also be a manual workbut business needs full automation.If you can help me with respect to automation that  file adapter will automatically not pick up the file until it is updated completely.

If I can write any shell script to let my file adapter wait till updation in file complete.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Few cents... This can be done using script only.  ABAP Job can call a script after writing the file on the directory or writing files can be implemented in the script and next step is to use the below command

Example: something as below

step 1: write file in the directory followed by  ;

step 2: below command

wget  http(s):hostname:50000/AdapterFramework/ChannelAdminServlet?party=&service=BLService&channel=File1_sender&action=stop

Take help from Unix team.

former_member223322
Active Participant
0 Kudos

Try with the Availability time Planning option in the CC monitoring screen. If you know the time & duration of the ABAP job, then you can schedule an ATP for your sender channel accordingly. You can refer to the below blog that may help you to set up the ATP.

http://scn.sap.com/thread/606260

~Srini

Former Member
0 Kudos

Hi Baskar,

Thanks for your reply.

Can you please explain in detail ?? I didnt get you exactly.

Former Member
0 Kudos

Hi srini

The ABAP job which writes the file in directory runs manually by payroll team on weekly basis or sometimes on any day.It is a standard program.

Is there any other way??

former_member223322
Active Participant
0 Kudos

Hi,

- Change the existing ABAP program to create the file in a different name.

- After that we need to call the FM SXPG_COMMAND_EXECUTE in the same program.

- Pass the UNIX command to rename the file in to this FM so that the PI can pick up the new file.

Refer to the thread http://scn.sap.com/thread/53457 for more details on how to create the command in SAP and how to pass it to the FM.

In case you have any job scheduler, then you can call the command/script as a next step after the program execution.

Apart from the above methods, you can also try using proxy to pass the data to PI to avoid this issue.

~Srini