Reading file name

hello
i used the step by step guide to develop a module for reading file name in a sender file adapter from Krishnakumar Ramamoorthy. (Thankyou very much for that guide)
now when i use this module i get only one problem:
the filename includes the source-dir as well.
e.g.
source-dir: /home/example
filename: test.txt
Filename in module: /home/example/test.txt
why is the source-path included in the Filename?
thanks alot for any help

Hi Paul,
you can always delete this inside your mapping:
for instance trim the first 13 letters from /home/example
then if your directory is always the same you'll have a filename only
Regards,
michal

Similar Messages

  • MDM Sender Channel - reading file name

    Hi all,
    Is there any simple way to read the name of file sent by MDM when I am using MDM sender adapter ?
    I know if it's file sender channel, then we can read file name by writing a UDF. But just wondering about MDM sender adapter.
    Regards,
    -Shankar

    Hi Paul,
    you can always delete this inside your mapping:
    for instance trim the first 13 letters from /home/example
    then if your directory is always the same you'll have a filename only
    Regards,
    michal

  • How to Read file name which we are dealing with ODI File tool

    Hi,
    We are using ODi10g version and we have requirement to move file from one place to another place. We are using ODIFileMove utility but we also want to read file name.
    Any help.
    Thanks in Advance.

    You can accomplish this with a fairly simple Jython script.  Use the os.listdir(<directory>) command to get the name of files in a given directory. 
    You can then (still in the Jython script) loop through the files and move them to a desired location (bypassing the OdiFileMove tool) OR use the Jython script to write the file names to a SQL table.  Then, use an ODI procedure to loop through the newly inserted records and store the file name in an ODI variable that you can then use in your OdiFileMove tool etc.
    I often refer to this blog entry from Gurcan Orhan as a starting point for this kind of task: Loading multiple files with ODI | Gurcan Orhan&amp;#039;s Oracle Data Integrator Blog

  • Reading file names in the unix box

    Hello,
    I did the following to read the files from the local directory.
    String s1 = "c:\samplefiles"
    File dir = new File(s1);
    if(dir.isDirectory())
    String listoffiles [] = dir.list();
    for(int i = 0; i <listoffiles.length ; i++)
    System.out.println(listoffiles);
    else
    System.out.println("Its not a directory");
    How can i read and print the file names in the unix box?
    Thank You.
    Kumar

    Thank You for the reply.
    In my custom page, i am trying to include a search page which includes date parameters based on which the pdf files in the unix box should be displayed in the page as a list. (The pdf file names start with the date).
    Once the user clicks the file names displayed in the page, i need to open the pdf. This part i can handle but to search the file names based on the parameter names and display in the page as the list is a bit confusing.
    Thank You.

  • Error while reading file name in a directory

    Hi,
    I am trying to read all the file names within a directory, however  I get the below error while running the code.
    Run-time error '5':
    Invalid procedure call or argument
    The actual path is "Q:\Budget\Historical Budgets\FY15\*.xls*"
    and ThisWorkbook.Sheets(1).Range("A1").Value = FY15 in my excel sheet.
    "Below is the code I am using"
    Dim file As Variant
    file = Dir("Q:\Budget\Historical Budgets\" & ThisWorkbook.Sheets(1).Range("A1").Value & "\*.xls*")
    If file = "" Then
            MsgBox "no files"
            Exit Sub
          Else
            ' ... else, count the files
            x = 0
            Do While file <> ""
                x = x + 1
                file = Dir         
    <----  I get the error at this line.
            Loop
    End If
    Could you please help me to solve this problem
    Regards, Hitesh

    Do you want to generate a list of all files in a folder, in your spreadsheet?  If so, please try this sample code?
    Option Explicit
    Private cnt As Long
    Private arfiles
    Private level As Long
    Sub Folders()
    Dim i As Long
    Dim sFolder As String
    Dim iStart As Long
    Dim iEnd As Long
    Dim fOutline As Boolean
    arfiles = Array()
    cnt = -1
    level = 1
    sFolder = "C:\Users\Excel\Desktop\Coding\Microsoft Excel\Work Samples\"
    ReDim arfiles(2, 0)
    If sFolder <> "" Then
    SelectFiles sFolder
    Application.DisplayAlerts = False
    On Error Resume Next
    Worksheets("Files").Delete
    On Error GoTo 0
    Application.DisplayAlerts = True
    Worksheets.Add.Name = "Files"
    With ActiveSheet
    For i = LBound(arfiles, 2) To UBound(arfiles, 2)
    If arfiles(0, i) = "" Then
    If fOutline Then
    Rows(iStart + 1 & ":" & iEnd).Rows.Group
    End If
    With .Cells(i + 1, arfiles(2, i))
    .Value = arfiles(1, i)
    .Font.Bold = True
    End With
    iStart = i + 1
    iEnd = iStart
    fOutline = False
    Else
    .Hyperlinks.Add Anchor:=.Cells(i + 1, arfiles(2, i)), _
    Address:=arfiles(0, i), _
    TextToDisplay:=arfiles(1, i)
    iEnd = iEnd + 1
    fOutline = True
    End If
    Next
    .Columns("A:Z").ColumnWidth = 5
    End With
    End If
    'just in case there is another set to group
    If fOutline Then
    Rows(iStart + 1 & ":" & iEnd).Rows.Group
    End If
    Columns("A:Z").ColumnWidth = 5
    ActiveSheet.Outline.ShowLevels RowLevels:=1
    ActiveWindow.DisplayGridlines = False
    End Sub
    Sub SelectFiles(Optional sPath As String)
    Static FSO As Object
    Dim oSubFolder As Object
    Dim oFolder As Object
    Dim oFile As Object
    Dim oFiles As Object
    Dim arPath
    If FSO Is Nothing Then
    Set FSO = CreateObject("Scripting.FileSystemObject")
    End If
    If sPath = "" Then
    sPath = CurDir
    End If
    arPath = Split(sPath, "\")
    cnt = cnt + 1
    ReDim Preserve arfiles(2, cnt)
    arfiles(0, cnt) = ""
    arfiles(1, cnt) = arPath(level - 1)
    arfiles(2, cnt) = level
    Set oFolder = FSO.GetFolder(sPath)
    Set oFiles = oFolder.Files
    For Each oFile In oFiles
    cnt = cnt + 1
    ReDim Preserve arfiles(2, cnt)
    arfiles(0, cnt) = oFolder.Path & "\" & oFile.Name
    arfiles(1, cnt) = oFile.Name
    arfiles(2, cnt) = level + 1
    Next oFile
    level = level + 1
    For Each oSubFolder In oFolder.Subfolders
    SelectFiles oSubFolder.Path
    Next
    level = level - 1
    End Sub
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • File to RFC scenario want to read file name

    Hi All,
    I am having file to RFC scenario in which i am having file name in format  text_yyyymmdd.txt.
    i want to read this file name and by separating the date in file name i have to pass this to one of the RFC date parameter.
    please help me to sort out this.
    Thanks
    Swapnil

    Hi,
    By writing simple UDF in your mapping you can Acheive this
    Try this Once
    DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
    String MyFileName = dynamicconfiguration.get(key);
    String str[] = MyFileName.split("_");
    return str1[1];
    Map this to the date parameter(RFC) in the mapping .
    Thank & Regards,
    Deepthi
    Edited by: Deepthi Muppasani on Sep 23, 2011 8:17 AM

  • How can transfer the read file name via own developed adapter module

    Hello experts,
    I want to know how I can handle the following issue:
    I developed a J2EE adapter module for the file adapter "sender" with the aim to read the file name of incoming files. Thereto I implement the following code like this:
    public ModuleData process(ModuleContext mc, ModuleData md) throws
    ModuleException
    Hashtable mp = (Hashtable)
    md.getSupplementalData("module.parameters");
    String fileName = null;
    if (mp != null)
    fileName = (String) mp.get("FileName");
    Now I get the filename which includes a order nr.  I need this order number to call a RFC Adapter via mapping. So my question is how can transfer this order nr to the RFC adapter?
    Kind regards,
    Fatih

    Hi,
    >> to read the file name of incoming files
    Use file adapter with Adapter specific identifiers selected.
    >>Thereto I implement the following code like this:
    use udf in message mapping and avoid module
    >>Now I get the filename which includes a order nr. I need this order number to call a RFC Adapter via mapping. So my question is how can transfer this order nr to the RFC adapter?
    use RFC Look up function in message mapping...
    Is module so necessary in this case???
    Regards
    Suraj

  • Read file name from Payload (File Adapter)

    Hello experts,
    with Receiver-File Adapter I want to save a specific file. Name is given in the xml payload. I use Variable Substitution.
    My structure is like this:
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    File name schema: %file%
    Variable Substitution:
        File Name: file
        Reference: payload:root,1,elements,1,name,1
    With this expression my file adapter creates two files (as recommended), but they have both the name "name1". I want to create n files with n different names, given by one xml structure. How can this task be done? Setting the occurency from "1" to "n" or "*" does not work.
    Thank you very much!
    Ilona Seifert

    Hi,
    Like pointed by you , your source strucutre,
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    The target strucuture after mutlimapping will be like,
    My structure is like this:
    <root>
        <elements>
            <name>nameX</name>
        </elements>
       </root>
    Now, using Variable Name substitution, you will have the "name " element at a fixed level  always , <b> payload:root,1,elements,1,name,1</b> and so you Variable Name subsitution will also work fine.
    Hope it clears,
    Regards
    Bhavesh

  • Reading File name, mimetype and size from FileUploadUIElement

    Hi,
    I am using FileUploadUIElement and I need to read filename, type and size in my Button click action.
    I have seen the standard Test UI  elements component WDR_TEST_EVENTS which does this in wdDoModifyView method.
    But is there any way to read them outside wdDoModifyView ? In a normal custom action event?
    Thanks and regards,
    Amey Mogare

    Hi,
    Yes you can definately do the same in any of the custom events implemented.
    You will have to create a global attribute in the component controller say g_upload type ref to cl_wd_file_upload ( mark the Public checkbox ).
    " Now in your view modify instead of,
      file_upload2 ?= view->get_element( 'FILEUPLOAD2' ).
    " you say,
        wd_comp_controller->g_upload ?= view->get_element( 'FILEUPLOAD2' ).
    Now create an action for you button and copy the rest of the code from view modfiy and place it in this method,
    using wd_comp_controller->g_upload get the required values as follows.
    * get the content of the filename property
      filename = wd_comp_controller->g_upload->get_file_name( ).
    * get the content of the mime-type property
      mime_type = wd_comp_controller->g_upload->get_mime_type( ).
      wd_context->get_attribute( exporting name = 'FILECONTENT' importing value = filecontent ).
      size = xstrlen( filecontent ).
    Regards,
    Radhika.

  • How to read file name in JavaMapping (not in MessageMapping)

    Hi,
    We all know that we can read a filename using dynamic configuration code in Message Mapping.
    Now my question is how to acheive the same in pure Java Mapping.
    Plz dont give me answers for Dynamic Configuration in MessageMapping.
    Thanks,
    Avis.

    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.HashMap;
    import com.sap.aii.mapping.api. AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.DynamicConfigurationKey;
    import com.sap.aii.mapping.api.DynamicConfiguration;
    public class JavaMapping implements StreamTransformation {
       private Map           param = null;
       private AbstractTrace  trace = null;
       public void setParameter (Map param) {
          this.param = param;
          if (param == null) {
             this.param = new HashMap();
       public void execute(InputStream in, OutputStream out) {
    try {
             trace = (AbstractTrace)param.get(
            StreamTransformationConstants.MAPPING_TRACE );
            DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key =
    DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
             trace.addInfo(ourSourceFileName);

  • PLSQL to Read File Names from a Directory

    Interested in a sample of PLSQL code that reads from a UNIX directory the list of files in the directory for further processing in the program.
    Thank you.
    Mona

    this should do the trick
    http://asktom.oracle.com/pls/ask/f?p=4950:8:804140
    greetings
    Freek D'Hooge
    Interested in a sample of PLSQL code that reads from a UNIX directory the list of files in the directory for further processing in the program.
    Thank you.
    Mona

  • How to read the file name....

    Hello all,
    I have a doubt on reading file name.
    I have 10 pdf files in the dir '/d01/tem/'
    I need to get/load those 10 file names using PL/SQL. Meaning I need to get the file names only not the file contents...
    Please help me to achieve this....
    Thanks and Regards,
    Muthu

    There is no public synonym for DBMS_BACKUP_RESTORE, so you need to prefix it with SYS and make sure your user has execute privilege on the package. This will fix call to DBMS_BACKUP_RESTORE, but you have another issue. - fixed tables. Only SYS can read them. You'd have to login as SYSDBA, create a view around x$krbmsft and grant select on it to your user.
    SQL> connect sys as sysdba
    Enter password:
    Connected.
    SQL> grant execute on DBMS_BACKUP_RESTORE to scott;
    Grant succeeded.
    SQL> create view v$krbmsft as select * from x$krbmsft;
    View created.
    SQL> grant select on v$krbmsft to scott;
    Grant succeeded.
    SQL> connect scott
    Enter password:
    Connected.
    SQL> set serveroutput on
    SQL> DECLARE
      2      p_directory VARCHAR2(1024) := 'C:\TEMP';
      3      p_null VARCHAR2(1024);
      4      i number := 1;
      5  BEGIN
      6      SYS.DBMS_BACKUP_RESTORE.searchFiles(p_directory, p_null);
      7      FOR x IN (select fname_krbmsft fname from sys.v$krbmsft) LOOP
      8        DBMS_OUTPUT.PUT_LINE(x.fname);
      9        EXIT WHEN i = 3;
    10        i := i + 1;
    11      END LOOP;
    12  END;
    13  /
    C:\TEMP\acbrd-0050.csv
    C:\TEMP\afiedt.buf
    C:\TEMP\A_3136_4000.log
    PL/SQL procedure successfully completed.
    SQL>SY.

  • How to get file name using File adapter Sync read

    Hi All,
    I am using SOA 10.1.3.3 and JDEV 10.1.3.3.
    I have an async bpel process.
    I have to read file name in this process... so i have used file adapter sync read operation.
    How can we get the file name with out payload using sync read.
    For normal read (Inbound Spec)we have UseHeaders="true" property.
    Is there any property for sync read to read the file name.
    Please help me
    Regards
    PavanKumar.M
    Edited by: [email protected] on Oct 27, 2009 11:23 PM

    Hi Eric,
    The info in the link provided by you is for a normal read.
    I need to read he file name using Sync read operation.
    Regards
    PavanKumar.M

  • Uploading and reading file from application server

    Hi
    My problem is when am uploading a file to application server it is getting stored in
    usr/sap/transyp1/prod/in   directory
    after that i want to read that file from application server to update database
    when  using below code it is showing some other directory in f4 help
    DATA: lv_hostname TYPE msxxlist-name.
    DATA: lv_server TYPE bank_dte_jc_servername.
    PARAMETERS: p_file TYPE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
    IMPORTING
    e_server = lv_server.
    lv_hostname = lv_server.
    CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
    EXPORTING
    dynpfield_filename = 'P_FILE'
    dyname = sy-cprog
    dynumb = '1000'
    filetype = 'P'
    location = 'A'
    server = lv_hostname.
    experts could you please help me out
    Thanks & Regards
    Nagesh.Paruchuri

    User Transaction file. You will get all logical file path names.
    used following fucntion module to read file name and use command open dataset to read the file.
    CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
                CLIENT           = SY-MANDT
                LOGICAL_FILENAME = C_LOGICAL_FILENAME
                OPERATING_SYSTEM = SY-OPSYS
                PARAMETER_1      = P_IN_FILENAME
           IMPORTING
                FILE_NAME        = P_OUT_FILENAME
           EXCEPTIONS
                FILE_NOT_FOUND   = 1
                OTHERS           = 2.
    OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
      IF SY-SUBRC <> 0.
        MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
      ENDIF.

  • 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

Maybe you are looking for

  • Personalizing SUN Portal 6.2

    I am having limited sucess personalizing Sun Portal Server. I haven't seen a really good step by step guide on how to accomplish the following task. I have multiple roles configured in the console. When a person logs on with one role I want them to b

  • I can't post to numbers community

    I cannot post to the Numbers community.  It keeps telling me I "cannot create or edit content in this area".  WHAT?  How do I post a question, then? Never mind.  Apparently, the "Select a Community" requires a change to the field, even if it already

  • Exporting to Flash using Quicktime pro

    I'm trying to export a 43 min vid from FCP6 using quicktime conversion. I want to export to Flash. Its for web content, and its in widescreen. Any help with size and converting to flash would help. I've never done web content before. Thanks!! tec24

  • Problem with unlocked iPhone

    MY iphone is unlocked in uk and accepts all sim cards in uk but when i travel to colombia and insert local sim it asks to activate the phone and then says please insert the original sim the phone came with why is this when my phone is unlocked ?

  • Oracle Application Server 10g thread stuck issue.

    We are having, Oracle Application Server 10g [10.1.3.1 + 10.1.3.4patch] along with Oracle Http Server 2.0 Now there is a issue of thread stuck [some application threads taking longer times] due to which the application server is unable to respond and