How to print the file name in sap

Hi All,
I have requirment like,
there is a folder in my local system, inside that folder there are 10 Excel file like file1.xls,file2.xls..............file10.xls
how to print the file name of all these file in SAp like
file1.xls
file2.xls
file3.xls
file4.xls
file10.xls
Appropriate points will be rewarded.
Thanks in Advance
Arun kumar

Hi,
Still you are facing any problem with this code expalin the problem with details , otherwise close this thread.
Use Method <b>cl_gui_frontend_services=>directory_list_files</b> to read file names for a given directory
after reading the files then Use FM : <b>RSPO_SX_OUTPUT_TEXTDATA</b> to create spool from internal table data and print the data.
<b>sample code :</b>
data: desktop_dir type string.
data: ifiles type table of string.
data: xfiles type string.
data: count type i.
data: filepath type string.
call method cl_gui_frontend_services=>get_desktop_directory
  changing
    desktop_directory    = desktop_dir .
call method cl_gui_cfw=>flush.
call method cl_gui_frontend_services=>directory_list_files
  exporting
    directory                   = desktop_dir
*    filter                      = '*.xls'
     files_only                  = 'X'
*        DIRECTORIES_ONLY            =
  changing
    file_table                  = ifiles
    count                       = count.
  DATA : x_name       LIKE tsp03d-name,
         x_dest       LIKE tsp03d-padest VALUE 'LOCL',
         x_rows       LIKE sxpcklsti1-body_num VALUE 0,
         x_startrow   LIKE sxpcklsti1-body_start VALUE 1,
         x_pages      LIKE rspotype-pages VALUE 1,
         x_pages_1    TYPE p DECIMALS 2,
         x_rqtitle    LIKE sxpcklsti1-obj_descr,
         x_rqcopies   TYPE i VALUE 1,
         x_rqowner    LIKE trdyse01cm-username,
         x_immediate  LIKE pri_params-primm VALUE ' ',
         x_rqid       LIKE tsp01-rqident,
         i_contents    LIKE  solisti1 OCCURS 0 WITH HEADER LINE,
      x_pages   = 1.
      x_rqowner = sy-uname.
      x_dest     = 'LOCL'.
      x_startrow = 1.
      x_rqcopies = 1.
      x_immediate = 'X' .
      CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
       EXPORTING
*       name                 =   x_name
         dest                 =  x_dest
         rows                 =  x_rows
         startrow             =  x_startrow
         pages                =  x_pages
         rqtitle              =  x_rqtitle
         rqcopies             =  x_rqcopies
         rqowner              =  x_rqowner
         immediately          =  x_immediate
       IMPORTING
         rqid                 =  x_rqid
       TABLES
         text_data            = i_contents
       EXCEPTIONS
         name_missing         = 1
         name_twice           = 2
         not_found            = 3
         illegal_layout       = 4
         internal_error       = 5
         size_mismatch        = 6
         OTHERS               = 7.
      IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
Regards
Appana
*Reward Points for helpful answers
Message was edited by: L Appana

Similar Messages

  • How to print .sql file name in the same file using sqlplus

    Oracle 10g on Linux platform.
    I am trying to print the name of .sql script file in that file but could not. Following is the file:
    test.sql
    select '&0' from dual;But instead of printing, it is asking for input:
    SQL> @test.sql
    Enter value for 0: Can any body give me a hint as how can i print the file name.

    Use this
    SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT
    and see
    SQL> create or replace procedure get_dir_list
    2 (p_directory varchar2)
    3 is
    4 l_null varchar2(100);
    5 l_directory varchar2(100);
    6 BEGIN
    7 l_directory := p_directory;
    8 sys.dbms_backup_restore.searchfiles(l_directory, l_null);
    9 FOR x IN (select fname_krbmsft fname from x$krbmsft) LOOP
    10 dbms_output.put_line(x.fname);
    11 END LOOP;
    12
    13 END;
    14 /
    Edited by: HuaMin Chen on Jun 26, 2012 12:26 PM

  • How do I print the file name of a PDF file?

    How do I print the file name of a PDF file?

    In the print dialog under Advanced you can specify this.

  • Is there a way of printing the file name from within the Preview application?

    If I'm printing a file within Apple's Preview application, I sometimes want to be able to print the file name at the edge of the document. Does anyone know of way of doing this?

    Thanks for replying, that goes some way to answering the question, but I'm also looking to see how much space each app and its associated documents are using, i.e. Pages comes in at 112Mb for the app alone, but I'd like to know how much space is being used by the documents as well.
    Once again thanks,
    SG

  • How to include the file name as an XML field

    Hi,
    I'm using a file adapter for process a flat file and convert it into an XML. Does anybody knows how to include the file name into an XML field.
    Ex.
    I process the file named <b>XXIMN21022007.txt</b> and I need an XML like:
    <MT_FILE>
    <field1></field1>
    <field2></field2>
    <field3></field3>
    <filename><b>XXIMN21022007.txt</b></filename>
    </MT_FILE>
    Regards
    Gonzalo

    Just go for dynamic configuration.
    Check the sender file adapter to write the filename in the header (as explained in Michal's blog) and then read that header in some mapping.
    U can use that even in simple message mappings.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
    Your code for the filename tag would be something like:
    <i>DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    return conf.get(key);</i>
    Regards,
    Henrique.

  • How to put the file name in notepad file

    dear frank,
    how to put the file name in notepad file via power shell. I mean i want to put the file name in that notepad file
    for example,
    my file name is ABL and in this file data is
    02/06/2015,180.00,182.00,176.01,180.50,1575500
    02/06/2015,4.20,4.20,4.20,4.20,500
    02/06/2015,113.50,113.70,112.91,113.09,157800
    02/06/2015,682.01,695.90,682.00,683.19,4250
    02/06/2015,213.98,215.00,213.00,214.87,326200
    02/06/2015,21.52,21.65,21.52,21.60,4000
    02/06/2015,111.00,111.25,108.25,108.91,17100
    02/06/2015,52.00,52.00,52.00,52.00,500
    and i want to data in this form
    ABL,02/06/2015,180.00,182.00,176.01,180.50,1575500
    ABL,02/06/2015,4.20,4.20,4.20,4.20,500
    ABL,02/06/2015,113.50,113.70,112.91,113.09,157800
    ABL,02/06/2015,682.01,695.90,682.00,683.19,4250
    ABL,02/06/2015,213.98,215.00,213.00,214.87,326200
    ABL,02/06/2015,21.52,21.65,21.52,21.60,4000
    ABL,02/06/2015,111.00,111.25,108.25,108.91,17100
    ABL,02/06/2015,52.00,52.00,52.00,52.00,500
    There are many file like this that i want to be edit
    plese tell me how can i do it, i think it is possible via windows power shell.
    thanks in advance.

    Hi
    Just for completeness, what version of VB.NET are you using?
    Here is a complete project to copy all the files with the added "ABL," at the start of each line.  You need to start a new Project with a BLANK default Form1, and replace all of Form1 code with the code below. When you run this project, you
    need to use the 2 buttons to set up the ORIGINAL file folder and a folder to place the copies. You need to check if the file EXTENSION is correct (I assumed txt), and check the text to add to each line is correct.  Once all is set up you should have a
    big red button to start the operation.
    NOTE: it is important that you try this out on a copy of some of the files to verify accuracy BEFORE trying on original files. Make sure you have a good back up of the original files before doing anything else.
    ' new project with default BLANK Form1
    ' replace all Form1 code with this code
    ' WARNING: make sure you have a backup of
    ' any files you use this application to
    ' operate on.
    Option Strict On
    Option Infer Off
    Option Explicit On
    Public Class Form1
    Dim OrigFileFolderPath As String = Nothing
    Dim CopyToFolderPath As String = Nothing
    Dim lab1, lab2, lab3 As New Label
    Dim tb1, tb2, tb3 As New TextBox
    Dim b1, b2, b3, b4 As New Button
    Dim fb As New FolderBrowserDialog
    Dim bgw As New System.ComponentModel.BackgroundWorker
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
    Me.Size = New Size(731, 300)
    With lab1
    .Text = "Original Files Folder Path"
    .Location = New Point(15, 5)
    End With
    With tb1
    .Width = 560
    .Location = New Point(10, 30)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
    End With
    With lab2
    .Text = "Copy Files to Folder Path"
    .Location = New Point(15, 125)
    End With
    With tb2
    .Width = 665
    .Location = New Point(10, 150)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
    End With
    With lab3
    .Text = "File Ext"
    .Location = New Point(600, 5)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    End With
    With tb3
    .Text = ".txt"
    .Width = 80
    .Location = New Point(590, 30)
    .BackColor = Color.Khaki
    .ForeColor = Color.Maroon
    .TextAlign = HorizontalAlignment.Center
    .Font = New Font(Me.Font.FontFamily, 12)
    .BorderStyle = BorderStyle.FixedSingle
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    End With
    With b1
    .Text = "Choose Original Files Folder Path"
    .AutoSize = True
    .Location = New Point(10, 65)
    End With
    With b2
    .Text = "Choose Copy Files to Folder Path"
    .AutoSize = True
    .Location = New Point(10, 185)
    End With
    With b3
    .Text = "DO THE COPY"
    .AutoSize = False
    .Size = New Size(240, 50)
    .BackColor = Color.Red
    .ForeColor = Color.White
    .Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
    .Location = New Point(420, 80)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    .Visible = False
    End With
    With b4
    .Text = "CANCEL JOB"
    .AutoSize = False
    .Size = New Size(240, 50)
    .BackColor = Color.Red
    .ForeColor = Color.White
    .Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
    .Location = New Point(420, 80)
    .Anchor = AnchorStyles.Top Or AnchorStyles.Right
    .Visible = False
    End With
    Me.Controls.AddRange({lab1, lab2, lab3, tb1, tb2, tb3, b1, b2, b3, b4})
    With bgw
    .WorkerReportsProgress = True
    .WorkerSupportsCancellation = True
    End With
    AddHandler bgw.DoWork, AddressOf bgw_DoWork
    AddHandler bgw.RunWorkerCompleted, AddressOf bgw_Completed
    AddHandler b1.Click, AddressOf b1_Click
    AddHandler b2.Click, AddressOf b2_Click
    AddHandler b3.Click, AddressOf b3_Click
    AddHandler b4.Click, AddressOf b4_Click
    End Sub
    Private Sub b1_Click(sender As Object, e As EventArgs)
    fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
    fb.ShowNewFolderButton = False
    Dim r As DialogResult = fb.ShowDialog
    If r = Windows.Forms.DialogResult.OK Then
    tb1.Text = fb.SelectedPath
    If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
    If tb3.Text = Nothing Then
    redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
    If tb3.Text = Nothing Then GoTo redo
    End If
    b3.Visible = True
    Else
    b3.Visible = False
    End If
    End If
    End Sub
    Private Sub b2_Click(sender As Object, e As EventArgs)
    fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
    fb.ShowNewFolderButton = True
    Dim r As DialogResult = fb.ShowDialog
    If r = Windows.Forms.DialogResult.OK Then
    tb2.Text = fb.SelectedPath
    If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
    If tb3.Text = Nothing Then
    redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
    If tb3.Text = Nothing Then GoTo redo
    End If
    b3.Visible = True
    Else
    b3.Visible = False
    End If
    End If
    End Sub
    Private Sub b3_Click(sender As Object, e As EventArgs)
    b3.Visible = False
    b4.Visible = True
    If Not tb3.Text.StartsWith(".") Then tb3.Text = "." & tb3.Text
    bgw.RunWorkerAsync()
    End Sub
    Private Sub b4_Click(sender As Object, e As EventArgs)
    bgw.CancelAsync()
    End Sub
    Private Sub ReadPWFile(fn As String)
    Dim filename As String = My.Computer.FileSystem.GetName(fn)
    Dim barename As String = IO.Path.GetFileNameWithoutExtension(fn)
    Dim copyto As String = tb2.Text & "\" & filename
    Dim line As String = Nothing
    Dim lines As New List(Of String)
    Using sr As IO.StreamReader = New IO.StreamReader(fn)
    Do
    line = sr.ReadLine()
    If Not line = Nothing Then
    lines.Add(barename & "," & line)
    End If
    Loop Until line = Nothing
    End Using
    Using sw As IO.StreamWriter = New IO.StreamWriter(copyto)
    For Each s As String In lines
    sw.WriteLine(s)
    Next
    End Using
    End Sub
    Private Sub bgw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
    Dim ftc As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(tb1.Text)
    For Each f As String In ftc
    If bgw.CancellationPending Then
    e.Cancel = True
    Exit For
    End If
    Dim ex As String = My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower
    If My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower = tb3.Text.ToLower Then
    ReadPWFile(f)
    End If
    Next
    End Sub
    Public Sub bgw_Completed(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs)
    tb1.Text = Nothing
    tb2.Text = Nothing
    b3.Visible = False
    b4.Visible = False
    MessageBox.Show("Finished copying files", "Job Completed")
    End Sub
    End Class
    Regards Les, Livingston, Scotland

  • How to hide the file name (the bizarre number assigned by the camera) when exporting an image version in aperture from an album. Pl understand I want to keep the file name in the project library version.

    how to hide the file name (the bizarre number assigned by the camera) when exporting an image version in aperture from an album. Pl understand I want to keep the file name in the project library version.

    Within Aperture you have Images, which are constructed on-the-fly from two files (the Master and the Version).  You get an image-format file _only_ when you export an Image.  You select the file name (usually a scheme) when you create an image-format file (that is, when you export).  Look under "Aperture→Presets→File Naming" for built-in Presets.  You can, of course, create your own or customize any provided.
    The Preset is applied to only the file newly created by your "export" command.  It is not applied to the Image in Aperture (unless you rename your Versions or your Masters).

  • How to find the File name using the FTP Adapter

    hi all,
    how to find the File name using the FTP Adapter with BPEL.
    Regards

    Found the solution for this.
    First In the mediator's routing rule use assign property $in.property.jca.file.FileName to $out.property.jca.file.FileName
    In the BPEL's receive activity go to the properties tab and get the property to a BPEL variable. That should do it.
    Thanks for the posts

  • Can I print the File name and page number

    When printing a file, I would like to print the File Name and the page number also...something like a header, in every page printed.  Is this possible in Acrobat?  Please advise.
    Thanks

    Sure. Did you look under Tools - Pages - Header & Footer ?

  • How to get the file name?

    Hoe to print the file name of the program we are running???

    Hoe to print the file name of the program we are
    running???This is a great opportunity to explain what you want to achieve rather than what you're trying to do. When you say "file" do you want the class file, the jar file or the original source file? Why are trying to do that?
    Bear in mind that the compiled application may (and probably will) be distributed without the source code.

  • How to insert the file name to column

    When user upload the file, in order to avoid the double file name conflict, so I need to  change the file name to something else, but I still need save the former file name to some column to download the file with correct file name, I know how to rename and upload file, but I don't know how to catch the file name and save it to some column when using addt insert transaction?

    Hi,
    As I said earlier, you have to maintain the list of filename's "itemdescr" in different temp file and load it an and when required table instead of checking for round robin functionality. If you are looking forward that oracle sqlldr can able to access the filename as one of the parameter then - it might not possible AFAIK.
    else perform the direct insert on the table from sqlclient.
    - Pavan Kumar N

  • How to Capture the File Names of any extension using ssis

    Hello,
    Can you please let me know on how to Capture the File Names of any extension(EG : xls,text,.csv etc) at a time  and stores in excel file  using SSIS?
    Any help would be appreciated.
    Thanks,
    Vinay s

    If you need to act differently on each file type separately or if not all types of files are wanted, i.e. the Filespecifier cannot be *.* in the Foreach loop:
    In the ssis package
    make 3 variables:
    to store the file extension, e.g. User::CurrentExtension of type string
    to store the filename found in the directory: @CurrentFilename
    to store the name of the directory where the files reside e.g. User::CurrentDirectory
    make a foreach loop of type Foreach Item enumerator:
    in the items list you add each file extension that you need
    txt
    csv
    xls
    xlsx
    As Variable mappings map the CurrentExtension to Index 0
    Inside this foreach loop add another foreach loop of type Foreach File enumerator, in the collection Expressions
    add Expression Directory , set to @[User::CurrentDirecotry]
    add Expression FileSpec, set to "*." + @[User::CurrentFileExtension]
    In the Variable mappings, map Variable user::CurrentFilename to Index 0
    Inside this loop use Execute SQL Task to insert the filename in a Excel connection.
    Jan D'Hondt - SQL server BI development

  • How OSB archive the file name

    How OSB archive the file name?
    I have used JCA adapter to archive file while reading in OSB and OSB does archive the file with different name.
    But OSB is creating the file with name as understandable form. Is it possible to give my own defined name while archiving the file(s).
    Please help me !
    -Thanks

    I dont think it is possible to change the names of the archive files once OSB processes the file. I haven't found any references of the same in the JCA adapter documentation as well.
    You can check with Oracle support if this is feasible.
    Thanks,
    Patrick.

  • MessageFileUpload how to retrive the file name?

    Hi there guys,
    maybe it's a stupid question but i cannot find the answer :_( any of you knows how to retrive the file name i am going to upload from the messageFIleUpload item?
    Thank You, Pier Paolo.
    Edit: Found in another post!! eeheh LAZY ME!! :_)
    Message was edited by:
    PandreoL

    Nice to know that you found the solution. You could have as well used the javadoc for the same.
    --Shiv                                                                                                                                                                                                                   

  • How to change the file name of pdf file in html page?

    Hi,
    Actually my requirement is to upload 50 PDF files containing javascript in each file into flex page with the help of one html page.
    i did the the javascript part by using batch processing.
    now i want to call those pdf files one after another without changing the file name in html page
    the code written in html page is
    <html>
        <body>
            <object id="PDFObj"
                    data="http:\\localhost\pdf\20090807 - Batch 630.pdf"
                    type="application/pdf"
                    width="100%"
                    height="100%">
            </object>
            </body>
    </html>
    So every time i have to change that file name to acess another file.
    Is there is any other way to sort this problem????
    Plz anyone help me to sort out this problem with some code or some example.

    I once had a similar task for creating a webpage that I only use on my computer--a webpage that accesses PDF's and SWF's font previews from a list of fonts as "a href's".  What you must do is utilize the power of the command line, whether on a Mac on a PC or on Linux, Linux being the most powerful (although Mac IS Unix).  You must utilize variables, variable replacement, and then a command to print out the results of a "for" or "while" loop to a text file which will be your HTML file with each individual link automatically built into the HTML code.  You will have a list of 50 links.  If you are simply looking for a GOOGLE type functionality where you click on "Next" and "Previous" you will have to dig deeper into variable replacement--this I don't know how to do yet but there are books for command-line shell interpreters.  One shell interpreter is called "bash" (born-again shell) and there is a book on the market which gives a detailed example of how to replace variables in a shell script.  Again, I don't know how it works.  I will try to learn this at a later time when I am more seasoned with the basics of shell scripting.

Maybe you are looking for

  • Trouble connecting MacBook to HDTV HELP!

    I just bought a Belkin Mini DisplayPort to HDTV Cable. I want to connect my basic MacBook to my Samsung HDTV. I plugged in the HDMI side into the HDMI 1 port on the tv and I plugged in the other side to the mini displayport on my mac. My television d

  • Standard Text printing in SAP Scripts

    Hi All, Iam printing data from Standard Text it is printing but i need like                         Bank            ICICI but the below is giving                        Bank ICICI AS    ,,,,,,,,,,,,,,Bank,,,,,,,, /:       INCLUDE &V_ACC& OBJECT TEXT

  • HT4859 how to reset my inactivated iPod touch through iCloud?

    how to reset my inactivated ipod touch through icloud?

  • Some questions about Skype Manager and Skype Conne...

    Hallo, I found one of your post: That, if I have some questions I may contact with  Contact our solutions team Sadly that link wont work... I have few questions and also I contacted with Microsoft support, but sadly they wasn't able to help me. Only

  • AVCHD and DV

    If I use ClipWrap2 to rewrap AVCHD media to QuickTime, then use MPEG Streamclip to convert it to the Apple Intrrmediate Codec at 29.97fps with uncompressed 48k audio can I edit it with footage shot at the same event on minidv? If I can, will there be