Received attachment in abap proxy

Hi all ,
i have scenario in which my client is sending one attachment  from asp.net application through webservice.
i have successfully received in my abap proxy but it is in byte array so how can i convert in to file format.
in sort i want to convert byte array to file in abap proxy how can i do?

do check if this discussion helps - Re: Inbound proxy with attachments.

Similar Messages

  • Problem sending xls file in an attachment via ABAP proxy

    Hello,
    I have in tmp directory a xls file, I tranfer such file to a table, and afterwards I send in an attachment via ABAP proxy, here is the code:
         l_attachment        TYPE REF TO if_ai_attachment,
            lt_attach           TYPE prx_attach,
            l_name              TYPE string,
            lx_string           TYPE xstring,
            l_string            TYPE string,
            l_type              TYPE string,
            des                 TYPE string.
      CLASS cl_ai_factory DEFINITION LOAD.
      DATA:    BEGIN OF itab OCCURS 0,
               raw(255) TYPE x,
             END OF itab.
      DATA: l_controller TYPE REF TO if_ai_posting_controller.
      DATA: it TYPE zhcm_mt_segur_out.
      CREATE OBJECT prxy.
      OPEN DATASET orig FOR INPUT IN binary MODE.
      READ DATASET orig INTO itab-raw.
      WHILE sy-subrc = 0.
        APPEND itab.
        READ DATASET orig INTO itab-raw.
      ENDWHILE.
      CLOSE DATASET orig.
      LOOP AT itab.
        CONCATENATE lx_string itab-raw INTO lx_string in byte mode.
      ENDLOOP.
      L_NAME = 'Segur.xls'.
      L_TYPE = CL_AI_ATTACHMENT=>IF_AI_ATTACHMENT~C_MIMETYPE_EXCEL.
      TRY.
          L_ATTACHMENT =
            CL_AI_FACTORY=>CREATE_ATTACHMENT_FROM_binary(
                      P_DATA = LX_STRING
                      P_TYPE = L_TYPE
                      P_NAME = L_NAME ).
          APPEND L_ATTACHMENT TO LT_ATTACH.
          L_CONTROLLER = CL_AI_FACTORY=>CREATE_CONTROLLER( ).
          L_CONTROLLER->SET_ATTACHMENTS( LT_ATTACH ).
          CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
            EXPORTING
              CONTROLLER = L_CONTROLLER
              OUTPUT     = IT.
          COMMIT WORK.
        CATCH CX_AI_SYSTEM_FAULT .
          DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
          CREATE OBJECT FAULT.
          WRITE :/ FAULT->ERRORTEXT.
      ENDTRY.
    I am using a Mail receiver channel, I receive a mail, with to attachments, one .xml and the other one .bin, I save it to my computer and I change the extension to .xls and when I try to open it, the file is not valid and can be opened after being repaired. What Im doing wrong? I would like to receive a valid xls file, what i should change?
    Thanks a lot,
    Luis

    Hi,
    yes I know, I have used the MessageTransformBean module, and the PayloadSwapBean module. But which parameter I should use for leaving only one attachement in the e-mail. I did this configuration:
    1
    localejbs/AF_Modules/MessageTransformBean
    Local Enterprise Bean
    <b>trans</b>
    2
    localejbs/AF_Modules/PayloadSwapBean
    Local Enterprise Bean
    <b>swap</b>
    3
    localejbs/AF_Modules/MessageTransformBean
    Local Enterprise Bean
    <b>trans1</b>
    4
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    Local Enterprise Bean
    mail
    <i><b>Module configuration</b></i>
    trans
    Transform.ContentDisposition
    inline
    swap
    swap.keyName
    payload-name
    swap
    swap.keyValue
    Segur
    trans1
    Transform.ContentDescription
    Segur
    trans1
    Transform.ContentDisposition
    attachment;filename="Segur.xls"
    trans1
    Transform.ContentType
    application/vnd.ms-excel;name="Segur.xls"
    In the e-mail I get one attachement without name .xml and another one Segur.xsl, and I want only one attachment, the last one. What I should change in my configuration??
    Best regards,
    Luis

  • Handle attachements   in abap proxy

    the like lets about sending the message as an attachment, can u help me out, after receiving an attachment in abap proxy, what are steps need to be done in abap proxy.
    is there necessary that the receiver transport protocol should be HTTPS 1.0

    Hi,
    [SAP Help Proxy Programming: Attachments|http://help.sap.com/saphelp_nw2004s/helpdata/en/a7/3b2a2d45a34a23b75e3b18745c63bc/content.htm]
    Regards,
    Udo

  • How to extract attachment from ABAP proxy and store in archive link....

    Hi Experts,
    I need to consume an incoming email attachment in the ABAP Proxy program (POP Mail  --> PI --> ABAP Proxy) and then store this file in the IBM content management server through the Archvie Link connection.
    Any idea how to implement this piece of code in ABAP?
    Regards,
    Shobhit

    Hi Shobhit
    You can get the files from Sender Mail adapter. In proxy implement the method of protocol IF_WSPROTOCOL_ATTACHMENTS as said above.
    Archive Link supports HTTP, RFC etc depends on the system you are going to use for archiving. For your case you have IBM server i think you have to do HTTP synchronous. This will be like an interface again for you.
    Why are you using ERP system in middle. I think you can directly dump data to IBM server.
    Thanks
    Gaurav

  • Receive mail with PDF attachment into XI and send to ABAP proxy

    Hi,
    I have a scenario where I need to receive a mail into XI that has a PDF attachment. This attachment needs to be retained as ultimately I need to send the message into CRM via an ABAP proxy and read the attachment and load against a business partner.
    However, as I am only on SP13 I do not have the parameters such "Keep Attachments" available to use.
    So I have two questions:
    1. How do I receive the mail into XI with the PDF attachment ?
    2. How do I read the attachment in an ABAP proxy ?
    Any guidance in either question would be appreciated.
    Cheers
    Colin.

    hi,
    you say that there's no keep attachment
    indicator but does the XI store the attachment or not?
    maybe it stores all attachmens
    (I work with sp16 and I don't remember how it worked with sp13)
    but try maybe it accepts attachments by default
    then it would be quite easy
    if you use then use the attachement in abap proxy
    (like I said you won't have to use any java)
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

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

    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

  • Attachments via ABAP Proxy

    I have come across one client requirment where he needs to send the txt/pdf file as an attachment from R/3, currently that interface is using the ABAP Proxy, is there any idea about How to send the attachments via ABAP Proxy?

    Hi,
    Refer
    XI: RFC or ABAP Proxy ? ....ABAP Proxies with attachments
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    Problem sending xls file in an attachment via ABAP proxy
    Receive mail with PDF attachment into XI and send to ABAP proxy
    http://help.sap.com/saphelp_nw70/helpdata/en/51/d5cd16235e4643ae8ec92395c4ad97/frameset.htm
    Thanks
    Swarup

  • Problem with Configuration in Production ( ABAP Proxy - XI - FILE)

    Hi All,
    I have a ABAP Proxy -> XI -> FILE scenario wich is working perfectly in DEV and QAS environment.
    When the person responsible for transporting tried to transport the objects in QAS to PRD, the following error happened:
    Direction of communication channel |BS_MA_FileServer_PRD | CC_File_PedidosServ_MA_FileServer_IA is incorrect.
    Correct the direction or choose another communication channel
    BS_MA_FileServer_PRD - Business System (FILE)
    CC_File_PedidosServ_MA_FileServer_IA  - My FILE Communication Channel
    This was what the Basis person sent to me. I don't have access to know exactly what happened. And I really don't know what could be wrong or if maybe a component was created wrongly in Production.
    Hope you can help.
    Points will be given.
    tks.. Daniela

    You have mentioned FILE is on the receiving side and ABAP proxy is on sender side.
    But the error pasted by you clearly shows syntax of a Sender Agreement .
    For receiver agreement it should be |<Sender Service>| |BS_MA_FileServer_PRD | CC_File_PedidosServ_MA_FileServer_IA
    Bipin

  • Integration Engine Message Id in ABAP Proxy

    Hi,
    I have a scenario sending to XI from CRM using an ABAP Proxy.
    I need to get the message id generated in the local Integration Engine when a message is sent via the ABAP Proxy or received into the ABAP Proxy.
    I see there is a way of doing this in XI and also thought I had found a way of getting it in the proxy in CRM but this does not seem to work correctly even though i can see the message ID being created in the proxy call to XI.
    I am trying to get the message id immediately after the proxy call to XI.
    Kind regards
    Colin.

    Hi Colin,
    as far as I know, it is possible. Have a look at the online help on abap proxies and check out the determination of message id:
    http://help.sap.com/saphelp_nw04/helpdata/en/a1/082589fc4246f09793039d5fb01a17/content.htm
    Hope that helps,
    regards, jaime

  • PI to ECC via ABAP Proxy - Outbound Queue for HTTP

    Dear Experts,
    Is there any Outbound Queue for HTTP?
    I've a interface scenario where the receiver is SAP ECC and the receiver adapter XI ABAP proxy. As I see in the communication channel the transport protocol used is HTTP. So I think could there be an outbound queue to manage HTTP connection when PI send the data to SAP ECC?
    Just like when we are sending IDocs to ECC via tRFC, we could check if the IDoc has really been sent to ECC by checking in tcode SM58 (Outbound tRFC).
    In case for ABAP Proxy via HTTP, is there any similar connection to SM58 (IDoc via tRFC)?
    Thank you,
    Suwandi C.

    Hi Kandasami,
    Thank you for the reply. I will check for it.
    Hi Jens,
    Yes, I mean somewhere after the SXMB_MONI in PI and before SXMB_MONI in ECC, is there any queue in between those two?
    Thank you,
    Suwandi C.

  • Security: MLS between XI IS and IE (ABAP Proxy System)

    Hi All,
    Is Message Level security possible between XI IS and IE (ABAP Proxy System).
    I hope HTTPS is supported for XI Receiver Adapter to ABAP Proxy System. What are the activities in XI as well as ABAP Proxy system to use HTTPS protocol in ABAP Proxy Communication.
    Regards,
    Sudharshan N A

    Hi,
    Check the following links.. you will get the information all about the securities...
    http://help.sap.com/saphelp_nw04/helpdata/en/f7/c2953fc405330ee10000000a114084/content.htm
    Also read thru this link for message level security - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d024ca8e-e76e-2910-c183-8ea4ba681c51
    http://help.sap.com/saphelp_nw04/helpdata/en/a8/882a40ce93185de10000000a1550b0/frameset.htm
    message level security/encryption and decryption
    Message Level Security and Performance
    Also find soeminformation in these links
    http://help.sap.com/saphelp_nw2004s/helpdata/en/a8/882a40ce93185de10000000a1550b0/frameset.htm
    /people/aparna.chaganti2/blog/2007/01/23/how-xml-encryption-can-be-done-using-web-services-security-in-sap-netweaver-xi
    Step by step guide for SSL security
    step by step guide to implement SSL
    Thanks
    Swarup
    Edited by: Swarup Sawant on Apr 9, 2008 12:34 PM

  • Receive CSV attachment via Mail Adapter and process into ABAP proxy

    Hi,
    I have the following scenario:
    1. Receive e-mail with CSV attachment
    2. Process through Mail adapter (KeepAttachments = Yes in order to retain the CSV attachment)
    3. Receive into ABAP proxy (with CSV attachment)
    The next step is to read the attachment in the ABAP proxy and process the CSV attachment data into CRM.
    The CSV attachment contains the data I wish to process - the body of the e-mail will not contain this information.
    The problem I have is reading the attachment data in the proxy - not sure of the methods/class to call - anyone got any ideas ?
    Another question is this the best way to do this and process the CSV attachment data ?
    I know I could use the PayloadSwapBean to switch the payload to the attachment but then I am stumped with how the attachment is processed through PI 7.1 - how do you transform the CSV format payload into XML so PI will be able to process it through mapping.
    Either option is viable - an answer to either question would be great.
    1. How do you read the attachment data in an inbound ABAP proxy ?
    2. How do you transform the CSV attachment data after the PayloadSwapBean from CSV to XML ?
    Kind regards
    Colin.

    Hi Colin
    As you are not interested in processing the body of email. Swap the payload to the attachment using the PayloadSwapBean
    Change the content from CSV to XML using MessageTransformBean. Now pass this information to Proxy. You dont need to deal with attachments in proxy.
    It is not possible to read attachment in server proxy because the class and interface you create will not have data type which can refer to an attachment processing interface in ABAP.
    Thanks
    Gaurav

  • SOAP to Abap Proxy with attachment

    Hi Experts,
    i am facing one problem while developing one interface from SOAP to ABAP Proxy with attachment.
    the sender system is sending empty soap message but with all its content in the attachment.
    we need to parse the attachment and send the data to ECC system through proxy.
    we made some research on SDN and found out that in sender soap adapter PayloadSwapBean is not supported.
    however in receiver XI adapter the module tab is not editable.
    could you suggest any solution to handle this interface?
    thanks in advance.

    Hi Aditya,
    Can you just try to  use SOAP with Servlet(Axis) protocol, since standard SOAP sender does not allow modules to be used.
    please refer http://help.sap.com/saphelp_nw04/helpdata/en/45/a39e244b030063e10000000a11466f/frameset.htm
    The first attachment is put in the main payload; further attachments become attachments of the XI message.
    http://help.sap.com/saphelp_nw70/helpdata/EN/45/a4f8bbdfdc0d36e10000000a114a6b/frameset.htm
    Regards,
    Srinivas

  • File/FTP to ABAP Proxy (file as attachment)

    I have the following scenario: File/FTP -> XI -> ABAP Proxy but not the normal case. What I need is the picked file as attachment and the file name. I hope this is possible.
    I have found the following blogs:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    I have no idea where I have to start. How I should define the sender and receiver message interface? How I have to configure the sender file/ftp adapter?
    I'm using PI 7.1 SP 7.

    At the moment I have the following problem. I always get an error during mapping the request message. This is the error message:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Mapping der Request-Message
      -->
    - <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/_MT_SCANFILE_to_MT_SAP_SCANFILE_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException:</SAP:P2>
      <SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.ParserE</SAP:P3>
      <SAP:P4>xception: XMLParser: No data allowed here: (hex) ~</SAP:P4>
      <SAP:AdditionalText />
      <SAP:Stack>Während des Anwendungs-Mappings com/sap/xi/tf/_MT_SCANFILE_to_MT_SAP_SCANFILE_ ist eine RuntimeException aufgetreten. com.sap.aii.utilxi.misc.api.BaseRuntimeException:Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) ~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    And if I use transaction sxmb_moni I see that the payload MainDocument is my pdf document and I can read it.
    MG%PDF-1.3
    %âãÏÓ
    2 0 obj
    /WinAnsiEncoding
    endobj
    3 0 obj
    <<
    %Devtype POST2    Font COURIER  normal Lang DE
    /Type /Font
    /Subtype /Type1
    /BaseFont /Courier
    /Name /F001
    /Encoding 2 0 R
    >>
    endobj
    4 0 obj
    <<
    /Length 5 0 R
    u2026.
    I believe there is still an error at my communication channel configuration of the ftp sender adapter.

  • Problem receiving acknowledgement: abap proxy == file adapter

    Hi experts,
    I am developing an asynchrone interface using PI 7.0. The scenario is: SAP ==> FILE.
    In SAP I have created an abap proxy in wich I requested an acknowledgement when calling from the abap code. In PI I have created an Integration Process with a receive step, and a send step. In de send step I am asking for a transport acknowledgement.
    When I test the interface and I look in the SXMB_MONI in PI, I see the acknowledgement given back to the IP, but in the SAP backend system I don't receive anything in the abap proxy which had send the original message. In de SXMB_MONI from SAP I see a "?" Still awaiting  acknowledgement.
    Can anyone help me with this scenario? I really need an acknowledgement from the file adapter in the calling abap proxy.
    Regards, Jeroen

    You need to crate a REceiver Agreement for this sender...
    The Integration Server sends an acknowledgment message back to the sender (CENTRAL_BACK). It uses the name of the sender system for logical and technical backward routing.
    If the sender is addressed using an ABAP proxy, you must define a corresponding receiver agreement for this sender.
    http://help.sap.com/saphelp_nw04/helpdata/en/29/345d3b7c32a527e10000000a114084/content.htm
    -SM

Maybe you are looking for

  • What is the best way to read and manipulate large data in excel files and show them in Sharepoint

    Hi , I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day. What is the best way to read the data form the excel file in fastest and most efficient way. 2 nd Problem, I have one excel file th

  • Jabber and Yahoo gateways

    Having a problem using Jabber and a Yahoo gateway. I set up an account (using Psi) and that was successful. I can chat with others using Psi just fine. But when I set up iChat to do this it recognizes my account, logs me in but when I open a chat wit

  • Can someone please help me with this. Loading problems and error codes.

    I have several problems with itunes on my PC. I use 2 PC's and Iphone for work and I have an IPod nano. For about a week I have been having several problems with Itunes. The first problem is I cannot access the store, I get the loading screen and tha

  • Paging in E-Text

    We need to have paging in the E-text Report . Below are the Requirments For a Company A there might be 8 Accounts and we want to show just 5 on one page and next 3 on the 2nd page followed by total . Please can some one help me to acheive this . A "P

  • Can my iPad be connected to a DVD player?

    Can you connect a iPad 2 to a DVD ROM