Shell Scripts with File adapter

Hi Everyone,
Can we use shell scripts in File Adapter of XI.
If yes can someone give me the configuration and any helpful blogs or links.
Helpful answers will be rewarded points.
Thanks,
Rupash K

Hi,
you can just call the script in the File Adapter, before or after XI processing step.
Nevertheless, sometimes it behavior different between to call the script as to typ the command directly on the channel configuration.
Here is the [SAP official document|http://help.sap.com/saphelp_nw04/helpdata/en/84/e8763c997fda50e10000000a11405a/frameset.htm], it is quite easy to use. Just call the script as if you want to call it on the shell, you have to aware about the path and placeholder which you may want to pass the it as parameter to your script.
Here are some more links
https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/sapXIFileAdapterOSCommandLine+Feature
https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/morewiththeFileAdapter
regards,
Hai
Edited by: Hai Long on Nov 14, 2008 5:30 PM

Similar Messages

  • Reg: UNIX shell script at File Adapter

    Hi all,
    I am doing a File to file scenario and using command line arguments in Sending file adapter. I am using UNIX shell script ".sh" file for executing the command.
    I gave the following path at "Run OS command before message processing" parameter:
    /temp/xidelivery/send/FILOSC004_shell.sh
    and this file contains following code:
    <b>#!/user/bin/sh cp /temp/xidelivery/send/FILOSC004_in.txt /temp/xidelivery/send/FILOSC004_input_copy4.txt</b>
    I put the source file, FILOSC004_in.txt and shell script files at the respective paths.
    If I give "cp" command directly in command line it is working fine. But I could not execute this with shell script. Can any body give me the reason where I gone wrong.
    Regards,
    Pavani.

    Hi,
    can you try this,
    bash /temp/xidelivery/send/FILOSC004_shell.sh
    let me know.
    hey you can check the blog below to catch the OS errors,
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    Prasad Babu.
    Message was edited by:
            PrasadBabu Koribilli

  • Passing mulitple parameters to unix shell script via File adapter

    Hi,
    I have the following usecase.
    I have a set of files A, B, C, D  etc in a directory dir.  I also have a EOT ( end of transaction file).
    I need to merge this file once the EOT file is present in XI application server (  using NFS with File adpter).
    I have a script which can take the following paramters:
    1. EOT file name
    2. File names for A,B,C,D
    3. Directory names.
    Is it possible to send muliple parameters to the unix script from the File adapter?
    please share any blogs which do so.
    Thanks in advance,
    Best Regards
    Abhishek

    Hi,
    You can always call script from file adapter using "OS command" functionality, pass additional parameter like you do in unix for existing script (exact command which you type on unix prompt).
    Adapter will simply pass your OS command to operating system, so from XI point of view nothing is changed and it is your script which should take care of parameters.
    Regards,
    Gourav

  • Problem with FIle Adapter

    Hi
    We r facing typical problem with file adapter.
    Lets say there are 30 files to be processed  by placing an copy in arichive folder by file adapter  based on pooling 
    parameters.
    All the 30  files are picked up and we can see the copies in archive folder.
    But when we go to RWB and check the audit log,
    there we could see only 25 files , the 5 files are missing.
    no trace found therre about the 5 files.
    This is happening only some times and not to all the files placed in the FTP. Later when the same file is placed back from the Archive folder to the Source folder, the file is being picked and processed succesfully.
    unfortunately this is happening on Production server
    Any pointers which could trouble shoot this issue.
    Regards
    shekar chandra

    Hi,
    Couple of thing which you can try....
    1. Use EOIO QoS and check if you still face the issue.
    Is some program or application writing files to the directory? If yes I would recommend the use of a temporary name to write the files and then rename them.
    Sometimes when an external application connects via FTP and transfers the files...
    The file could be picked up by the adapter poll even before the transfer of data is done.
    Which is why you will find that the file is archived but there is no xml message created for the same in the Integration engine.
    Try increasing the poll interval. This helps sometimes.
    Regards,
    Sidharth

  • How to process large input CSV file with File adapter

    Hi,
    could someone recommend me the right BPEL way to process the large input CSV file (4MB or more with at least 5000 rows) with File Adapter?
    My idea is to receive data from file (poll the UX directory for new input file), transform it and then export to one output CSV file (input for other system).
    I developed my process that consists of:
    - File adapter partnerlink for read data
    - Receive activity with checked box to create instance
    - Transform activity
    - Invoke activity for writing to output CSV.
    I tried this with small input file and everything was OK, but now when I try to use the complete input file, the process doesn't start and automatically goes to OFF state in BPEL console.
    Could I use the MaxTransactionSize parameter as in DB adapter, should I batch the input file or other way could help me?
    Any hint from you? I've to solve this problem till this thursday.
    Thanks,
    Milan K.

    This is a known issue. Martin Kleinman has posted several issues on the forum here, with a similar scenario using ESB. This can only be solved by completely tuning the BPEL application itself, and throwing in big hardware.
    Also switching to the latest 10.1.3.3 version of the SOA Suite (assuming you didn't already) will show some improvements.
    HTH,
    Bas

  • Problems with File adapter

    Hi All
    I am facing some problems with XI system. XI production server was restarted couple of days back. From that time, 1 file is not reaching its destination. When i go to communication channel monitoring, i see this  message for all the communication channels with file adapter "No adapter registered for this channel".
    But, communication channels with SOAP adapter are working fine, and the corresponding files are reaching its destinations. So, what should i do to rectify this probelm? Do we have to restart XI server onceagain? Is there anything pirticular, to be careful about, while restarting XI system?
    Many Thanks in Advance
    Chandra Sekhar

    Hi Chandra shekar,
    Plz try to do the  following steps:
    1)Try after restarting the Java Stack.
    2)Try after SLD cache.
    To clear the SLD cache, from the Integration Builder main menu, choose Environment ® Delete Cache for SLD Data.
    Once we have deleted the cache for SLD data, accessing objects in the SLD may take longer than usual initially.
    This will help you to find SP Level
    http://help.sap.com/saphelp_nw2004s/helpdata/en/1f/c45b4211aac353e10000000a1550b0/frameset.htm
    http://hostname:5/CPACache/refresh?mode=full
    Regards,
    Vinod.

  • Interpreting Multibyte data with File Adapter in BPEL Process

    Hi all,
    I am trying to interpret multibyte data file using native schema file.The file is defined as below:-
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    targetNamespace="http://TargetNamespace.com/ftpinbound"
    xmlns:tns="http://TargetNamespace.com/ftpinbound"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified" nxsd:encoding="MS932" nxsd:stream="bytes" nxsd:version="NXSD">
    <xsd:element name="root">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Header" minOccurs="1" maxOccurs="1">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="RecType" type="xsd:string" nxsd:style="fixedLength" nxsd:length="5"/>
    <xsd:element name="OperMode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1"/>
    <xsd:element name="SendSideCompCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="RecvSideCompCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="BPID" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8"/>
    <xsd:element name="InfoTypeCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4"/>
         <xsd:element name="CreateDate" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="SendSideSysCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="RecvSideSysCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="Preliminary" type="xsd:string" nxsd:style="fixedLength" nxsd:length="458"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Lines" minOccurs="1" maxOccurs="unbounded" nxsd:style="array" nxsd:arrayTerminatedBy="(">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="DataProcessNo" type="xsd:string" nxsd:style="fixedLength" nxsd:length="5"/>
    <xsd:element name="InfoClassCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4"/>
    <xsd:element name="DataCreateDate" type="xsd:string" nxsd:style="fixedLength" nxsd:length="6"/>
    <xsd:element name="SellerCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="OrderRecvPartyCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="PODeptCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8"/>
    <xsd:element name="ProductNo" type="xsd:string" nxsd:style="fixedLength" nxsd:length="19"/>
    <xsd:element name="CorrectionCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1"/>
    <xsd:element name="SupplyClass" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1"/>
    <xsd:element name="Buyer" type="xsd:string" nxsd:style="fixedLength" nxsd:length="7"/>
    <xsd:element name="MatStdDimension" type="xsd:string" nxsd:style="fixedLength" nxsd:length="20"/>
    <xsd:element name="Package" type="xsd:string" nxsd:style="fixedLength" nxsd:length="7"/>
    <xsd:element name="Remarks" type="xsd:string" nxsd:style="fixedLength" nxsd:length="30"/>
    <xsd:element name="ConTaxClass" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1"/>
    <xsd:element name="SuppDeptCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8"/>
    <xsd:element name="SuppProdName" type="xsd:string" nxsd:style="fixedLength" nxsd:length="30"/>
    <xsd:element name="SuppProdNameCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="25"/>
    <xsd:element name="SuppUnit" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3"/>
    <xsd:element name="SuppUnitPrice" type="xsd:string" nxsd:style="fixedLength" nxsd:length="13"/>
    <xsd:element name="PODeptName" type="xsd:string" nxsd:style="fixedLength" nxsd:length="20"/>
    <xsd:element name="Buyer_K" type="xsd:string" nxsd:style="fixedLength" nxsd:length="14"/>
    <xsd:element name="MatStdDim_K" type="xsd:string" nxsd:style="fixedLength" nxsd:length="40"/>
    <xsd:element name="Remarks_K" type="xsd:string" nxsd:style="fixedLength" nxsd:length="60"/>
    <xsd:element name="SuppDeptName_K" type="xsd:string" nxsd:style="fixedLength" nxsd:length="40"/>
    <xsd:element name="SuppProdName_K" type="xsd:string" nxsd:style="fixedLength" nxsd:length="60"/>
    <xsd:element name="PODeptName_K" type="xsd:string" nxsd:style="fixedLength" nxsd:length="40"/>
    <xsd:element name="CountingMTHs" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4"/>
    <xsd:element name="SuppProdNvAmount" type="xsd:string" nxsd:style="fixedLength" nxsd:length="10"/>
    <xsd:element name="SupProdSingleItem" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="SupProdWIP" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    <xsd:element name="SupProdSpoiledQnty" type="xsd:string" nxsd:style="fixedLength" nxsd:length="12"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Trailer" minOccurs="1" maxOccurs="1">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="RecType" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4"/>
    <xsd:element name="NoOfRec" type="xsd:string" nxsd:style="fixedLength" nxsd:length="5"/>
    <xsd:element name="Preliminary" type="xsd:string" nxsd:style="fixedLength" nxsd:length="526"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    This schema works fine and data is produced as expected when I am using "chars" as the stream option.However I can't use "chars" as the stream option and need "bytes" as the stream option. However when mentinong "bytes" option the following exception is generated:
    Charset "MS932" not supported.
    Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
         at oracle.tip.pc.services.translation.xlators.nxsd.ByteReader.<init>(ByteReader.java:87)
         at oracle.tip.pc.services.translation.xlators.nxsd.NXSDTranslatorImpl.createScanner(NXSDTranslatorImpl.java:800)
         at oracle.tip.pc.services.translation.xlators.nxsd.NXSDTranslatorImpl.translateFromNative(NXSDTranslatorImpl.java:440)
         at oracle.tip.adapter.file.inbound.ProcessWork.doTranslation(ProcessWork.java:504)
         at oracle.tip.adapter.file.inbound.ProcessWork.processMessages(ProcessWork.java:266)
         at oracle.tip.adapter.file.inbound.ProcessWork.run(ProcessWork.java:179)
         at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
         at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:272)
         at java.lang.Thread.run(Thread.java:595)
    Please let me know can I at all read a file in byte format with File adapter using a desired encoding style?This is littile urgent.
    Thanks

    Hi James,
    Yeah I tried that too and it gave the same error. And I need to encode with MS932 only since the data will contain Japanese characters and this encoding is identified both by windows and non-windows OS.
    Please can you advice what can I do since the requirement is urgent.
    Thanks

  • How do you pass shell scripts with cocoa?

    How do you pass shell scripts with cocoa?

    You asked for more detail -- I don't know if this is what you were referring to or not, but here's a little more detail on how to use the system() function if that's what you wanted to know.
    As etresoft mentioned, the system() function can be useful for the kind of thing you are talking about. You will need to write the following statement at the top of your code if you want to use it:
    #include <stdlib.h>
    To use the system() function, simply put the command as you would write it in the Terminal between double quotes between the parenthesis. For example, something as simple as:
    system("ls");
    I don't what the practical use of the above statement would be, but it will run, and that's the general format for the system() function. So just put between the quotes whatever command you want to send.
    Hope there was something helpful here.

  • Executing a shell script with DBMS_SCHEDULER

    Hi,
    when I execute a shell script with DBMS_SCHEDULER this doesn't works correctly
    BEGIN
    DBMS_SCHEDULER.create_job
    job_name => 'job_AR',
    job_type => 'EXECUTABLE',
    job_action => '/home/crm/crmdw/AR/start_execution.sh',
    enabled => TRUE,
    start_date => systimestamp,
    repeat_interval => 'FREQ=MINUTELY;INTERVAL=15',
    comments => 'Test Job AR'
    END;Inside the shell script there is a code who call a Hierarchy of process,
    if I executed it manually or with a cron, it works perfectly
    but when I execute it with the job that I've described before it's executes
    all process at same time and it doesn't work.
    What can I do to fix the issue,
    any Ideas?
    Thanks in advanced...

    #!/usr/bin/ksh
    #test_dbms_scheduler.ksh
    echo $1
    echo "I am in Unix"
    exit 0
    chmod 755 test_dbms_scheduler.ksh
    Create or replace procedure test_dbms_scheduler
    as
    v_text varchar2(255) := 'Parameter passed from Oracle to Unix';
    Begin
    dbms_output.put_line("I am in Procedure");
    dbms_scheduler.create_job
    (job_name=>'test_dbms_scheduler',
    job_action=>'/usr/bin/test_dbms_scheduler.ksh',
    number_of_arguments=>1,
    job_type=>'executable',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
    enabled=>false,
    auto_drop => TRUE,
    comments=> 'Run shell-script test_dbms_scheduler.ksh');
    dbms_scheduler.set_job_argument_value(job_name =>'test_dbms_scheduler', argument_position => 1, argument_value => v_text);
    dbms_scheduler.enable('test_dbms_scheduler');
    dbms_output.put_line("I am back in Procedure");
    Exception
    when others then
    dbms_output.put_line(sqlcode||sqlerrm);
    end;
    set serveroutput on
    exec test_dbms_scheduler;

  • Get file on demand with file adapter?

    Hi all.
    I need to get a file on demand (System A ask for a file to FTP server system) with FTP adapter. My problem is that FTP receiver adapter allows just uploading but not getting files. And sender file adapter is not valid for "on demand" scenario.
    Thanks,
    Gari.

    Hey
    as even u said ,on demand is not available for File,i guess starting from PI 7.1 they are gonna add some enhancements to File adapter to support this,but till then i dont think there is a direct way.
    one way around which i think of is u might wanna write a Unix shell script,which will catch this demand and trigger the file to be placed in the specific directory.
    u can have two scenario,the first scenario simply sends the demnad for file which will trigger the unix script(use the OS commands option in file adapter for this) and the second scenario will pick this file and send it
    thanx
    ahmad

  • How to run a java class from a shell script with passing arguments

    hi,
    I have a jar with all the required classes. I was using ant to run the classes i needed.
    But now i want to use a shell script to run the class, also the class accepts some arguments so when script is run it should accept arguments.
    So can any one tell me how to set class paths, jar location and call the required class from shell script or batch file with passing arguments to it.
    Thanks in advance.

    Let's say that the order of arguments is as below
    1. Jar file name
    2. Classpath
    Your shell script would look like this
    java -cp $CLASSPATH:$2 -jar $1 I am assuming that your jar file has the required main-class entry in its manifest. Note that $1...$9 represent the arguments to this shell script.
    The same goes for a batch file
    java -cp %CLASSPATH%;%2 -jar %1

  • Execution of remote script in File Adapter OS Command

    Hello.
    I'm having issues with a remote script placed on a file adapter which fails to execute in a clustered PI (Version 7.1), running on Windows 2008.
    Our current setup is as follows.
    - Machine A and Machine B make up a SAP PI Cluster node.
    - Machine C is our network file share, used as a sandbox for receiving and sending files.
    One given scenario would be having the Cluster picking up a file from a FTP folder (Machine D) and copying it over to a given location in Machine C. This is working without problems in the cluster environment.
    Now, a very specific scenario requires that after copying the file (to folder INPUT), a given script shall be executed over the received file and decide which folder should that file be archived, TO_PROCESS or NO_PROCESS folders.
    So, Outbound Channel is reading from the FTP, Inbound Channel stores in Machine C and has to run a script after message processing.
    The problem here is that the script is stored also in Machine C, so placing the OS Command should refer to a shared path:
    Example:
    sap-machine-c.gca.ad.root\InboundFiles\INPUT
    sap-machine-c.gca.ad.root\InboundFiles\TO_PROCESS
    sap-machine-c.gca.ad.root\InboundFiles\NO_PROCESS
    sap-machine-c.gca.ad.root\Scripts\procFile.bat
    If I give the command of "
    sap-machine-c.gca.ad.root\Scripts\procFile.bat %F" on the receiver channel, checking RWB, Communication channel says the command was executed with success but the file doesn't leave the INPUT folder.
    The script is know to execute with success from both instances, I have logged into each one of them and executed with RFCUSER in SE38 w/transaction RSBDCOS0.
    I have tried to replicate this issue, reducing even the procFile.bat script to just do an "echo" command but still doesn't work (RWB PI says it does).
    It seems to me that executing scripts from remote shares is a no go? Does anyone have a previous experience dealing with these cases?
    Thanks,
    Romeu

    Hi all.
    After taking some hints from this thread, we have found out that the problem lied some where in the installation part of PI.
    We've set up a basic script, local and not remote, and still the system would not execute that command.
    The RWB logs showed successful processing but the Application Server logs were full of errors and stack traces regarding the execution of any command. A support note was raised with SAP support in order to trace these errors.
    I'm therefore closing this question as the original question is not related with remote scripting.
    Thanks all for your help.
    Best regards,
    Romeu

  • Command Line Scripts in File Adapter

    Hi,
    In the file adapter, does the command line script support "PERL" Scripts.
    thanks.
    Krishnan

    YES It will support.
    For clarification check below one.
    /people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi
    FTP channel - not processing files, coz one of the files is wrong,

  • Sqlplus in Shell Script with startup pfile

    I have the following entry in my Korn shell script:
    ${ORACLE_HOME}/bin/sqlplus -s /nolog << EOSQL >> ${PR_LOG}
    connect / as sysdba
    whenever sqlerror exit sql.sqlcode;
    startup pfile "/u01/app/oracle/admin/${ORA_SID}/pfile/spfile${ORA_SID}.ora";
    EOSQL
    When I execute the script I get the following errors:
    LRM-00123: invalid character 0 found in the input file
    ORA-01078: failure in processing system parameters
    I've isolated the problem to the 4th line. When I change it to simply "startup", everything works. I did try changing the quotes to ` and ', but those didn't work. I even explicitly listed the ORA_SID, and I'm still getting the same error messages.
    Any ideas how I can resolve my problem with the 4th line? All help is appreciated.

    and yes I want to start the database with the spfile.
    If I just use "startup", everything is fine; and I can start the database with the spfile, because I have a symbolic link under $ORACLE_HOME/dbs to point to my actual spfile location - /u01/app/oracle/admin/salsa/pfile/So... what's the problem ? Just use "startup", if I'm not wrong you'd use the same spfile.
    To use that syntax you should create a file with a line like this
    spfile=<path of spfile>
    and start as
    startup pfile='<path of that file>'

  • Calling unix scripts in File Adapter

    All,
    we have a script recindicator.sh in the root of the unix server. This script take 1 parameter.
    In the File adapter - "Run Operatning System Command After Message Processing" - we put the following,
    recindicator.sh %f
    we see the adapter working, but we are not seeing the effects of the script which is supposed to create 2 different files.
    Can we run scripts in the "Run Operatning System Command After Message Processing" ? If yes, what is wrong with our configuration?
    When we run the script directly on the server, with the parameter - it is working. so no issue in the script.
    Thanks,

    Hi,
    Yes, the script is in XI server. we tried with %F also, it is not working.
    At what directory level is the command that we give in the configuration run? is it in the root? or some other SAP folder like - "/SAP/user/..."?
    Thanks.

Maybe you are looking for