Skip to Content
avatar image
Former Member

Mail Sender to Abap Proxy Receiver with Attachements

Hi All,

Scenario: I need to create a ticket in Solman from a mail. I intend to do the scenario as Mail sender to Abap Proxy receiver asynchronous.

I have configured my sender mail adapter and am able to get the mails in XI. The attachements also appear in Inbound payload as MailAttachement-1, MailAttachement-2 etc. I have checked use mail packege and keep attachements in sender adapter.

Transport Protocol: IMAP4

Message Protocol: XIPAYLOAD

Queries:

1. My Inbound Data Type is the mail Package -- ximail30_xsd. Here in sxmb_moni I can see the mail attributes like from, to and the mail body in content. But How can I read the attachements in my message mapping.

2. How can I pass these attachements to Abap Proxy ( I do not need to alter attachments only pass to proxy ). These attachements have to be attached to the Solman ticket in SOLMAN server.

Appreciate your kind response to my above queries.

Thanks.

Regards,

Siddhesh S.Tawate

PS: I have tried using PayloadSwapBean in adapter module but still the content at source remains same.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jul 24, 2009 at 08:39 AM

    you can just pass the attachments to abap proxy.

    have a look into this blog on how attachments can be handled with abap proxy - /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vijay,

      I have a receiver Abap Proxy. My Attachements are coming from mail sender.

      So I need to understand how I can pass these attachements to receiver proxy and access the same inside my Abap proxy.

      Thanks.

      Regards,

      Siddhesh S.Tawate

  • Jul 24, 2009 at 08:36 AM

    > 1. My Inbound Data Type is the mail Package -- ximail30_xsd. Here in sxmb_moni I can see the mail attributes like from, to and the mail body in content. But How can I read the attachements in my message mapping.

    In PI 7.0 you cannot access the attachment in mapping.

    > 2. How can I pass these attachements to Abap Proxy ( I do not need to alter attachments only pass to proxy ). These attachements have to be attached to the Solman ticket in SOLMAN server.

    There is nothing special to do. The attachment is part of the message and will be sent to ABAP proxy automatically.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Ravikanth Talagana

      Hi All,

      Just a last query before I can close this thread.

      I am able to attach the files to my ticket. Below is the part of my code for the header that I pass for attachements:

      wa_APPX_HEADERS-APPXNO = count. -


      attachement number

      wa_APPX_HEADERS-FILETYP = file_type. -


      ex: txt, pdf etc

      wa_APPX_HEADERS-FILENAM = l_name. -


      ex: XYZ.txt

      wa_APPX_HEADERS-FILEFM_UL = 'ASC'.

      wa_APPX_HEADERS-FILELEN = strlen. -


      string lenght of l_xstring obtained for attachement

      GET TIME STAMP FIELD wa_appx_headers-TIMESTAMP.

      append wa_APPX_HEADERS to it_APPX_HEADERS.

      Now problem is my text attachements are going through properly but pdf or image is not getting attached. Though it does not give me any error in the return.

      Also one more thing noteable is if i change this parameter wa_APPX_HEADERS-FILEFM_UL to DAT or IBM all files get attached but I am not able to open any of it including text. The error says "Content CRM_P_ORD not found".

      Please let me know your thoughts on this.

      Regards,

      Siddhesh S.Tawate

  • avatar image
    Former Member
    Aug 12, 2009 at 01:42 PM

    Thanks Guys....

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Please find below the part of code that might help you. I have given code only responsible for attachements part of the ticket.

      *******

      loop at lt_attach into l_attachment.

      count = count + 1.

      if count = 1.

      first_line = 1.

      endif.

      l_type = l_attachment->GET_CONTENT_TYPE( ).

      split l_type at '"' into l_type

      file_name

      l_name.

      l_name = file_name.

      split file_name at '.' into file_name

      file_type.

      l_xstring = l_attachment->GET_BINARY_DATA( ).

      strlen = xstrlen( l_xstring ).

      Compute int = ( strlen div 255 ).

      Compute rem = ( strlen mod 255 ).

      if rem <> 0.

      int = int + 1.

      endif.

      count1 = int.

      if count = 1.

      last_line = count1.

      else.

      if int = 1.

      first_line = last_line.

      else.

      last_line = first_line + count1.

      endif.

      endif.

      wa_APPX_HEADERS-APPXNO = count.

      wa_APPX_HEADERS-DESCR = l_name.

      wa_APPX_HEADERS-FILETYP = file_type.

      wa_APPX_HEADERS-FILENAM = l_name.

      wa_APPX_HEADERS-FILEFM_UL = 'BIN'.

      wa_APPX_HEADERS-FIRSTL = first_line.

      wa_APPX_HEADERS-LASTL = last_line.

      wa_APPX_HEADERS-FILELEN = strlen.

      wa_APPX_HEADERS-LAST_USR = sy-uname.

      GET TIME STAMP FIELD wa_appx_headers-TIMESTAMP.

      append wa_APPX_HEADERS to it_APPX_HEADERS.

      while count1 <> 0.

      count1 = count1 - 1.

      if count1 <> 0.

      wa_APPX_LINES_bin-LINE = l_xstring+0(255).

      shift l_xstring left by 255 places in BYTE MODE.

      ELSE.

      wa_APPX_LINES_bin-LINE = l_xstring.

      endif.

      append wa_APPX_LINES_bin to it_APPX_LINES_bin.

      clear: wa_APPX_LINES_bin, wa_APPX_LINES.

      endwhile.

      first_line = last_line + 1.

      clear: strlen, count1, file_name, file_type, l_type, int, rem, l_xstring, l_attachment.

      endloop.

      ....

      ......

      ........

      CALL FUNCTION 'BAPI_NOTIFICATION_CREATE'

      EXPORTING

      NOTIF_EXT = wa_NOTIF_EXT

      NOTIF_CRM = wa_NOTIF_CRM

      • IBASE_DATA =

      IMPORTING

      NUMBER = Refnum

      NUMB = Numb

      REFNUM = Ticket_No

      SYSID = SYSID

      TABLES

      NOTIF_PARTNERS = it_NOTIF_PARTNERS

      NOTIF_NOTES = it_NOTIF_N_EXT

      NOTIF_SAP_DATA = it_NOTIF_SAP_DATA

      NOTIF_TEXT_HEADERS = it_NOTIF_TEXT_HEADERS

      NOTIF_TEXT_LINES = it_NOTIF_TEXT_LINES

      APPX_HEADERS = it_APPX_HEADERS

      APPX_LINES = it_APPX_LINES

      APPX_LINES_BIN = it_APPX_LINES_BIN

      RETURN = RETURN

      .

      ******

      Please observe how first and last line of attachement is calculated. That is what created problem for me initially.

      Hope this helps.

      Regards,

      Siddhesh S.Tawate