MQ to File: How to send a Filename from JMS Header (MQ) to a File Adapter

Hello Experts,
I have a flat file coming into PI via JMS adapter (MQ) and going out on a File adapter (NFS). We would like to keep the file name consistence throughout the transaction. While coming from MQ our sender is sending the filename in one of the MQ Headers (JMSCorrelationID). We are trying to figure out how to read the file name from the MQ header and send it to the file adapter. Please let us know any other suggestions.
Thanks,
Mayur

Use this UDF code in MessageMapping.
try
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey KEY_JMSCorrID = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS","DCJMSCorrelationID");
DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(KEY_FILENAME, conf.get(KEY_JMSCorrID));
catch(Exception e){}
return a; //a is some input field.
Enable ASMA on receiver File channel.
Edited by: Praveen Gujjeti on Mar 17, 2010 9:23 AM

Similar Messages

  • How to acces the filename from Message Header during variable substitution

    Hi,
    We need to access the attribute filename from Message Header during Variable Substitution.We are able to access the following attributes of Message Header
    sender_party, sender_service, receiver_party, receiver_service, interface_name, interface_namespace,
    message_id (message ID with hyphens, for example 9fbe1ff1-9a0d-11d9-8665-cbf10a126331)
    message_id_hex (message ID in hexadecimal format, for example 9fbe1ff19a0d11d98665cbf10a126331)
    For example, if we want to specify the interface name from the message header in the target directory or in the file name scheme, we enter message:interface_name as the reference.
    In the same way i need to access the filename which we get in the Message Header(which we get in the Message Header when we check the Adaptor specific message properties and filename in sender CC).Any suggestions on the same
    Thanks and Regards,
    Bhargav
    Message was edited by:
            bhargav gundabolu
    Message was edited by:
            bhargav gundabolu

    Hi Bhargav,
    Use this UDF to retreive the file name from the Dynamic Configuration Payload in the mapping.
    getFileName(UDF) -
    > Filename(node in the target structure).
    public String getFileName(Container container)
       //write your code here
    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);
    return  ourSourceFileName; 
    Create a node in the target structure top hold the filename returned by the UDF.
    Now your payload will have the filename along with the actual data.
    U can use the variable substution now as u use for the other data in the payload since the filename is now a part of your payload.
    Regards
    San

  • How to send a 'filename' and a byte representation of a file

    Hey
    I have this very simpel program, the logic is.. Client sends a file to a server which stores the file... VERY SIMPEL!
    But what i wanna do is to send the filename as well, so the server can name the file dynamically based on the source file received
    My code looks like this now..
    Server code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package serverreceivefile;
    import java.io.*;
    import java.net.*;
    * @author Maul
    public class ServerReceiveFile {
         * @param args the command line arguments
        public static void main(String[] args) throws IOException {
            System.out.println("Server is starting../");
            //Create a server socket that listens for incoming connection
            //request on port 10000
            ServerSocket ss = new ServerSocket(10000);
            while(true){
             // Listen for incoming connection requests from client
             // programs, establish a connection, and return a Socket
             // object that represents this connection.
                Socket s = ss.accept();
                System.out.println("Accepting connection.../");
                // Start a thread to handle connection
                new ServerThread(s).start();
    class ServerThread extends Thread{
        private Socket s;
        ServerThread(Socket s){
            this.s = s;
        @Override
        public void run(){
            BufferedInputStream bs = null;
            BufferedOutputStream bos = null;
            try {
              // Create an input stream reader that chains to the socket's
              // byte-oriented input stream. The input stream reader
              // converts bytes read from the socket to characters. The
              // conversion is based on the platform's default character
              // set.
              bs = new BufferedInputStream(s.getInputStream());
              bos = new BufferedOutputStream(new FileOutputStream("filecopy.txt"));
              int i = 0;
              while((i = bs.read()) != -1){
                  bos.write(i);
              bs.close();
              bos.close();
              s.close();
              } catch (IOException ie){
            System.exit(0);
    }Client code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package serverclientsendfile;
    import java.io.*;
    import java.net.*;
    * @author Maul
    public class ServerClientSendFile {
         * @param args the command line arguments
        public static void main(String[] args) throws FileNotFoundException
            String host = "localhost";
            BufferedInputStream bis = new BufferedInputStream(new FileInputStream(
                    "file.txt"));
            Socket s = null;
            try {
                s = new Socket(InetAddress.getByName(host), 10000);
                // Create an input stream reader that chains to the socket's
                // byte-oriented input stream. The input stream reader
                // converts bytes read from the socket to characters. The
                // conversion is based on the platform's default character
                // set.
                BufferedOutputStream bos = new BufferedOutputStream(s.getOutputStream());
                int c;
                while((c = bis.read()) != -1){
                    bos.write(c);
                bis.close();
                bos.close();
            } catch (IOException ie){
    }As you can see the server 'hard codes' the filename of the received file from the client..

    Hi DJHingapus,
    If you don't want to build a dialog scenario between client and server, you may use a fixed length header which holds the name of the file to send. The stream will be composed with the header immediately followed by the binaries of the file.

  • How can i access filename from file (sender)

    hi All,
    can anybody tell me
    how can i access filename from file (sender)?
    thank u
    swari

    See:
    "SAP NetWeaver XI: Variable Substitution with Adapter-Specific Message Attributes via DynamicConfigurationBean"
    SAP NetWeaver XI: Variable Substitution with Adapter-Specific Message Attributes via DynamicConfigurationBean
    "Accessing Adapter-Specific Attributes through User Defined Function"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516

  • How to send the data from mac pc to External drive

    how to send the data from mac pc to External HDD
    or Pen Drive but with out deleting the preview as data

    You can use "Finder", which is in your dock, to copy files from your iMac folders over to the external hard drive.
    Hope this helps

  • How to send ENCRYPTED email from 10v2

    Helllo,
    How to send ENCRYPTED email from 10v2 to end users who will receive their emails from Microsoft Outlook?
    I created a stored procedure to change user passwords. I need to email the users their passwords but the email message has to be encrypted since it contains user passwords. How do I use util_mail to send encrypted messages? The users will pick up their passwords through Microsoft Outlook. Thank you in advance.

    not sure what is the mechanics of decrypting (PGP maybe?)
    I have few tips ...
    1. look at DBMS_CRYPTO package
    2. create JAVA stored procedure (I'm sure there are some good samples to use java for encryption) to encrypt the body (this can be executed from pl/sql)
    3. save the body as a file on unix and encrypt it with unix command (this can be executed from PL/SQL utilizing UTL_FILE and JAVA stored procedure)
    4. forget sending the password in email and save the password on Oracle Apex site and configure access using single sign-on with transparent windows authentication

  • How to send application acknowledgement from R/3 system

    Hi guys,
          How to send application acknowledgement from R/3 system. Ex. we have post one IDoc and check user validations. Suppose date is wrong that means indicate earlier or wrong date but date format is correct. In this situation we need send one acknowledment to sender.
    How to find the solution? pls tell anyone.
    Regards
    Vijay

    Hi Vijay,
    Plz do perform the following steps:
    1) In the Integration Server, call transaction SE38
    2) Run program IDX_ALEREQUEST to process IDocs with message type ALEAUD as XI request
    message.
    3) Now Enter Sender Port, Sender Client,Partner Number, Partner Type, and Partner Rol
    4) In Integration Directory, configure the routing of interface
    5) Call transaction SXMB_MONI to display the XI message.
    Also,
    Further in IDX5 as well you will find entry for IDoc ALEAUD.ALEAUD01
    Please go through the link
    1)Succesful IDOC acknowledgements from ECC
    2)https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/903a0abc-e56e-2910-51a8-9dc616df56eb
    3)https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f6d2d790-0201-0010-9382-b50b499b3fbe
    After you triggered the IDoc by e.g. tcode: WPMA and IDoc reached FILE system, FILE receiver CC actually is only able to send acknowledgment types SystemErrorAck and AckNotSupported.
    This is because:
    - IDoc sender adapter requests the following acknowledgments:
    SystemAckRequested="false"
    SystemErrorAckRequested="true"
    ApplicationAckRequested="true"
    ApplicationErrorAckRequested="true"
    - File receiver adapter “that run on the Adapter Engine support system acknowledgments and system error acknowledgments if they are requested by the sender. These acknowledgments are triggered when a message is successfully processed by the adapter or if an error occurs while it is being processed.”
    If you haven’t suppressed acknowledgments for IDocs WP_PLU in IDX_NOALE in XI then you will get:
    SystemErrorAck – when message has not reached the FILE system
    AckNotSupported – for all others acknowledgement types
    QQ) Will this IDOC Ack applicable for this scenario???
    Rather not, since FILE adapter does not support any other acknowledgements then system and IDoc adapter does not request other acknowledgements then application + SystemErrorAckRequested.
    In sender system your IDoc will be always in status 39 (instead of 03), when acknowledgement is turned on.
    This is because:
    For SystemErrorAck the corresponding ALEAUD status is 56
    For AckNotSupported the corresponding ALEAUD status is 50
    Both inbound 56 and 50 statuses end up in 39 for your outbound IDoc in sender system.
    Q1) Will this ALEAUD Idoc contains any Message from File System????
    In both cases, it will result in status 39 - IDoc is in the target system. So it does not matter.
    Q2) Basically what Information will contain this IDOC Ack.
    Idoc number from sender system and status 56 or 50 depends on acknowledgement type.
    Q3) Do we receive any Info from the Target File System , if we implement this Ack concept??
    Nothing useful.
    Remember that “File Receiver has no way to determine if the written file has been correctly processed by the back-end application”. However, if your “FILE” application can read your WP_PLU message and after successful processing is able to generate any kind of message then you can acknowledge the communications but you will not be able to link original message with the acknowledgement request message.
    To do that you need to configure just normal scenario (that will be your new acknowledgement scenario) FILE -> XI -> R/3. Your FILE service will send ALEUAUD Idoc to R/3 system. Your FILE application must take care to generate proper ALEAUD XML message. In order to treat ALEAUD as a request message (not standard acknowledgement) you need to run IDX_ALEREQUEST in SE38 on XI.
    Q1) It means if the Idoc not reached to Target File system means we can able to get the System Error Ack to Sender SAP R/3 System. Am i Right????
    Supposed you have turned off acks on XI (tcode: se38, IDX_NOALE) for your sender port/client:
    You have sent the IDoc and the last status is "03 - Data passed to port OK"
    You don't know whether it was even delivered to XI ...
    Supposed you have turned on acks on XI (tcode: se38, IDX_NOALE) for your sender port/client.
    1)
    You send and IDoc and it has been delivered successfully to FILE system.
    Adapter Engine creates acknowledgement type: AckNotSupported
    In XI you can see Ack Status: AckRequestNotSupported (Acknowledgement not possible). Category: permanent.
    XI will send ALEAUD IDoc to R/3 system: status "50 - IDoc is added"
    The IDoc status in sender will be "39 - IDoc is in receiving system (ALE service)".
    2)
    You send and IDoc and it has not been delivered successfully to FILE system. e.g. FILE server is down.
    Adapter Engine creates acknowledgement type: SystemErrorAck
    In XI you can see Ack Status: Error (Acknowledgement contains system errors). Category: transient.
    XI will send ALEAUD IDoc to R/3 system: status "56 - IDoc with errors is added"
    The IDoc status in sender will be "39 - IDoc is in receiving system (ALE service)".
    So status 39 means only that IDoc reached XI, but you don't know whether it was delivered to FILE system or not.
    Q2) And one more thing is Even though we are dealing with the IDOCFile OR FileIDOC we can able to get the ACk of Type System Error Ack only. Am I Right?????
    No, "Sender adapters of the Adapter Engine do not request any acknowledgements."
    Q3) So the same case( Which we disscused for IDOCFile) is Applicable for FileIDOC also????
    No.
    Can we able to get the System Error Ack, if the File is not reached to SAP R/3( Target here)
    No.
    Q4) If Yes to Q3 means,Where this System Error Ack will be seen in File System side???
    Do we need to do any extra settings to receive these System Error Ack at File system side??
    Not relevant.
    Regards,
    Vinod.

  • How can we read filenames from a specific folder

    Hi forum,
    I have a situation that, there are several files coming daily in a specific folder.
    I want to read filenames from that folder and want to get that filename in a variable.
    That filename contains account nos. which I need for further processing.
    Now, how can we read filenames from a specific folder with using Oracle PL/SQL Procedure?
    Please suggest.
    Thanks & regards,
    Kiran

    If you are on 10g (not sure which exact release I'm afraid) you might look at Chris Poole's XUTL_FINDFILES that lists the files in a directory using PL/SQL and DBMS_BACKUP_RESTORE.SEARCHFILES (all a bit undocumented as it seems to be provided as part of rman).
    The conventional (i.e. supported) approach is to use a Java stored procedure - there is an example on AskTom.
    Message was edited by:
    William Robertson

  • How to pass a filename to MQHRF2 header in IBM MQ using JMS Adapter in SAP PI

    Hi Expers,
    Can you please help on ...
    how to pass a filename to MQHRF2 header in IBM MQ using JMS Adapter in SAP PI
    Thanks,
    Chandar

    Hi Chandar,
    Could you check the following post Re: Inserting custom header fields inside MQRFH2 (JMS Receiver adapter)?
    I hope you find it useful.
    Regards!

  • I just downloaded Autocad to my downloads file, how do I take it from there to my Parallels Desktop without using "Windows Explorer"?

    I just downloaded Autocad to my downloads file, how do I take it from there to my Parallels Desktop without using "Windows Explorer"?

    Did you download it from Adobe or a pop up? If it was a pop up do not open it. Make sure you only get it directly from Adobe here:
    http://get.adobe.com/flashplayer/
    There is some malware that poses as Flash, in pop ups.
    Then do as macbig explained double click on the file,
    After you open and install the .dmg reboot your computer to complete the installation

  • How to send automatic EMail from SQL or SAP B1

    hi experts as we are using SQL as DB i ned to send E-mails from sap system automatically but from SBO mailer  or Scheduler is not working from my side now i was planning to send emails from SQL can any one help me how to send emails automatically from SAP business one or from SQL

    Hi
    In SQL under Management\Database Mail
    You can configure account you use to send mails from SQL
    Then you can prepare procedure that will send mail
    for example
    EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'Hurtpol',
    @recipients = '[email protected]',
    @query = 'select isnull(syncherror,'''')  collate polish_ci_as
    from np.dbo.OITM
    where U_SynchStatus=''Failed''',
    --@body = @tresc,
    @subject = 'synch error'
    read about sp_send_dbmail

  • How to send an email from ADF11g.

    Hi,
    How to send an email from ADF11g.can u give example code and send me any link.
    Regards
    AP

    perfect and simple way is to use the java mail api from apache
    very simple, easy to use, and handle all types of emails.
    http://commons.apache.org/email/userguide.html

  • How to send an email from a VI

    Hello..
         I want to know how to send an email from VI. I am using Labview 8.6 . I tried some examples also. But when I run those VIs, I getting errror. It is smtp server error. I dont have any idea about how to change smtp server settings. Can any body tell step by step procedure to accomplish this task.. 
    Further, I need send an attachment with this email... 
    Please help me
    Thanks
    Prashanth
    Solved!
    Go to Solution.

    Hello harold..
               thanks for sending VI. I tried it, but I am getting following error
    Error 1172 occurred at Error calling method System.Net.Mail.SmtpClient.Send of ObjectId handle: 0xCD21184 for obj 0x212E63[System.Net.Mail.SmtpClient] in domain [LabVIEW Domain for Run] and thread 280, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
        Inner Exception: System.Net.Mail.SmtpException: Failure sending mail.
        Inner Exception: System.Net.WebException: Unable to connect to the remote server
        Inner Exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
    ) in GmailLV86.vi
    How can I solve this problem..
    Please let me know.
    Thanks
    Prashanth

  • How to send group emails from ipad

    How to send group emails from ipad

    Thanks.  So matters haven't changed.  Ipad and iohone systems still not make use of the groups created in OSX Contacts, although one can "see" the groups synced through iCloud.  They just do not function as real distribution lists in Mail.
    With the Mailshot app, one creates Mailshot groups with Mailshot group name.  It's as smooth as a work around can get.
    Silly that Apple iOS folks never got around to connecting the contact groups now listed in iOS Contacts through iCloud syncing to also be fully functional in iOS Mail for the purpose of group emailing. 

  • How to send a video from  a macbook air to a tv with dnla

    how to send a video from  a macbook air to a tv with dnla ?without apple tv
    macbook air with os mountain lion
    thank you

    Do you have an Apple TV.  In which case AirPlay or if your Mac is too old, Eric Root's AirParrot suggestion.
    If no Apple TV, then a miniDisplay Port to HDMI adaptor and an HDMI cable  (a Thunderbolt to HDMI adaptor is really the same as a miniDisplay Port to HDMI adaptor).

Maybe you are looking for