Is it possible to add an attachment in an adapter module

Hi,
I'm trying to add an attachment to the main payload in a SOAP communication channel, like this:
XMLPayload extraInfoAsAttachment = new XMLPayloadImpl(); //com.sap.engine.interfaces.messaging.spi.XMLPayloadImpl
//XMLPayload extraInfoasAttach = msg.createXMLPayload(); //--> when trying with this it will also fail
try{
  String text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><testing>test</testing>";
  extraInfoAsAttach.setContentType("UTF-8");
  extraInfoAsAttach.setContent(text.getBytes());
  msg.addAttachment(extraInfoAsAttach); //provokes exception
} catch (Exception e){
  audit.addAuditLogEntry (key, AuditLogStatus.ERROR, "Failure when adding the attachment");
  audit.addAuditLogEntry (key, AuditLogStatus.ERROR, e.getMessage()); //--> writes UNDEFINED
  throw new ModuleException (e);
But it will fail in the catch block, with UNDEFINED message.
Ive found the same problem, unresolved, here: NullPointerException - Create New Attachment to Message Payload
Any tips? Thanks a lot.
Edited by: Jorge Lopez on Nov 17, 2009 3:49 PM

I have tested following for PI 7.0 and Xi 3.0:
public ModuleData process(ModuleContext moduleContext,
ModuleData inputModuleData)
throws ModuleException {
// create a second attachment for the receiver mail adapter
try {
// get the XI message from the environment
Message msg = (Message)
inputModuleData.getPrincipalData();
// create a new payload
TextPayload attachment = msg.createTextPayload();
// provide attributes and content for the new payload
attachment.setName("Attachment");
attachment.setContentType("text/plain");
attachment.setText("Hello World");
// add the new payload as attachment to the message
msg.addAttachment(attachment);
// provide the XI message for returning
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
// raise exception, when an error occurred
ModuleException me = new ModuleException(e);
throw me;
// return XI message
return inputModuleData;

Similar Messages

  • IS IT POSSIBLE TO ADD MULTIPLE ATTACHEMENTS?

    WHEN EMAILING ON IPAD, IS IT POSSIBLE TO ADD MORE THAN ONE ATTACHMENT? TWO OR MORE DOCUMENTS ON ONE EMAIL?

    The iPad requires you first to define the object you want to email and then open a send-mail page. Thus, natively you can only send one attachment. I looked at the app store and Mail2List allow sending up to six photos at once. AceMail allows sending multiple audio files and photos. I could not find anything to send more than one document.
    Also, please do not use all caps.

  • Remove Attachment in Mail Adapter Module

    Hi!
    My problem: I get an email with an attachment which I process in an adapter module for the mail adapter. With the resulting XML I set a new payload, but the old attachment still exists.
    This gets to a problem when I route the message back to the mail adapter, he adds the old attachment to the generated email. Therefore the new email has two attachments: the old one and the new one, which should only be one attachment: only the new one.
    How can I remove the old attachment? I found no function which solves this problem.
    Best regards,
    Daniel

    Hi Michal,
    thanks for the link.
    When I import aii_proxy_xirt.jar in my NWDS, I can import the MessageSpecifier class. But I can't get an instance of it from the classes which I can access.
    The only 'documented' usages of this class I found were codings for java proxies, so I'm not sure we can use this class in an adapter module.
    In this cases they get the MessageSpecifier instance from the proxy bean, so maybe we can get it from the EJB, but this doesn't work with an adapter module (or I haven't found out how )
    Hmm. It is a simple problem, but it seems difficult to solve
    Best regards,
    Daniel
    Message was edited by: Daniel Himmel

  • Is it possible to add other templates to the print module?

    If so, how? And is it possible to make a "package." In other words a template with multiple pages.
    For instance drop in one image and have it auto populate say 1 8x10 2 5x7 4 4x6 and 16 wallets on 81/2" x 11" sheets.
    Would be really great if you didn't have to leave Lightroom to print basic school packages.
    Thanks,
    Drew

    Thanks for the info. Just wanted to make sure I wasn't missing something.
    It would work for me if it didn't mix and match on a page. But, it would need to be able to have a "package" of multiple pages. Just something basic. Not looking for a full fledged program or rip.

  • Is it possible to add a field in Attachment screen?

    Hello Exports,
    I wan to know is it possible to add a  customer field in Attachment screen (Project, RFx,MA, A) . As there are a lots of attachments added in normal working in various documents like project,MA,RFX etc, so whether can add a field  to categorize the attachment like it is project added attachments or RFx add attachment?
    Would appreciate your comments.
    Thanks & Regards,
    David

    Hello,
    On a transfer, the accounting treatment is different when the move is within the same division VS when it goes to another division. 
    When plant 1101 ships to plant 1102, we donu2019t want to post to account 360100.  When plant 1101 ships to plant 1301, we do want to post to 360100.  Having the receiving profit center group in the mix will enable this distinction.
    Thanks in advance

  • Is it possible to add markups to a PDF that I am not the author of

    Most of the PDFs I generate are from other applications (like Autocad) where I "print to PDF" to create the file.   Most of the PDFs I recevie are generated the same way.   Prior to Acrobat Reader 8, it was simple for me and my collueges to exchange information on these PDFs by using markup tools and resending them with markups.   Since Acrobat 8 has come along, I now find it impossible to markup a drawing (no matter if I have created it using Print to PDF or if someone has sent it to me).  I went to the knowledge base and see that the drawing has to be enabled for markup in one of 2 ways
    In an open PDF, choose Comments > Enable For Commenting In Adobe Reader, and then save the PDF.  
    Start the wizard to initiate a shared review or an email-based review and follow the on-screen instructions. When you’re finished, commenting is enabled in the PDF that you specify for the review. 
    Well, there is no Comments selection in my toolbar.   Second method is given by
    Quickstart: Start an email review
    An email-based review lets you track review status and merge received comments into the PDF.
    Click Review & Comment and choose Attach For Email Review.
    If prompted, enter your identity information to create a reviewer profile.
    Follow the on-screen instructions to select the PDF, invite reviewers, and send the email invitation.
      If your email application doesn’t send email automatically, you may need to answer alert messages and switch to your email application to finish sending the message
    But there is no Review & Comment button to click.
    So, can someone tell me, can I still do a simple markup of any PDF?   Even if I have to jump through hoops can I?    I guess I can understand Why Adobe has done away with this feature in their free tool, as they were not getting any revenue off of it, but it greatly diminishes the usefulness of Acrobat Reader and therefore all PDFs for me.
    Thanks in advance for your response.

    To enable this right you need Acrobat, not the free Reader.
    However, starting from Reader X it is possible to add simple markups to any file, unless it has been specifically disallowed by the creator of the file.

  • Is it possible to have an attachment within a pdf doc print at the same time the main doc prints?

    Okay, so this may be kind of a weird question.  We have some users who are wanting to add a page to an already existing xml document and correct me if I'm wrong, but I've read that it's not possible to add/delete pages from a pdf that's in xml format.  Since that is not possible, I have added the page to the xml document as an attachment.  Now what I am wanting to know is if it is possible to have the attachment print out at the same time as the main document.  We are using the latest version of Adobe Reader and I have access to Adobe Acrobat Standard 9 & 10 and then I have access to Adobe Acrobat Pro 7.  I've been unable to find anyting via google or by searching this forum so hopefully I'll draw out some kind of smart cookies and we'll get this figured out.  I appreciate any and all input!
    Thanks,

    I know of no way to do this with Reader or XML.

  • Is it possible to add files to a PDF form submission?

    Hi there,
    Someone asked me to add an attachment field to a PDF dynamic form. Based on previous research we figured out that will not be possible: our users don't have Acrobat - just Reader - and we won't purchase Reader Extensions. How about using a form field to help the user send the attachments that a are required with that give form? For instance:
    - User would fill in the form and when asked for attachments he/she would browse for the file.
    - The form would save the file name as text on the form (like the answer for a text field)
    - The PDF form would memorize the location of the file(s)
    - When the user hits "Submit" the PDF form would gather the files listed for attachment and add them as attachments - in additon to itself - to the email created by the submission button.
    That way the attachments are not saved as part of the PDF form, but the PDF form is automating the process of adding them to the submission email.
    Is that doable with LiveCycle Designer? Any tips on how to go about coding/building those actions?
    Thanks in advance,
    AV

    If your user is using Adobe Reader and wants to add an attachment to your PDF file... you need Adobe LiveCycle Designer Reader Extensions to do that...
    If your user is using Adobe Acrobat Pro then u can add attachments with this
    var myDoc = event.target;
    var sFile = "myFile" + NumericField1.rawValue;
    myDoc.importDataObject({cName: sFile});
    var myDataObject = myDoc.getDataObject(sFile); 
    var sFileName = myDataObject.path; 
    ListBox1.addItem(sFileName,sFile); 
    NumericField1.rawValue = NumericField1.rawValue + 1;
    you can also remove the file
    myDoc.removeDataObject(sFile);
    you can also open the file
    myDoc.exportDataObject({ cName: sFile, nLaunch: 2 });

  • Is it possible to add a graphics card to the back of my HP

    Hello  I want to know if it's possible to add a new graphics card to the back of a Laptop not inside of it but on the back of my laptop ???  my graphics Card is a Intel 4000 graphics card is a terrible for gaming TERRIBLE !!!  

    Not sure where it would go on the back, but no the system is closed. There is no place to insert a graphics card or attach it. You will find some hokey stuff on the internet where people say you can plug a video card in the wireless card slot but those are a hoax at worst and at best they do not tell you that such a thing would not even perform as well as what you have and is likely to damage the motherboard. 

  • Is it possible to add more input values for a payroll element?

    Hi All
    I have created an element with 1 default input value 'pay value' and another input value '1xx1'. I have linked this to payroll and attached to many employees. Now due to business requirment, I need to add one more input value '2yy2' and also I need to change the formula. Eventhough its a minor change in formula, without a new input value it will not work. I tried to add a new one by datetracking to the element creation date without sucess.
    Is it possible to add input values after saving an element?
    Regards
    Rahman

    You can Change the Required Input Value to Not-required
    Alter the Sequence of the Input Value to be displayed in the Element Entry Screen
    You can Change the Input Value Validation Rule minimum, Maximum, Lookup and Formula
    Change your specification of which input values create Database Items. Note, however, you cannot remove Database Items if they are used in any formulas or QuickPaint reports.
    You cannot remove existing input values or add new one if you have created any entries for the element
    For more details you can refer http://ramesh-oraclehrms.blogspot.com/2007/08/maintaining-element.html

  • Is it possible to add a barcode image generator API on HTMLDB that support

    Hi All,
    Currently we create Barcodes images using a Java solution - open source API called Barbeque.barcode.servlet. Is it possible to add a barcode image generator API on HTMLDB that support multiple formats?
    Our current process:
    All jobs created in our system require a barcode which is then printed onto a cover sheet for each job (refer example). We also currently have individual barcodes printed on a single feed barcode printer for attaching to jobs sheets. We also print A4 sheets of barcodes with the Field Technican id number on that we sent out to them.
    Thanks in advacne
    Manoj

    It certainly is possible to call Java from PL/SQL and so therefore from APEX.
    The process is fairly well documented online and there's a well cited example of calling Apache FOP within these forums.
    You may however need to do a little work to wrap your Java library using static methods in order to do this.
    Regards
    Ben

  • Is it possible to send xls attach in mail in background ?

    is it possible to send xls attach in mail in background ?
    i build/copy program to send attach file in xls format  ,
    its work fine in foreground but do nothing in background  ,
    What can be the reason?
    the section of the sending  :
      DATA: LD_ERROR    TYPE SY-SUBRC,
            LD_RECIEVER TYPE SY-SUBRC,
            LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
            LD_EMAIL LIKE  SOMLRECI1-RECEIVER,
            LD_FORMAT TYPE  SO_OBJ_TP ,
            LD_ATTDESCRIPTION TYPE  SO_OBJ_NAM ,
            LD_ATTFILENAME TYPE  SO_OBJ_DES ,
            LD_SENDER_ADDRESS LIKE  SOEXTRECI1-RECEIVER,
            LD_SENDER_ADDRESS_TYPE LIKE  SOEXTRECI1-ADR_TYP,
            LD_RECEIVER LIKE  SY-SUBRC.
      LD_EMAIL   = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT              = P_FORMAT.
      LD_ATTDESCRIPTION      = P_ATTDESCRIPTION.
      LD_ATTFILENAME         = P_FILENAME.
      LD_SENDER_ADDRESS      = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME  = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU  = SY-LANGU.
      W_DOC_DATA-OBJ_NAME   = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR  = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_ATTACH[].
    Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM   = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE   =  LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR  =  LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME   =  LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE   =  T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = LD_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
    T_RECEIVERS-NOTIF_DEL = 'X'.
    T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_RECEIVERS
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
    Populate zerror return code
      LD_ERROR = SY-SUBRC.
    Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.

    Try this example, not sure where I got this, but it works.
    report zmail_excel.
    parameters: p_email   type somlreci1-receiver
                                   default '[email protected]'.
    data: begin of it001 occurs 0,
          bukrs type t001-bukrs,
          butxt type t001-butxt,
          end of it001.
    data:   imessage type standard table of solisti1 with header line,
            iattach type standard table of solisti1 with header line,
            ipacking_list like sopcklsti1 occurs 0 with header line,
            ireceivers like somlreci1 occurs 0 with header line,
            iattachment like solisti1 occurs 0 with header line.
    start-of-selection.
      select bukrs butxt into table it001 from t001.
    *   Populate table with detaisl to be entered into .xls file
      perform build_xls_data .
    * Populate message body text
      clear imessage.   refresh imessage.
      imessage = 'Please find attached excel file'.
      append imessage.
    * Send file by email as .xls speadsheet
      perform send_email_with_xls tables imessage
                                          iattach
                                    using p_email
                                          'Example Excel Attachment'
                                          'XLS'
                                          'TestFileName'
                                          'CompanyCodes'.
    *      Form  BUILD_XLS_DATA
    form build_xls_data .
      constants: con_cret type x value '0D',  "OK for non Unicode
                 con_tab type x value '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    *    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    *    con_cret type c value cl_abap_char_utilities=>CR_LF.
      concatenate 'BUKRS' 'BUTXT'
             into iattach separated by con_tab.
      concatenate con_cret iattach into iattach.
      append  iattach.
      loop at it001.
        concatenate it001-bukrs it001-butxt
               into iattach separated by con_tab.
        concatenate con_cret iattach  into iattach.
        append  iattach.
      endloop.
    endform.
    *      Form  SEND_EMAIL_WITH_XLS
    form send_email_with_xls tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription.
      data: xdocdata like sodocchgi1,
            xcnt type i.
    * Fill the document data.
      xdocdata-doc_size = 1.
    * Populate the subject/generic message attributes
      xdocdata-obj_langu = sy-langu.
      xdocdata-obj_name  = 'SAPRPT'.
      xdocdata-obj_descr = p_mtitle .
    * Fill the document data and get size of attachment
      clear xdocdata.
      read table iattach index xcnt.
      xdocdata-doc_size =
         ( xcnt - 1 ) * 255 + strlen( iattach ).
      xdocdata-obj_langu  = sy-langu.
      xdocdata-obj_name   = 'SAPRPT'.
      xdocdata-obj_descr  = p_mtitle.
      clear iattachment.  refresh iattachment.
      iattachment[] = pit_attach[].
    * Describe the body of the message
      clear ipacking_list.  refresh ipacking_list.
      ipacking_list-transf_bin = space.
      ipacking_list-head_start = 1.
      ipacking_list-head_num = 0.
      ipacking_list-body_start = 1.
      describe table imessage lines ipacking_list-body_num.
      ipacking_list-doc_type = 'RAW'.
      append ipacking_list.
    * Create attachment notification
      ipacking_list-transf_bin = 'X'.
      ipacking_list-head_start = 1.
      ipacking_list-head_num   = 1.
      ipacking_list-body_start = 1.
      describe table iattachment lines ipacking_list-body_num.
      ipacking_list-doc_type   =  p_format.
      ipacking_list-obj_descr  =  p_attdescription.
      ipacking_list-obj_name   =  p_filename.
      ipacking_list-doc_size   =  ipacking_list-body_num * 255.
      append ipacking_list.
    * Add the recipients email address
      clear ireceivers.  refresh ireceivers.
      ireceivers-receiver = p_email.
      ireceivers-rec_type = 'U'.
      ireceivers-com_type = 'INT'.
      ireceivers-notif_del = 'X'.
      ireceivers-notif_ndel = 'X'.
      append ireceivers.
      call function 'SO_DOCUMENT_SEND_API1'
           exporting
                document_data              = xdocdata
                put_in_outbox              = 'X'
                commit_work                = 'X'
           tables
                packing_list               = ipacking_list
                contents_bin               = iattachment
                contents_txt               = imessage
                receivers                  = ireceivers
           exceptions
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                others                     = 8.
    endform.
    Regards,
    Rich Heilman

  • Is it possible to add a url/href to the MM_swapImage funtion?

    I have a bit of code I created in Dreamweaver CS3 about 3 years ago that I am revisiting/updating. It has a simple html picture gallery that uses the MM_swapImage function with the onclick command. Basically, there are a few thumbnails with a larger picture on the left. When a thumbnail is clicked, the larger image on the left changes. I'd love to add a link to the new larger image, but I can't think of a way to make this possible using this code. It isn't too important but if anyone has any ideas, I'd love to hear them.
    Here is the code:
    HEADER:
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    BODY:
    <img src="../images/THUMBNAIL.jpg" width="73" height="98" title="TITLE" onclick="MM_swapImage('li1','','../images/NEW_IMAGE.jpg',1)" />
    In that code, the 'li1' is the image that gets replaced and the 'NEW_IMAGE.jpg' is the one I'd like to have a url/href attached to.

    Also, and I'd imagine the technique would be similar, would it be possible to add a title attribute to the new image?

  • Is it possible to add a new field in Block/Unblock vendor screen?

    Hi Experts,
    Kindly any one advise is it possible to add new field in xk05 screen as shown in the attached screen.If possibe,please advise the possible steps
    to add this new field.
    Thanks & Regards,
    Anusha

    Hi Pavan,
    Thank you for your reply.I have searched for user exits there is no screen exit of xk05 and I put a break point in CL_EXITHANDLER method and I found VENDOR_FIELDSTATUS BADI only for this screen.So,there is no BADI or user exit to add a new field to this screen.So,how to add
    a new comment field to this XK05 screen.
    Rgds,
    Anusha

  • Is it possible to add tooltip when using REUSE_ALV_GRID_DISPLAY

    All,
    Is it possible to add tool-tip when using REUSE_ALV_GRID_DISPLAY. I am using
    i_fieldcat_alv  TYPE slis_t_fieldcat_alv.
    slis_t_fieldcat_alv does not have a tool tip option.
    Your earlier response is much appreciated.
    Regards
    Kasi

    Looks like it is NOT possible to add our own text for tooltip when using REUSE_ALV_GRID_DISPLAY.
    See attached thread
    Re: quickinfo in ALV

Maybe you are looking for