Problem:obtaing file name using Dynamic configuration of file adapter

hi all
I am using Dynamic configuration for getting file name.
I am getting Dynamic configuration in SXMB_MONI containg file name, but payload is empty unlike file i am sending.

Hi All,
Basically my requirement to get Filename in idoc segments in order to validate the posting at month end.
Its an File to idoc scenario- GL Posting.
Please check attached UDF and it gives error. Kindly help. Thanks

Similar Messages

  • Target file name using Dynamic Configuration

    Hi,
    Currently we have requirement Idoc to File interface.In this scenario if one field exists infile then we have to check and we need to create update directory and  if it is not exist then we should create one more  directory and upload files over there there files should create with timestamp. Since,File system using Sql database so we have used JDBC lookup to check that particaluar field  and if it exists we are passing update to UDF if it is not then we are passing constant Create to that. If we use Adapter Specific Message Attributes  then in reciever side file Communication Channel addtimestap will it consider or do we have to write anything in Udf it self? Could anybody explain on this?Please provide some sample udf .
    Thanks ,
    Aparna.
    Edited by: aparna_karnam on Dec 24, 2011 11:44 AM
    Edited by: aparna_karnam on Dec 24, 2011 11:52 AM

    Hi,   
            I have added little changes to the code you have written, to meet your expectations
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    conf.put(key,"/sap-dev/" +a);
    DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
    string filename=conf1.get(key1);
    final String DATE_FORMAT_NOW = "dd-MM-yyyy_HH-mm-ss";
    String s;
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT_NOW);
    java.util.Calendar cal = java.util.Calendar.getInstance();
    s=sdf.format(cal.getTime());
    filename=a+" "+"User_"+s+".txt";
    conf1.put(key1,filename);
    return " ";
    So if value of input variable "a" is "update" then the target directory will be "/sap-dev/update" and the file formed will have name "update User_26-12-2011_01-20-50.txt", of course the date and time values will change depending on server settings. I just showed a sample. one more point, the directory will not be created, you have to create the directories before you run the scenario, only the final directory will be decided depending on value of variable "a". In case you wanna create new directory if directory is not pre-existing then try ticking  on "Create Target Directory" option under "file access parameters" in communication channel. (I have never used this option u can have a try. )
    Now coming to your queries
    1. But whether file type txt automatically it will take or do we have to give in udf it self ?
    ans) You have to put the value in UDF as I have done in code.
    2.    how it will consider timestamp ?
    ans) This has been generated in UDF itself.
    3.  how i can give file extension .txt?
    ans) same as ans 1
    4. And also in Receiver Communication Channel under Adapter Specific Message attributes we have option of file type how it works?
    ans) File type determines is the file you are going to write is of type "text" or "binary". From "Processing Parameters" tab you can select this from drop down menu in communication channel or you can set it through ASMA properties in similar manner as you have done for file name and directory name. For more details refer to http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6830e67f2a6d12e10000000a1553f6/content.htm
    Finally few more points I would like to add
    1) you have  not mentioned the operating system of the server where file is going to form. In case its UNIX/LINUX you are not allowed to use space in the filename. you can consult these links before you decide on file name and directory name in the UDF mentioned above
    http://www.med.nyu.edu/rcr/rcr/nyu_vms/unixfileanddirectorynames.htm     (UNIX)
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#naming_conventions  (WINDOWS)
    2) you can alter the string "DATE_FORMAT_NOW" as per your requirement so  that the timestamp appears in the way you want. I have just showed a sample.
    3) Plesae do not forget to tick on the options "Use Adapter-Specific Message Attributes indicator", "Fail If Adapter-Specific Message Attributes Missing", indicators "File Name" and "Directory" under "Define Adapter-Specific Message Attributes." in receiver communication channel.
    Hope this solves your problem.
    Wish my dear forum members and users of SDN
    Merry Christmas and Happy new year (in advance)
    Regards
    Anupam
    N.B:- I initially forgot to add the ".txt" part to the file name. I made necessary corrections in code now.

  • Getting file directory using dynamic configuration:Code needed

    Hi,
    I need the code for getting the source file directory name using dynamic configuration. Also, an explanation on how it can be used in mapping for comparison.
    Thanks,
    Vishal

    Hi Vishal,
      Refer  carefully the following blog by micheal to get the  Attributes dynamically during runtime by enabling the Adapter Specific message Attributes in adapter level.
      /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Create an UDF in mapping with no input parameters to it and include the piece of code and use it according to your requirement in mapping.
    //write your code here
    try{
    String filedirectory    = "";
    DynamicConfiguration conf1 = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","Directory");
    filedirectory = conf1.get(key1);
    return filedirectory;
    catch(Exception e)
         String exception = e.toString();
          return exception;
    Thanks,
    Ram.

  • Give me full details of Dynamic Configuration for file

    Hi all,
    please provide details of Dynamic Configuraion for file.
    Thanks and regards
    sai

    Hi,
      Refer the below weblog
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 - The same filename from a sender to a receiver file adapter - SP14
    And <b>check for the Communication channel settings how to do for Sender & Receiver File channels</b>, Dynamic configuration Code is also available in the weblog.The same code you can use in your UDF and map the output of your udf to one of u r target field.
    By following this you can able to set the receiver file name as same is of your file name of Source.
    Hope it will helps to solve u r problem.
    Cheers
    Veera

  • UDF Using Dynamic Configuration for Counter Reset

    Hi All,
    In an Idoc to file scenario we want to have counter option at the end of the file.we are using NFS so that we wil not face any problem of counter reset on a j2ee restart
    But when the counter turns 999999 it has to be reset to 0000001
    So we are trying to dynamically create a file name using the counter and check whether it has reached 999999 then resetting back . I had written a code for the same but it is throwing an error while mapping and activating.
    UDF CODE is below
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION) ;
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName") ;
    String FileName = conf.get(key) ;
    int inc = 1 ;
    String temp = FileName.substring(10,6);
    String temp1 = FileName.substring(0,10);
    Integer seqNo = Integer.parseInt(temp) ;
    if(seqNo == 0 || seqNo == 999999) {
    seqNo = new Integer(inc) ;
    else {
    int num = seqNo.intValue() + inc ;
    seqNo = new Integer(num) ;
    container.setParameter("seqNo", seqNo);
    String File_Name = temp1 + Integer.toString(seqNo);
    conf.put(key, File_Name);
    return File_Name;
    ERROR it is throwing
    'class' or 'interface' expected public String Decimal$(String Sample,Container container){ ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpath_resolver/Map76d12330b43811df8c1500e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_TRGT_.java:127: 'class' or 'interface' expected }
    So can anyone please advice.

    Hi Stefan,
    I removed the last }
    But stil it is throwing the below error:
    Activation of the change list canceled Check result for Message Mapping MM_Sample_to_Trgt | :  Starting compilation  Source code has syntax error:  /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpath_resolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:98: FileName is already defined in File$(java.lang.String,com.sap.aii.mappingtool.tf3.rt.Container) String FileName = conf.get(key) ; ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:102: incompatible types found : int required: java.lang.Integer Integer seqNo = Integer.parseInt(temp) ; ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:103: operator == cannot be applied to java.lang.Integer,int if(seqNo == 0 || seqNo == 999999) { ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:103: operator == cannot be applied to java.lang.Integer,int if(seqNo == 0 || seqNo == 999999) { ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:111: cannot resolve symbol symbol : method toString (java.lang.Integer) location: class java.lang.Integer String FileName = temp1 + Integer.toString(seqNo);
    Edited by: mallavarapu soundarya on Aug 30, 2010 4:44 PM

  • Change Directory Path using Dynamic Configuration

    Hi,
    We have a requirement where the directory path for placing the files is different across our different environments. Ex: Development Environment has a different path than the Quality Enviornmnet. Also the full path is depending on fileds within the message.
    I want to use Dynamic Configuration to create the Directory path. But in order to capture the full requirement I need to know wheich environment I am within the User Defined Function.
    Can someone provide me the java class and function that I can use in my UDF to read the environment I am in.
    ( Essentially I want to read Sy-SYSID in ABAP...using Java. )
    Regards,
    Arunava

    Hi Arunva,
    >>Essentially I want to read Sy-SYSID in ABAP...using Java.
    It might not be possible to read system id in java, but you can read the sender or receiver service(SENDER_SERVICE or RECEIVER_SERVICE) and based on it can decide the diretory in DynamicConfiguration.
    If you have a sender or receiver SAP sysem then better to read its name because this business systm ill haeunique name aross different environment. Check this thread too
    User-defined function: RFC call
    Regards
    Suraj

  • 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.

  • Dynamic File Name depending on the Source File name

    Hi Experts,
    I have a problem like Dynamic File name depending on the Source File Name. I will explain with example as follwos
    Source File name                 Targer Folder/Filename
    NK01.VR59.L2007030         VR59/Rec.l200
    NK01.VR71.L2017030         VR71/Rec.l201
    NK01.VR77.L2027030         VR77/Rec.l202
    See above the exaple, Depending on the Source file name, I am deciding where i need to place my file and what name i need to name it.
    So please suggest me the solution and How can i do this with a single communication channel ? Do i need to create multiple CC for each folder??
    Points will be rewarded for Valuable anwer.
    Thanks in Advance,
    Best Regads,
    Vijay

    Hi VIjay,
    Thanks for quick reply. But i am getting error in End to End Scenarios only. If i remove the Return " "  statement from the UDF, while activating it is showing the error saying like missing return statement. I also mapped to the top most node to this UDF.
    I am getting the following error in End to End error Scenarios:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_MM_Target_File_determined_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>During the application mapping com/sap/xi/tf/_MM_Target_File_determined_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>

  • Dynamic Configuration of File Adapter

    Hi,
    XI Version 3.0 SP13, Planning to upgrade to SP14
    In my scenario I need to pick up files from 4 static locations and based on the file name and pick up type(file/ftp) I can find out the destination's connectivity information from a Cross-Referencing table(Based on MS-SQL Database table- I can get this using look API) in this table we maintaining more than 100 destinations(host/user_name/password etc).
    Now I need to set the connectivity information dynamically at runtime. I know this is not possible with Standard XI but does anyone thinks this is possible by any technical way using with XI.. Adapter Modules or Java Proxies?
    This is very Critical to win the war with other inhouse middleware tools. Please let me know your thoughts and comments...
    thanks,
    Laxman Molugu

    Laxman,
    Go through this url's. They might be handy for you:
    Dynamic filename in XI
    Dynamic  File Name for Receiver File Adapter
    ---Mohan

  • System date in file name for Sender Configuration

    Hi all,
    I need to retrieve some files every day from my source directory, using the system date as a mask for the filename. Is it possible to do any kind of dynamic configuration for Sender Adapter? I only need to read the files with the current system date every day.
    Thanks in advance.

    Hi,
    ><i>
    only need to read the files with the current system date every day.</i>
    Sorry failed to see this.
    Not currently possible without workarounds in XI.
    1. Use a Staging folder where the senduing system will put the files. Write a shell script which will move only the current date files to the folder on which XI is polling. Here , you can use wild card characters.
    2. Module option , not sure how it will work. You will be doing an I?O inside the module code and this is not recommended. Also, what will be the trigger for your interface if you are planning to use a module to read the files on the basis of System Date.
    Regards
    Bhavesh

  • CS 4 Dynamic Link to Encore doesn't work most of the time.  Encore stops operating after opening and periodically Premier Pro stops working.  I'm told that there has been a problem with CS4 when using Dynamic Link to go to Encore and build CD's.  Is there

    CS 4 Dynamic Link to Encore doesn't work most of the time.  Encore stops operating after opening and periodically Premier Pro stops working.  I'm told that there has been a problem with CS4 when using Dynamic Link to go to Encore and build CD's.  Is there a way around this?  Is there a patch to correct it?

    To build CD's???
    What problem does Encore have with DL?
    If DL is not working properly for you the way around this is to export from Premiere to either mpeg2-dvd for DVD or BluRay H.264 for BD-disks and import the files in Encore.

  • 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

  • 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

  • Same file name from sender to receiver file adapter with out using UDF

    Hi All,
    I am working on FILE TO FILE. My requirement is same file name from sender to receiver file adapter. Is it possible to do using only Adapter Specific message properties?  i mean with out using UDF.
    Thanks
    Karthik

    Hi,
    >>>Is it possible to do using only Adapter Specific message properties?
    yes
    just enable Adapter Specific message properties in sender and receiver channel for file name
    and you're done
    Regards,
    Michal Krawczyk

  • 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

Maybe you are looking for

  • Blue screen, no workaround

    My Macbook Pro was hanging so I needed to reboot it. It reboots, passes the gray screen and stay in the blue screen where I see nothing. I did all I could: * Boot verbose, works fine * Boot single, works fine * ran hardware tests, also extended one,

  • Question about  command in getway installation and configuration for sybase

    what is the mean of this command isql -Urecovery_account -Precovery_account_password [-Sserver] -idg4sybs_tx.sql what is isql

  • Connect by HTTP-Post

    Hi, am i correct if i think that it is not possible to connect to rwservlet via http-post, only http-get. And that is the reason i get REP-56048 when i try it? Thanks. Regards Chris

  • Which address components country specific Address Cleanse Engine validates

    Hi, I am looking for a list of address components which are validated by a country specific Address Cleanse Engine. Data Services Reference Guide does not go into such details. I have a list of countries and need to identify if selected Address Clean

  • Passing Screen fields to Internal table

    Hi Friends, Here requirement is Palm oil plant details they want to update with Module Pool Program. The Module Pool contains only four fields. 1.Block 2.editable field 3.editable field 4.editable field. Let say for Block B1 , they want key in remain