Sequence number/counter in File name using FTP

Hi
I have to add sequence number in the file name. How can i do that? everytime file generates it should pick up the latest file number.
Example File1 File2 File3. 1,2 and 3 are the sequnce number.
Regards

Hi ria,
         You can do this by dynamic file creation. Use this following code and cretate an UDF. The map the required file format to the target header structure as below;
UDF
sequence number:
IDENTIFIER is the parameter
Import com.bp.xi.util.*;
Code:
return ServiceUtil.getSequenceValue( IDENTIFIER, container, false );
Dynamic file:
Key & Value is the parameter
Code:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get( StreamTransformationConstants.DYNAMIC_CONFIGURATION );
DynamicConfigurationKey confkey = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File",  Key );
conf.put( confkey, Value );
return "";     
Input parameter "Key" is given a constant value"FileName"
Second parameter "Value" is the file pattern
Mapping
Constant(File)concat function sequence numberUDF ==> Dynami File udf ==>target header record.
In the receiver communication channel check the adapter specific function, filename
points if useful
regards,
Murugavel

Similar Messages

  • Get/put dynamic file name using FTP

    Hi Friends,
      I am currently using FTP_Connect, FTP_command and FTP_disconnect to get/put a file from a remote server.
    But the file name was changed to add a date/time stamp.
    So the filename became dynamic (example from 'test.txt' to 'test_200512160800.txt').
    I tried using get test. but my FTP command failed. Do you know anyway of doing this?
    Thanks.

    Hi Lego,
    here's another sample for the fm:
    REPORT ztest_epsf.
    PARAMETERS: date LIKE sy-datum,
                dir  TYPE epsf-epsdirnam,
                pattern TYPE epsf-epsfilnam,
                zid   LIKE vers_dest-rfcdest.
    DATA dir_list LIKE epsfili OCCURS 0 WITH HEADER LINE.
    DATA cnt_file TYPE epsf-epsfilsiz.
    DATA err_file TYPE epsf-epsfilsiz.
    START-OF-SELECTION.
      IF date IS INITIAL.
        date = sy-datum.
      ENDIF.
    *build pattern with input-pattern and date
      CONCATENATE pattern date '*' INTO pattern.
    *search for files in foreign system
      CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
           DESTINATION                   zid
           EXPORTING
                dir_name               = dir
                file_mask              = pattern
           IMPORTING
                file_counter           = cnt_file
                error_counter          = err_file
           TABLES
                dir_list               = dir_list
           EXCEPTIONS
                invalid_eps_subdir     = 1
                sapgparam_failed       = 2
                build_directory_failed = 3
                no_authorization       = 4
                read_directory_failed  = 5
                too_many_read_errors   = 6
                empty_directory_list   = 7
                OTHERS                 = 8.
      WRITE: / pattern.
      ULINE.
      LOOP AT dir_list.
        WRITE: / dir_list-name.
      ENDLOOP.
      ULINE.
      WRITE: / cnt_file.
      WRITE: / err_file.
    pls reward points for useful hints.
    thanks and
    regards Andreas

  • Dynamic file name using FTP adapter

    I was trying the dynamic filename scenario taking help from Michal's blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2664. [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    If I check the 'adapter specific properties' in both sender and receiver file adapter,then in output I am getting the output filename as same as input filename without using the UDF.
    When I used the UDF in mapping,it had absolutely no effect. I am not clear what is the use of the UDF. please let me know where to use the UDF and how to use it.
    Thanks
    Smith

    1. In the mapping program that you are using populate the filename coming from the source into the target in any of the fileds.
    2.Sender adapters can write adapter-specific attributes to the message header; these can then be evaluated at configuration time.You can get dynamic filename in UDF in msg mapping....just in ID in comm channel select adapter specific attributes -> filename.....then whatever dynamic name you will create in UDF will be the target filename.....
    3. To change the adapter-specific attributes of the message header by using message mappings, you access the <b>required classes of the mapping API by using a mapping runtime constant.</b>
    To access the classes DynamicConfiguration and DynamicConfigurationKey by using the mapping runtime constant DYNAMIC_CONFIGURATION, use the method getTransformationParameters() of the container object.
    You donot need to hard code the value of the filename in the file adapter for your interface.
    In SXMB_MONI, when you see the pipeline services you would see that the value of the filename is populated in the message payload.

  • Add Counter to File name when using Tran Protocol as FTP

    Hi There,
    Was wondering if there was any way to achive the same "Add Counter"  functionality used for File names in Reciever file adapter when we are using FTP as the transport protocol, this option is only provided in NFS,
    My requirement is ..
    Write files using counter on to ftp..
    say if three files already exists on the ftp server with names ...fname001, fname002 and fname003
    then the next time a file is written it should have a file name fname004 else fname001 if no file exists.
    Any help would be greatly appreciated

    No such standard functionality is available in communication channel...
    But you can try customizing ur scenario in one of the following ways...
    Case 1: If a field in source data carries the information regarding the sequence.
    You can map this value ( Directly .. or using some transformation ) in some temporary field in the target and then use a Variable substitution at the receiver communication channel.
    Case 2. If the source file name carries the sequence information. then you can enable the Adapter specific settings in the Sender communication channel , and then get the information of the source file name using the Container object in the mapping. Then assign the sequence number to a field in the target , use a Variable substitution at the receiver communication channel.
    Case 3 : If Case 1 and Case 2 are not applicable ... then you have to use a Ztable to store the sequence number , a function module to fetch the number , and then use a UDF in which you will implement the RFC call logic.Then the same process .... assign the sequence number to a field in the target , use a Variable substitution at the receiver communication channel.
    BR,
    Sushil.

  • 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

  • Selection of Folder/File name using the same Fun.Module

    Please let me know if there is a function module which can fetch folder name/File name  from the directory path when f4 option of selection screen field is selected. Currently I am able to get the file name using FM F4_DXFILENAME_4_DYNP but the requirment is like I have to select either folder name or the file name depending on user selection.
    Note: Please let me know if there is a single Function module which can get folder name or the file name based on the user selection.i.e, if the user want to select a folder he can select or he can select files in the folder for processing

    Hi sridhar
    try this:
    PARAMETER : TXT_FILE(100).
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR TXT_FILE.
    PERFORM GETFILE.
    start-of-selection.
    PERFORM GETDATA.
    FORM GETDATA.
      DATA : FILENAME TYPE STRING.
      FILENAME = TXT_FILE.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = FILENAME
         FILETYPE                       =  'ASC'
         HAS_FIELD_SEPARATOR           = 'X'
        HEADER_LENGTH                 = 0
        READ_BY_LINE                  = 'X'
        DAT_MODE                      = ' '
        CODEPAGE                      = ' '
        IGNORE_CERR                   = ABAP_TRUE
        REPLACEMENT                   = '#'
        CHECK_BOM                     = ' '
      IMPORTING
        FILELENGTH                    =
        HEADER                        =
        TABLES
          DATA_TAB                      = IT_UPLOAD
      EXCEPTIONS
        FILE_OPEN_ERROR               = 1
        FILE_READ_ERROR               = 2
        NO_BATCH                      = 3
        GUI_REFUSE_FILETRANSFER       = 4
        INVALID_TYPE                  = 5
        NO_AUTHORITY                  = 6
        UNKNOWN_ERROR                 = 7
        BAD_DATA_FORMAT               = 8
        HEADER_NOT_ALLOWED            = 9
        SEPARATOR_NOT_ALLOWED         = 10
        HEADER_TOO_LONG               = 11
        UNKNOWN_DP_ERROR              = 12
        ACCESS_DENIED                 = 13
        DP_OUT_OF_MEMORY              = 14
        DISK_FULL                     = 15
        DP_TIMEOUT                    = 16
        OTHERS                        = 17
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.
    FORM GETFILE.
      CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
        DEF_FILENAME           = ' '
         DEF_PATH               = '.'
        MASK                   = ' '
        MODE                   = ' '
        TITLE                  = ' '
       IMPORTING
         FILENAME               = TXT_FILE
        RC                     =
      EXCEPTIONS
        INV_WINSYS             = 1
        NO_BATCH               = 2
        SELECTION_CANCEL       = 3
        SELECTION_ERROR        = 4
        OTHERS                 = 5
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.
    <b>This is a part of my BDC program its working for me u try n reply if it works for u.</b>
    regards
    vijay

  • Dynamic File name in FTP Communication Channel

    Hi All,
    We have requirement where ,we create a filenames dynamically ( runtime).These filenames whihc do change for every execution needs to be added in FTP communication channel.
    1. How can we add the this generated file name in FTP CC Communication Channel.
    2. Does this file needs to part of target structure during graphical mapping ?
    3. Can we also dynamically append the Directory name to file names aswell ?
    Please provide your valuable sugestions.
    Thanks for your support.

    1. How can we add the this generated file name in FTP CC Communication Channel.
    3. Can we also dynamically append the Directory name to file names aswell ?
    to get the FileName:
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    To get the Directory:
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    Then append:
    key+key1
    And then in the CC select the Directory checkbox under the ASMA properties...
    2. Does this file needs to part of target structure during graphical mapping ?
    The file which is sent using the CC will have the FileName as configured in the UDF of the graphical mapping....and if i am not wrong then the target structure resembles the file (if there is no FCC done)....
    Regards,
    Abhishek.

  • Error in Rcvr File Adapter using FTP ?

    Hi @,
    I am getting the follwoing error while trying to put file in the folder thru Rcvr File Adapter using FTP and it is giving me following error :
    java.io.FileNotFoundException :(Permission Denied )
    I have verified the permissions on the folder and it is having write permissions.
    Please suggest Its urgent.
    REgards

    hi amit,
    can you
    1. check whether the access to FTP is Authenticated, if so provide the username and password
    2. try giving different file name at the receiver end
    3. try normal ftp commands to access the folder
    regards
    Ramesh P

  • How to rename the SharePoint Document Library existing file name using Web service

    Hi,
    How to rename the SharePoint Document Library existing file name using SharePoint Web service.
    Is it possible. How could i do it?
    Thanks & Regards
    Poomani Sankaran

    Hi,
    Lists.UpdateListItems Method
    would be helpful for your requirement.
    Here is a blog with code demo for your reference:
    http://blogs.msdn.com/b/knowledgecast/archive/2009/05/20/moss-using-the-list-web-service-to-rename-a-file.aspx
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • 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

  • Hoe to logical file name using "FILE" transcation

    I want to create a logical file name using  "FILE" transaction , i have file path '/xfer/OUT/IDD0230 ' that cureently hard coded in program but i want to avoid hard code .

    You need to go to FILE transction, create new entry.
    You need to specify Physical name i.e value hardcoded in your program
    and corresponding new Logical Path which enduser will be entering.
    In code u ned to decode Logical path to physical path as its actual path.
    Award points if helpful.
    Shital

  • Append file name using FileSelectPopup under Windows 7

    Hi,
    I saw the following thread for the same issue in Vista, just wanted to make sure that this issue has been fixed for Windows 7 also before I upgrade to the latest version.
    http://forums.ni.com/t5/LabWindows-CVI/Append-file-name-using-FileSelectPopup-under-Windows-VISTA/m-...
    Thanks,
    Karthik
    Solved!
    Go to Solution.

    Hi,
    I ran across that issue when I was running applications built under CVI 7.1.1 on Windows 7.  I can verify that rebuilding the application under CVI 2009 SP1 and later CVI 2010 fixed the issue.  So you should be ok.

  • How can we repeat specific page number of pdf file by using FDF Toolkit for Windows?

    how can we repeat specific page number of pdf file by using FDF Toolkit for Windows?

    let's say a registration form, there is only 1 full address provided in my registration pdf, but applicant could have more than 1 address, so i have to make it more flexible to extend the address page no matter how many addresses that applicant provided, i have use adobe acrobat pro to edit the form properties. but dont know how to extend/duplicate a page in felxible times.
    Please advise~ tks so much!!! George

  • Same file name using JMS adapter on sender side.

    Hi Friends,
    I got a requirement to capture file name using JMS adapter on the sender side.
    Can some one help me in resolving this issue.
    Regards,
    Jeevan.

    Hi ,
    You can use Dynamic Configuration in mapping.
    Create a UDF with input as file name and copy/paste this code
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //conf.removeAll();
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    //String filename= conf.get(key);
    conf.put(key, fileName);
    key= null;
    return fileName;
    Thanks.

  • SSIS 2008 - Sending file with dynamic name using FTP task

    Hi  - Thanks for taking a look -  (I'm very new to SSIS.)
    I'm trying to create an SSIS 2008 package that does the following:
    1) Execute a stored procedure on SQL.
    2) Download the results as a CSV file to a 'local' location.  The file name is set using a variable ("User::LocalFilePath") dynamically based on the current time:
    @[User::LocalFilePath] + "GreatReportName_" + "_" +(DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) + "_" + Right("0"
    + (DT_STR,4,1252) DatePart("d",getdate()),2) + "_" + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) +  "_" + Right("0" + (DT_STR,4,1252) DatePart("mi",getdate()),2)
    + "_" +  Right("0" + (DT_STR,4,1252) DatePart("ss",getdate()),2) + ".csv"
    3) Transfer the CSV file to an FTP site.
    4) Delete the CSV file from the 'local' location.
    I've been able to do steps 1 and 2 so far.  However when trying the move the newly created file to the FTP site I get the error:
    "Error: 0xC002917C at Send to FTP, FTP Task: The variable "User::LocalFilePath" doesn't contain file path(s)."
    (When I set the "IsLocalPathVariable" to "False" and use a file previously created the file is correctly transferred to the FTP site.  This proves that the FTP details are correct and that the "RemotePathVariabe" is working
    correctly.)
    I have set the variable ("User::LocalFilePath") to "EvaluateAsExpression" in the variable properties.
    Can anyone help?
    Many Thanks,
    UnoT

    Hi Vaibhav,
    Thanks for your response.  I set the "DelayValidation" to "True".  However
    that didn't make any difference.
    I added in all the breakpoints, but it didn't give any results (I may be doing this incorrectly?):
    Any other suggestions?
    Thanks,
    UnoT

Maybe you are looking for

  • What's wrong with my code? please help....

    when display button is clicked it must diplay the remarks but it didn't happen... what's wrong with my code? please help here is my code..... import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Area extends Applet impl

  • OneStep DVD from movie

    Hello.  I just upgraded my MacBook Pro and I am now running OS 10.9.1  I am using iDVD 7.1.2.  Whenever I try to make a OneStep DVD from movie and I select the movie from my desktop, iDVD crashes.  It starts the encoding and a few seconds into it, a

  • Printout of PR and Reservation

    Hi I wanted to check if we can take print of Purchase Requisition and Reservation as per standard SAP. If we can take can somebody let me know the TransactionCode for the same? Regards

  • To append leading zeros to a character field

    Hi,   can some body tell me how to append leading zeroes to a character field

  • Can't add my epson rx500 printer to OS 10.4, but it prints in classic

    When I added a driver for a wireless card, it told me to first reset permissions. Now OS X will not let me add my Epson rx 500 printer and I can not print from OS X. The printer does print from classic. What can I do?