Trigger ABAP program using UNIX script

Hi All,
I want to trigger an Abap program whenever a unix file comes to SAP.
Can any1 please tellme how to write a unix script to trigger the ABAP program.
Thanks in advance.

you will need to create a batch job in SM37 for the ABAP program, and use an event for the start criteria.
The event can be created in SM62
Then in unix, you will need to call an executable SAPEVT.
This will be in the directory /usr/sap/<SAPSID>/SYS/exe/run
you will need to use the appropriate profile for the SAP system to run the sapevt utility.
example :-
sapevt abap_event -t pf=/usr/sap/<SID>/SYS/profile/<SID>_DVEBMGS00_<SYSNAME> nr=00

Similar Messages

  • How to load abap ztable using unix script

    Hi Experts,
    I want to upload the data from excel sheet into abap ztable using unix script. If possible give me a sample coding for this..
    Regards,
    vijay

    hi vijay see the  code below
    REPORT YFTP1 .
    FTP by abap.
    This program passses host, user, source/target
    directory and file parameters to a UNIX script which
    in turn gets the required file from the host by ftp.
    The unix script should look like this:
    #! /bin/sh
    ftp -n $1 << !!
    user $2 $3
    cd ..                      <-- only for mainframe ftp
    get $4 $5
    quit
    placed in the adm path, preferably under
    /sapmnt//exe. In order to make this program
    work please create sapcpic/manager cpic user and
    apply note no. 41770.
    PARAMETERS: HOST(10) OBLIGATORY LOWER CASE,
    USER(8) OBLIGATORY LOWER CASE,
    PASSWORD(8) OBLIGATORY LOWER CASE,
    SRC_FILE(45) OBLIGATORY LOWER CASE,
    TRG_FILE(45) DEFAULT '/usr/sap/trans/data/??????' OBLIGATORY LOWER CASE,
    BIN AS CHECKBOX.
    DATA: JC(8), FLG(1), B(128), PRNAME(128), LOGFILE(30), AAA(40).
    DATA: BEGIN OF A,
    1(12), 2(10), 3(10), 4(47), 5(47),
    END OF A.
    IF HOST = 'zxaq'.
      IF BIN = 'X'.
        PRNAME = 'ftp_bin_vms'.
      ELSE.
        PRNAME = 'ftp_asc_vms'.
      ENDIF.
    ELSE.
      IF BIN = 'X'.
        PRNAME = '/usr/sap/trans/bin/ftp_bin_unix'.
      ELSE.
        PRNAME = '/usr/sap/trans/bin/ftp_asc_unix'.
      ENDIF.
    ENDIF.
    A-1 = HOST.
    A-2 = USER.
    A-3 = PASSWORD.
    A-4 = SRC_FILE.
    A-5 = TRG_FILE.
    CONDENSE A.
    B = A.
    CALL FUNCTION 'JOB_OPEN'
         EXPORTING
              JOBNAME  = 'FTP'
         IMPORTING
              JOBCOUNT = JC.
    CALL FUNCTION 'JOB_SUBMIT'
         EXPORTING
              AUTHCKNAM     = SY-UNAME
              EXTPGM_NAME   = PRNAME
              EXTPGM_PARAM  = B
              EXTPGM_SYSTEM = 'jupiter'
              JOBCOUNT      = JC
              JOBNAME       = 'FTP'.
    CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
              JOBCOUNT         = JC
              JOBNAME          = 'FTP'
              STRTIMMED        = 'X'
              TARGETSYSTEM     = 'jupiter'
         IMPORTING
              JOB_WAS_RELEASED = FLG.
    LOGFILE = '/tmp/ftp.log'.
    DO.
      OPEN DATASET LOGFILE FOR INPUT IN TEXT MODE.
      IF SY-SUBRC = 0. EXIT. ENDIF.
    ENDDO.
    DO.
      READ DATASET LOGFILE INTO AAA.
      IF SY-SUBRC = 0. WRITE / AAA. ENDIF.
      IF AAA = 'FTP completed'. EXIT. ENDIF.
    ENDDO.
    CLOSE DATASET LOGFILE.
    delete dataset logfile.
    now the file is in the application server which you can upload in your internal table and update the database table....
    thnkx
    bhanu

  • Call ABAP program from Unix script passing dynamic filename

    Hi,
    Does anyone know if it is possible to call an ABAP program from a Unix script passing a dynamic filename to the ABAP program?
    We are receiving a file from an external company and on receipt of the file want to call an ABAP program passing the filename.  The filename is made up of File ID, Date and Time which we need to read in the ABAP program.  We usually use Events to trigger a program which is fine when the filename if static however since this filename will be dynamic we cannot do this.  In addition we cannot just rename the file to a static name in the Unix script as we need to know the value of the date and time from the file ID in the ABAP program.  I can change the ABAP program to check our /in directory for a Filename that starts with the fixed File ID however I thought there must be a better way of doing this.  We want the external company to put this information in a file header record but they don't want to change the file contents.  Any ideas would be appreciated.
    Thanks,
    Sinead.

    You could follow the following method
    1.Let the external file reside in the SAP application layer in a defined path e.g. /usr/sap/tmp/interface/working/
    2.Write an ABAP program which will include the following steps:-
       i) read all files in the file path using function module EPS_GET_DIRECTORY_LISTING
      ii) Read the data from files existing in the directory using OPEN_DATASET statement
    iii) After the files have been read move the files to another directory e.g. /usr/sap/tmp/interface/backup/ or you can delete the file.
    3.Schedule this program to be executed depending on the frequency of the external file being generated.

  • Running abap programs using the macros

    In our DP implementation we have faced several issues in the extraction of the data from the demand planning to one of the legacy system. We have written the ABAP program and would be using the read planning book bapi. I wanted to run the ABAP program using the macro could some one please let me know what is the structure of the macro builder that is used to fire the ABAP program. this is being fired from the macros as some comparison is to be done to run the macro.

    Hi,
    Some more information on macro function
    REPORT_SUBMIT()
    REPORT_SUBMIT( 'program_name' ;  <'job_name'> ; <'job_number'>; <'newmode'>) causes the specified program to be executed. Use the optional arguments, job name and job number, if you wish the program to run in the background. If you set the argument 'newmode', the results are displayed in a new window.
    Hope this will helps you.
    Regards,
    Sunitha.

  • Call a Java API using Unix Script

    Hi SDNers,
    I want to call a Java API using Unix Script. Please suggest what will be the commands in Unix.
    Please help!!
    Thanks,
    Priti
    Edited by: Priti Rani Patnaik on Jul 7, 2010 4:17 PM

    Hi
    Try this
    String[] cmd = {"/bin/sh", "-c", "ls > hello"};
      Runtime.getRuntime().exec(cmd);
    [Other Help|/thread/5425832 [original link is broken];
    BR
    Satish Kumar

  • Advantage's using Unix Script

    I'm creating ACH file using program RFPNFC00 which goes and stores in the application server. I need to ping this file from application server to FTP for which i wanna know which one is the best way to do is that with FM  CALL FUNCTION 'FTP_CONNECT' or shall i ask the Unix guy to write a small script to ping the file from app server to FTP.
    Basically can anyone lemme know the advantages and disadvantages of Unix script and ABAP code to ping the file to FTP.
    Regards
    VENk@

    Venkat,
    it depends on the security-configuration in your company.
    If you're authorized use SAP-FTP -> look sample program RSFTP004
    hope that helps
    Andreas

  • ABAP Program using Selection Screen in Process Chain

    Hi,
    I have included an ABAP Program in the Process Chain.
    The ABAP Program takes a selection screen value from user before execution.
    I have created a variant for both the ABAP Process (YPV_ABC) and a variant for the Selection Screen (YPV_XYZ).
    The ABAP Program executes perfectly well in SE 38.
    I get the following message when I execute the Process Chain.
    "Status Change of Process ABAP YPV_ABC.
    Save Status and Trigger Events if Appropriate "
    When I click Yes, the ABAP Process becomes red.
    These are error messages in the log
    516 -  Job started     
    550 -  Step 001 started (program RSPROCESS, variant &0000000012961, user ID ALEREMOTE)
    25 -    Could not ascertain code page     
    546 -  Job cancelled after system exception ERROR_MESSAGE     
    My questions are:
    1) Is it possible to use an  ABAP Program which has a user input screen in Process Chain?
    2) Could you please help  with the above error?

    1) Is it possible to use an ABAP Program which has a user input screen in Process Chain?
    ABAP programs, with variants established for selection screens, are possible. We use them quite extensively for setting triggers to allow Process Chain to continue after an Interrupt Process has been hit.
    2) Could you please help with the above error?
    I'm not quite sure what could be causing this. When you tested this program in SE38, did you test it with the same variant for the selection screen and did you execute it in background?

  • Trigger abap program from process chain

    hello...i have an external source system which is a SAP client, I have a table with the fields i wanted, when the field of the table change to "ctmd end", the abap program in this source client will trigger the process chain in SAP BW and the selection of the infopackage which is a business date will be triggered as well to load the data based on the business key date in the source systems. I am new in abap program and wanna know can this be done so? If can, how can this be done? Thanks!

    generate an event through ABAP program and use that event to trigger that start process type of that process chain
    -- Amit

  • Exec a "MV" (move) Linux command from ABAP program using wildcard "*"

    Hi,
    I have a problem by using FM "SXPG_COMMAND_EXECUTE", SM49 while i try to move the whole content of a SAP folder into another.
    Foders are on the same file system:
    source: /tmp/
    dest:   /usr/sap/tmp
    I made a command in SM69 named ZMOVE:
    I put OS: Linux (is case sensitive)
            command: "mv"
            parameters: /tmp/* /usr/sap/tmp
    hence the final sentence should be "mv /tmp/* /usr/sap/tmp". I did it directly by using program "rsbdcos0" and works fine.
    Now if I try to execute the command ZMOVE from SM49 or using the function module it gives the same error
    *mv: cannot stat  /tmp/ ': No such file or directory**
    I made several tries by changing the parameter section (also using a script on the same directory).
    The permissions are ok, so the only problem seems to be the wildcard (*) character.
    Any suggestions?
    Thanks in advance
    Fabrizio

    Problem solved.
    Forget function modules, SM69 etc. there's an ABAP command in order to perform a SO command.
    Here an example:
    data: lf_file like rlgrap-filename,
          lf_idx(3) type n,
          cmd(254),
          result(255) occurs 100 with header line.
    cmd = 'mv /dir_source/* /dir_dest'.
      call 'SYSTEM' id 'COMMAND' field cmd
                    id 'TAB'     field result-sys.

  • How to call pakage using Unix script

    Hi,
    I have created one package in Oracle(contains2 funcation and 4 procedure) which is in in xxx14database.
    Now i can execute the package and its working fine at database level.
    As per requirement ,i need to create on Unix script to trigger the package.
    I have no idea how to create the Unix script to execute the package.
    The Unix script need to created in xxxx001 Server.
    Can anyone please let me know the template or any link which I can refer to create the same.
    Or anyway i can create a script/batch on window and test first in my laptop and use the same script for my project work with required modification
    Secondly the application owner asked me to give them both database and Unix script to them so that their database team will test the Package which i developed.
    Database script meand the Package body and spec i should save as file.pkb format and send them or i can save them in .sql file and send them
    Thanking you all in advance please help its urgent.

    Now that you know how to do it ... reconsider whether doing so is a good idea.
    There is almost nothing you can do calling from a shell script that can't be done more easily from DBMS_SCHEDULER other than compromise security. Shell scripts connecting to the database are, as shown in the demo code, inherently insecure and, if you get enough of them, make it difficult to cycle passwords on a regular basis.

  • EDI Outbound file trigger not happening automatically.unix script

    EDI OUT bound issue:-
    We are processing IDOC by using WE19 -> Here we are selecting existing IDOC -> By using pushbutton Start Outbound Processing the IDOC EDI file is creating in directory with file name as:- /abc/xyz/edi/DECVDE_989898.
    In the same directory we have unix script file push_idoc_sci.sh is available which sends this EDI file to unix server.This script is working fine when we do manual sending of edi file - there is no issue in the script.
    1> We configured the port SAPEDI which sends this EDI file automatically by using this script file. But this is not happening.
    WE21 settings:-
    Outbound file TAB:- Phycal directory -> /abc/xyz/edi/
                                     Function module: EDI_PATH_CREATE_MESTYP_DOCNUM
    Outbound Trigget TAB:-
                                    Automatic Start Possible check box checked.
                                    RFC destination -- SERVER_EXCE.
                                    Directory-- /abc/xyz/edi/
                                    Command file -- push_idoc_sci.sh
    Inbound file TAB:- Phycal directory -> /abc/xyz/edi/ in
                                 FM -- EDI_PATH_CREATE_CLIENT_DOCNUM
    2> RFC destination TCP/IP connections:- SERVER_EXEC configured with parameters:
         Application server :- Program: rfcexec.
    The Issues is EDI file is creating in applicastion server, but it is not going automatically to unix server as automated process. even we mentoned the script in port defination to send automatically.
    Is there any we are missing? any seetings do we need to do extra?
    Please let us know.
    Thanks in advance.
    Sreedhara.

    Hi Hi sreedhara gupta
    what REDDY said is correct. Still you if you want test by using WE19 ....Put break point at include MSED7F03 at  IF direction_in <> c_direct_incoming.
    change the value of  control_record_in-outmod to 1 or 3.
    Note: Imp thing is............. there is a chase of missing segments which are requied in EDI Subsystem.
    Thanks
    Ramesh
    Edited by: Ramesh on Mar 26, 2010 7:07 PM

  • File port query  File transfer from SAP R/3 to Webmethods using Unix Script

    SAP drops the files in the /sapio/ directory and triggers an unix script using File port partner destination.
    Unix script will perform a secure copy of files to Webmethods server.
    If in unix script, error occurs then an RFC function will be called to send an error notification to a person.
    Queries
    1) How is the unix script triggered using the File port partner destination ?
    2) What is the unix command to invoke a report which sends the error notification mail ?
    3) Does SCP command to copy files to webmethods work , if the unix script is placed in /sapio/ directory ? Or whether
    any connection need to be established between SAP and Webmethods server ?

    Hello,
    Since you want to transfer Article Master, it should be a Retail System. So you should use Message Type ARTMAS. For fullbuild, you can use transaction WDBM and for changes, you can use WDBU.  For changes, you can enable change pointers for required fields using BD64.
    Thanks,
    Venu

  • Err with scheduling an abap program using open dataset

    issue: have an abap program which uses "open dataset ... for input ..." to read the file. 
    - with manual ly running it, receive the following message "dataset_not_open".  
    - with scheduling it, receive same message
    attempting to run an abap program as part of a process chain (ie scheduling a background job) in BI.
    the abap performs the following fxns:
    1) read a file on the server
    2) removes delimiter, renames it
    3) rewrites the file onto the server
    initially used ws_upload for reading and ws_download for writing the file. 
    - both fxns worked fine if it is run manually --> but failed as a  background (part of process chain)
    - note 7925 states can't use ws_upload, download for background jobs
    -so switched to "open dataset"
    Any suggestions as to why the "open dataset" does not work is greatly appreciated it.
    B.A.

    Thank you for all responses. here is more info about the err message:
    sy-subrc = 8
    'invalid argument'
    I looked up the invalid argument in note 99155 --> due to "The destination file is no longer available during repeated file access. "   So, the following steps were taken:
    - file was regenerated and
    - file was placed on the server to be read
    have the following code:
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE encoding default
                          MESSAGE D_MSG_TEXT.
    also have tried the following:
       OPEN DATASET d1 for input in text mode encoding default.
       open dataset d1 for output in text mode encoding NON-UNICODE..
       open dataset d1 for output in text mode  encoding utf-8.
    none had worked.  system --> status shows no unicode.
    THanks again for any suggestions.

  • Urgent: Calling ABAP Program using JMS

    Hi,
    I have a scenario where legacy system pass some messages to ABAP Program and this program can handle one message at a time (written in that way).
    Now the receiver communication channel is configured to access J2SE adapter. This J2SE adapter stores the message on R/3 system and triggers the ABAP program located in R/3 system.
    Now when multiple messages are coming at a time in SAP-XI and processed successfully and handover to J2SE adapter. But J2SE adapter triggers the ABAP program for all messages. And here is the problem. ABAP program is not supporting multi - threading.
    my idea is to use JMS adapter...can you guys suggest me how to achieve result and how to configure JMS or any other adapter to call ABAP Program so that only one message will pass to ABAP program at a time.
    Regards,
    Gourav Khare

    Hi,
    First find out where your ABAP program the data written.You need to write it into and spool then only you can see it.
    Transaction SP01, you can use the FM 'GET_PRINT_PARAMETERS' in your abap program to write to spool.
    Thanks,
    Ravi

  • How to extend the execution time of an ABAP Program using the Process chain

    Hello Sapians,
    Our Environment has got 600seconds = 10 mintues as the execution time.
    My ABAP Program is taking more than this 600 seconds, to show the result, I found this when I tried to execute in debug mode, it shows the result.
    If I execute in background also it shows the results succesfully.
    Only issue is when I execute this report in foreground it has been taking ages and goes on Time OUT Error.
    It has been decided that we can extend the execution time only for this report, and it will reset the time back to 10mintues once the report has been executed successfully or failed in between for any other reasons.
    And we can achieve this by using the process chains.
    Can any body help me please in this regard
    Thanks,

    Hi,,,,,,,,,,
    Besides Process Chain There is another way out for this........
    Resetting time counter of dialog process so that time-out does not
    happen. Use this fm within your program at appropriate locations to
    reset time counter.
    "CALL FUNCTION 'TH_REDISPATCH'."
    Thanks
    Saurabh

Maybe you are looking for

  • IPod Touch OS 3.0 renders wi-fi unusable

    After years of listening to Apple tell me what I was missing, I finally stuck my toe in the water and bought an iPod Touch. Things were fine for the first few days, but then I updated to 3.0 (since many apps I wanted required it) - and now wi-fi is u

  • Re: Register and attend the live or on-demand DENSO webinar and win a YETI coole

    Use it for the family's many road trips.

  • Emailing photos as attachment files

    How do I attach an iphoto as a jpeg file attachment to an email that can be opened and managed by a pc windows user? All my email photos show as actual photos imbedded in the email and can't be taken out of the email by the pc user.

  • Parse XML Elements/Attributes from CLOB into Oracle Table

    Hi! I have an XML file (loaded into a CLOB) which I need to parse and have each individual element and attribute inserted into an oracle table for manipulation. Eg: XML File... <PERSON> <PER_ID changed="1">1</PER_ID> <SURNAME changed="1">MARTIN</SURN

  • Question on SAP Insurance -Reinsurance

    Hi All I am new to SAP and need some guidance.I have nearly 10 years experience in working with North American life insurance admin platform I have worked in product development (requirements and configuration), administration of life insurance produ