Read the names of the files in ABAP program that runs in the background

Hello,
I have a program that uploads information from file on application server.
What I can't figure still is how to get the <b>names </b>of the files that are in <b>specific directory</b>.
There is an other application that will post those files into this directory. I wont to get file names and file types from this directory and put it into an internal table.
File names are changing based on date and version.
Please keep in mind that the program runs in the background, (presentation server is not included in the process)
Thanks in advance,
Milan

Hi,
one epossible solution that i have used is:
1. Create an operating system comand with transaction SM69
command  OS                              OS-command  Parameter
ZDIR         Windows NT Customer  cmd.exe          /C dir &
2. Call Functionmodul
  CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
    EXPORTING
      COMMANDNAME                         = 'ZDIR'
      ADDITIONAL_PARAMETERS               = P_PARA1
  OPERATINGSYSTEM                     = SY-OPSYS
  TARGETSYSTEM                        = SY-HOST
  DESTINATION                         =
  STDOUT                              = 'X'
  STDERR                              = 'X'
  TERMINATIONWAIT                     = 'X'
  TRACE                               =
   IMPORTING
      STATUS                              = G_OK
  EXITCODE                            =
    TABLES
      EXEC_PROTOCOL                       = GTBL_PROTO
   EXCEPTIONS
     NO_PERMISSION                       = 1
     COMMAND_NOT_FOUND                   = 2
     PARAMETERS_TOO_LONG                 = 3
     SECURITY_RISK                       = 4
     WRONG_CHECK_CALL_INTERFACE          = 5
     PROGRAM_START_ERROR                 = 6
     PROGRAM_TERMINATION_ERROR           = 7
     X_ERROR                             = 8
     PARAMETER_EXPECTED                  = 9
     TOO_MANY_PARAMETERS                 = 10
     ILLEGAL_COMMAND                     = 11
     WRONG_ASYNCHRONOUS_PARAMETERS       = 12
     CANT_ENQ_TBTCO_ENTRY                = 13
     JOBCOUNT_GENERATION_ERROR           = 14
     OTHERS                              = 15
3. Loop at GTBL_PROTO and make your coding with the filenames
Hope this helps
Regards
Bernd

Similar Messages

  • How to set a  Executable ABAP  Program to run as a Background Batch Job

    Hi
    Currently  I had a Executable ABAP  Program which when executed prompts for user to enter selection once entered and executed it will delete user entered selections from a Table.
    Now my requirment is to enhance that program to run it as a BACKGROUND BATCH JOB so that there will be an entry in SM37 when the program is executed
    How can i achieve this

    Hi,
    Please refer this link .
    It has the steps.
    http://sapient.wordpress.com/2007/06/19/how-do-you-set-up-background-jobs-in-sap/
    Regards,
    SuryaD.

  • Unzip files using ABAP program

    Hi All,
    Can anybody guide me how to Unzip a .zip file using ABAP program... Appreciate your immediate reply...
    actually, my scenario is to check whether zip file is created in appl.server or not.., and if zip file created then i need to check whether its blank file or any content exist inside the file...
    Thanks in advance
    Bhasker

    hi
    good
    parameters: command(236) lower case.
    data: std_lines(255) occurs 0 with header line.
      call function 'RFC_REMOTE_PIPE'
        destination 'SERVER_EXEC'
        exporting
          command = command
          read = 'X'
        tables
          pipedata = std_lines
        exceptions
          communication_failure = 1
          system_failure = 2.
    You should put your Unix command in the command parameter. "gunzip /yourfilepath/yourfilename" works on my Unix system. Once you determine the proper Unix command, you should be set. This technique is also nice because it provides you with echos back from Unix in table std_lines. For more complex Unix activity, you may want to consider throwing together a Unix script, and calling that via this code.
    reward point if helpful.
    thanks
    mrutyun^

  • How to execute application server file from abap program

    Hi Friends,
    i have a requirement to execute application server file using abap program.
    i got a file directory like '/home/im3/hrintf/xxx.sh' , it's of unix file, so they want me to execute through abap program.
    pls suggest me with relevant logic.
    Thank you.
    Regards
    Ramesh M

    Define the external command in SM49/SM69
    Try with SXPG_CALL_SYSTEM or SXPG_COMMAND_EXECUTE
    Also check this link
    link:[Execute Unix Script|http://searchsap.techtarget.com/tip/0,289483,sid21_gci774071,00.html]

  • Extract Process Chain ID/Name that an embedded ABAP program is run from?

    Hi all,
    I have created some Process Chains in SAP BW where I have incorporated some ABAP program Process Types that uses the same ABAP program.
    In these embedded ABAP program Process Types I need to extract the name of the Process Chain it runs from (ID, Technical Name, Descirption).
    Is there any way this is possible to do?
    One solutions that is not possible to implement (due to parallell runs of process chains that uses the same ABAP program) is the following:
    search in table RSPCVARIANT for your program as follows
    - field TYPE = "ABAP"
    - field FNAM = "PROGRAM"
    - field LOW = <program name>
    take the value of field VARIANTE and use this in table RSPCPROCESSLOG (enter a date selection for BATCHDATE as well)
    take the most recent entry (should be the one you're actually running at that moment)
    via field LOG_ID, retrieve CHAIN_ID (technical name of your process chain) in table RSPCLOGCHAIN
    So my question here is:
    -Is there any way to extract the Process Chain ID/Name that an embedded ABAP program Process Type is run from?
    Thanks beforhand for your feedback!
    regards
    Oddmar

    Hi Erik,
    I am stuck up with a similar requirement, wherein I have an ABAP program in my process chain and I need the technical name of the process chain in the ABAP program at run-time.
    Did you get a solution or work-around for this scenario?
    Thanks in advance.
    Regards,
    Chetana.

  • Logic to run Unix script file through ABAP program

    Hi Friends,
    I need to run the Unix script file from abap program, for that user provided file directory of application server.
    Is there any logic/FM  to run through abap programing.
    pls can any one provide logic.
    Thanks,
    Ravi

    report zsrchsap.
    *-This is a demo report for Search Sap
    *-Author : Sandeep Kulkarni
    *-Date : 09/20/2001
    parameters : p_sfile(60) lower case
              "File to be moved
              "Eg : /home/in/SFILE1.txt
                p_dfile(60) lower case.
              "File's Destination
              "Eg: /home/archive/SFILE1.txt
    data : t_btcxpm
           like btcxpm occurs 0,
           p_addparam
           like sxpgcolist-parameters.
      concatenate
      '/home/ABAP/scripts/Archive_file.sh'
      p_sfile
      p_dfile
      into p_addparam separated by space.
      refresh t_btcxpm. clear t_btcxpm.
      call function 'SXPG_CALL_SYSTEM'
        exporting
          commandname = 'ZSHELL'
          additional_parameters = p_addparam
        tables
          exec_protocol = t_btcxpm
        exceptions
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          program_start_error        = 6
          program_termination_error  = 7
          x_error                    = 8
          parameter_expected         = 9
          too_many_parameters        = 10
          illegal_command            = 11
          others                     = 12.
      if sy-subrc = 0.
        write : /
        'File',p_sfile,'moved to',p_dfile.
      else.
        write : / 'Error Occured'.
      endif.

  • How to print external file using ABAP program

    Hello
    I want to print an external file which is located in server (
    20.99.0.18\GUI\xyz\8.0QUALITY\QM_TS.DOC) .....i want to print these kind of files(which i have retrieved from table 'DRAW' field 'filep' )......i need to print these files using ABAP program.
    thank you
    Vikram.
    Message was edited by:
            Vikram Bojja

    extract the data and pass to script or smartform for printing

  • HT4410 If I install Windows 7 on my MacBook Pro using Bootcamp, now having 2 start up drives, do I select the Windows drive, then I can install a software program that runs only on a PC?

    If I install Windows 7 on my MacBook Pro using Bootcamp, now having 2 start up drives, do I select the Windows drive, then I can install a software program that runs only on a PC?

    Thank you

  • ABAP PROGRAM to run a process chain

    Hello all,
    What is the ABAP program to run a process chain after a step that has failed but is manually corrected?
    In short a std ABAP program to run a pc.
    Regards,
    NIKEKAB

    Hi.
    Plz see my answer to similar question in [this thread|Re: Manage a message at the end of process chain on Web planning Application].
    Regards.

  • How to list ABAP programs that uses a SAP script form?

    Hello everybody.
    Can you please tell me how to list all ABAP programs that uses a particular SAPscript forms? That is, given a form name, I can then list all programs that uses that form.
    Thanks in advance. I'm trying to Google this same info but I'm having a hard time formulating my search terms.
    Thanks.
    -- Carl

    Hi Carl,
      You can get them from table TNAPR,
      Give the FORM NAME and all the programs are listed
    check this table also TTFXP ,   TTXFPT
    Message was edited by: Chandrasekhar Jagarlamudi
    Message was edited by: Chandrasekhar Jagarlamudi

  • Reading Sheet name from csv file.

    Dear All,
    I am doing one program where i am reading contents from .csv file from oracle forms. I m using utl_file for reading the contents from .csv file.
    But problem is i am having 5 sheets under .csv file and i want to read fifth sheet's data. how do i jump to particular sheet in csv file. please help me in this case. this is very urgent.
    regards,
    Manish n

    I'm not sure of the format of a CSV with sheets : I assume it's a spreadsheet with multiple sheets ?
    I know that using Apache POI you can read (and write) native XLS or XLSX spreadsheets and then iterate through the sheets / rows cells. This requires java knowledge but works really well.
    Steve

  • How to read characters from a text file in java program ?

    Sir,
    I have to read the characters m to z listed in a text file .
    I must compare the character read from the file.
    And if any of the characters between m to z is matched i have to replace it with a hexadecimal value.
    Any help or suggesstions in this regard would be very useful.
    Thanking you,
    khurram

    Hai,
    The requirement is like this
    There is an input file, the contents of the file are as follows, you can assume any name for the file.
    #Character mappings for Japanese Shift-JIS character set
    #ASCII character Mapped Shift-JIS character
    m 227,128,133 #Half width katakana letter small m
    n 227,128,134 #Half width katakana letter small n
    o 227,129,129
    p 227,129,130
    q 227,129,131
    r 227,129,132
    s 227,129,133
    t 227,129,134
    u 227,129,135
    v 227,129,136
    w 227,129,137
    x 227,129,138
    y 227,129,139
    z 227,129,142
    The contents of the above file are to be read as input.
    On encountering any character between m to z, i have to do a replacement with a hexadecimal code point value for the multibyte representation in the second column in the input file.
    I have the code to get the unicode codepoint value from the multibyte representation, but not from a file.
    So if you could please tell me how to get the characters in the second column, it would be very useful for me.
    The character # is used to represent the beginning of a comment in the input file.
    And comment lines are to be ignored while reading the file.
    Say i have a string str="message";
    then i should replace the m with the unicode code point value.
    Thanking you,
    khurram

  • How to read Production Order Long Text data in ABAP program

    Hi friends,
      I have the issue in reading the ' Long Text '  tab view data of production order
    in CO03 transaction.Please can some body help me out to get this in ABAP program.
    Regards,
    Rajesh Akarte

    ok goto the long text, double click it, or use the small pencil, so that you proceed to the text editor.
    Once you are there, use the menu: goto->head
    a small popup will come up, stating the information you need.
    what you need is OBJECT, ID, Language and NAME.
    with those information you can feed the FM READ_TEXT.
    and woooohooo there you go

  • Output file from ABAP program

    I am using the program Z_SAP_HIERARCHY_DOWNLOAD to output a hierarchy in BW to a specified drive. It works fine when I go to SE38 and run it. However, when I run it from a process chain, it doesn't output the file. How can I generate the output file by running the program from a Process Chain? Thanks.

    Hello Uday,
    i suppose if you run the program within a process chain it will be started
    in a background process. All downloads via the SAPGUI onto your local
    PC (or network drive) are not possible in the background because there is no
    connection to your PC during the excecution of the report in the background.
    Try to save the download on an accessible file system on the application server
    and download it from there afterwards.
    Which function module is used to download the data (GUI_DOWNLOAD or the older version WS_DOWNLOAD) in your report?
    To save data on the application server use the ABAP statements
      OPEN DATASET filename FOR OUTPUT    -> for creation of file
      TRANSFER record TO filename                  -> for transfer of one record
      CLOSE DATASET filename                        -> for closing the file
    Regards,
    Ralf Matthies

  • XML files from ABAP programs

    Hi everyone!
    Is there a way in ABAP to output XML files?  Pls. send code/ function module if any.
    From ABAP programs, we are sure that we can output TEXT files, but how about XML files?
    The significance of this question is related
    Currently we are using XI to interface SAP and AMS, this question for ABAP to produce XML file arose, if for example, the XI server is down and we have to still send data from one system to another. IDocs can also produce XML files, pls confirm.  Earlier however, we have preferred XI rather than IDocs to do this.  Anyway, any idea regarding this scenario will be greatly appreciated. 
    Thanks and God bless!
    Celeste

    Hi,
    Please check this sample codes from other thread.
    1. itab --- > xml
        xml ---> itab.
    2. This program will do both.
    (just copy paste in new program)
    3.
    REPORT abc.
    *-------------- DATA
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    DATA : BEGIN OF itab OCCURS 0,
    a(100) TYPE c,
    END OF itab.
    DATA: xml_out TYPE string .
    DATA : BEGIN OF upl OCCURS 0,
    f(255) TYPE c,
    END OF upl.
    DATA: xmlupl TYPE string .
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    ******************************* FIRST PHASE
    *------------------ Fetch Data
    SELECT * FROM t001 INTO TABLE t001.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE tab = t001[]
    RESULT XML xml_out.
    CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
    EXPORTING
    TEXT = xml_out
    * IMPORTING
    * LENGTH =
    TABLES
    FTEXT_TAB = itab.
    *-------------- Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'BIN'
    filename = 'd:xx.xml'
    TABLES
    data_tab = itab.
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    ******************************* SECOND PHASE
    BREAK-POINT.
    REFRESH t001.
    CLEAR t001.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'D:XX.XML'
    filetype = 'BIN'
    TABLES
    data_tab = upl.
    LOOP AT upl.
    CONCATENATE xmlupl upl-f INTO xmlupl.
    ENDLOOP.
    *------------------- XML
    CALL TRANSFORMATION ('ID')
    SOURCE XML xmlupl
    RESULT tab = t001[]
    BREAK-POINT.
    Regards,
    Ferry Lianto

Maybe you are looking for

  • Anyone having a problem with links in Safari after upgrading?

    okay,  Before the upgrade to os5, we were able to go to the website to get  the e-edition of our local paper.  The way their website is designed you first see part of the first page and then there is a link to take you to the full page.   Everything

  • Want to change webcam from iSight to another (logitech)

    How can I use a webcam other than the built-in iSight?  I've attempted to connect a logitech webcam so I can get a different angle, but the apps wont give me any choice except for the iSight...

  • Binding parameters in backing bean

    hey, i have a function func1(String str) with a parameter in my bb i use code to invoke the function: BindingContainer bindings = getBindings(); OperationBinding operationBinding = bindings.getOperationBinding("func1"); operationBinding.execute(); ho

  • Error when compiling Systinet WSDL using JWSDP

    We are getting the following error when using Sun JWSDP tools (wscompile) to compile a WSDL document generated by Systinet: error: in message "PatientSearch_findPatient_bar.foo.mccs.WebServiceException_Fault", part "idoox-java-mapping.bar.foo.mccs.We

  • Premier Pro CC 2014 (8.2) Keeps freezing and Crashing!!! Very Frustrating....

    This is really really really frustrating, Whenever I'm editing a project, all is well for a little bit, but after working for a bit and especially after I render my timeline PPCC won't play nice. Either it will freeze, crash or get bottlenecked and m