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
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,
LuisHi,
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 -
Error Handling in Inbound ABAP Proxy with EOIO
Hi,
The scenario
I have a File to ABAP Proxy scenario and since the requirement is that the messages have to be processed in a single queue in the SAP system (i.e. EOIO), the sender file channel was configured to be EOIO. This ensures that all messages that enters the SAP system are put in a single queue and then processed one after the other.
The Issue
Now if one of the messages that enter SAP system fails during the processing in the ABAP program, the queue gets stuck and all messages after that go into a scheduled state. And one has to manually clear the errored message in order to continue processing the other waiting messages.
The Question
I know this is a default behavior in an EOIO scenario, however is there any way in which if a message fails in the ABAP program then one can automatically push it out of the queue and keep processing the other messages after it ?
Thanks
BharathAs a general rule I only use EOIO when there is a possibility of dependancy between messages (message 1 must be first and finsihed before message 2 starts). Assuming your just moving the errored message asside, I would assume that EOIO should be just EO.
Alternatively, change the ABAP proxy to handle the error and return a clean status. Exception handling (try/catch) should be used were ever dangerous code is being used.
If alerting in the proxy end point is to much trouble - change your proxy to a sync scenario return the error to PI and fire alerts from there <- I think this should be avoided but it will work.
The main point is the exception handling so that the proxy fails "gracefully". -
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,
ShobhitHi 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 -
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.
-
Exception handling in outbound ABAP proxy
Hi All,
i need to catch exception in outbound abap proxy in two cases:
1. if RFC dest in R3 which is pinging to XI goes down.
2. IF xi server is down.
in both the cases i need to catch the exceptions.
now i written the code in this way:
DATA: v_exceptions TYPE REF TO cx_ai_system_fault.
TRY.
CALL METHOD zirco_o_msg_if_as_req_details=>execute_asynchronous
EXPORTING
output = s_reference.
COMMIT WORK.
CATCH cx_ai_system_fault INTO v_exceptions.
WRITE: 'Exception CX_AI_SYSTEM_FAULT caught'.
WRITE: / v_exceptions->errortext.
WRITE: / v_exceptions->code.
but this code is not working.
can anybody tell me how can i acheive this?Hi All,
I need to log the error when receiver syatem is down.
Its like this:
Outbound proxy >>>XI>>>File adapter..
Now if xi goes down....means message is succussefully sent from ISD and get stuck in XI then i need to catch this exception in ISD.
Is it possible?? if yes then how??
Kunaal -
How ABAP proxies will be able to handle attachements
how ABAP proxies will be able to handle attachements.
my attachment in byte array formatthax abhishek ,
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 -
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 -
Fault message in asynchronous ABAP Proxy
Hi,
I have a question about fault messages in asynchronous ABAP proxy server.
The configured scenario is SOAP XI ABAP Proxy. Between XI and the ABAP Proxy I have configured an inbound asynchronous interface with a fault message, and then I have generated all the classes and implemented some code for exception handling in the ABAP Proxy side successfully.
When I tested negative cases, the exception raises and it is visible in the SXMB_MONI transaction in the R/3 side, but this exception is not displayed in the SXMB_MONI of XI it just displays a successful delivery to the ABAP Proxy message.
According the XI documentation it says <i>In the asynchronous case, you can see a fault message in the monitoring of the Exchange Infrastructure.</i> But this is not working.
Am I missing something?Hi,
This parameters are form group RUNTIME.
Please check it:
http://help.sap.com/saphelp_nw04/helpdata/en/d6/49543b1e49bc1fe10000000a114084/content.htm
Regards,
Wojciech -
Hi All,
1. I need to send material master data from sap r/3 to XI through abap proxy. How can i do this? can i write code in abap to extract material master data by using select statement? Please let me know.
2. I am receiving invoice data from XI I need to post this data into sap r/3 by abap server proxy. This data shouldn't be post immediately. it should be in parked status after doing some cross check i need to post. How can i do this?
Regards,
venkateshHi,
>>>2. I am receiving invoice data from XI I need to post this data into sap r/3 by abap server proxy. This data shouldn't be post immediately. it should be in parked status after doing some cross check i need to post. How can i do this?
inside your abap proxy (server) just call BAPI BAPI_INCOMINGINVOICE_PARK
and you can park invoices with this one
there is no special handling necessary in ABAP proxy for this requirement
parking of invoices is a standard FM in SAP
>>>1. I need to send material master data from sap r/3 to XI through abap proxy. How can i do this? can i write code in abap to extract material master data by using select statement? Please let me know.
there is no standard proxy for materials so just use IDoc instead
Regards,
Michal Krawczyk -
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 -
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 to ABAP proxy as attachment
Hello PI expert,
I have requirement to FTP file from FTP server to ECC server. But because of some security, we can not get FTP permission on ECC server.
What i want to do is, get the file from FTP server as it is, and send it using abap proxy as attachment. I don't want to do any content conversion or xml conversion because I want to transfer file as it is.
Any suggestion.
Thanks,Hi,
if your PI version is at least "SAP NetWeaver PI 7.1 SP3"
create sample Data type structure with one node and one field, and use this for both proxy and file service/message interfaces.
Pick the file from FTP. No graphical mapping. Use Java Mapping. Read the input stream and create an attachement from this and attach it to the message. pass some static values for the output (proxy) structure using output stream. Thats all.
http://help.sap.com/javadocs/pi/SP3/xpi/index.html
Methods:-
com.sap.aii.mapping.api --> OutputAttachments --> create(String contentId, byte[] content) / create(String contentId, String contentType, byte[] content) -
Hi,
In my scenario, I have written code in the execute_synchronous method of the abap proxy in ECC. I want to capture all possible errors that might occur here and for all of them i want to capture the message id and the text and send it out. what kind of possible errors/exceptions can occur and how to handle them. My proxy class simply selects data from multiple tables in ECC and returns the same.
thksHi,
for outbound proxies the error handling should be done within R3 itself and there is no need to send errors to XI or receiving system for that matter. You would want someone from R3 side to take a note of it.
For Inbound proxies, you will have to implement the Fault messages
Fault message types are designed for application-specific errors that occur on the inbound side and that are reported back to the sender or persisted in monitoring.
· In the synchronous case, when an application-specific error occurs on the inbound side, instead of sending a response message back to the sender, the application can send a fault message to handle the error.
· The fault message of the application for an asynchronous ABAP server proxy is persisted for monitoring. In the case asynchronous of Java server proxies, the fault message is part of a negative application acknowledgement (see Acknowledgments).
Application-specific means that the application on the inbound side triggers the error itself because, for example, the request message did not contain sufficient information.
For more information on the same.
http://help.sap.com/saphelp_nw04s/helpdata/en/dd/b7623c6369f454e10000000a114084/frameset.htm
In your case, since you said that you are selecting data from some tables, the possibility is that an entry is not found in the DB tables you will have to simply populate the fault message data and raise an expection CX_FM. It also depends on what error handling requirements from the Business .
regards,
Advait.
Maybe you are looking for
-
Software Updater doesn't work, can't shut down my mac
Hi, I am using the Mac OS 10.5 and have a problem with my Software Updater. If I open the "Software Updater" from the Apple-Menu nothing happens, if i press on the button "Software Updater" in the "About this Mac" window, again no reaction. If I open
-
Hi There was a requirement wherein I need to change the special stock indicator value in the components tab of IW31/IW32 based on the material entered. All the user exits / BADI's had the special stock indicator as the importing parameter and none ha
-
Jaggy Edges: None Before Rendering - Plenty After Rendering
hi guys. i'm working on a stop motion project at the moment. in Sequence Settings, Compressor is set to photo-jpeg, frame size and pixel aspect ratio to HD 1440x1080, field dominance to none, video processing to "always render in RGB" and rendering q
-
I just wanted to share my findings in case anyone else is having this problem. I've been running WinXP Pro for months, but last night while trying to figure out my freezing/rebooting problem I figured I'd run a Hard Drive benchmark to see my CPU Util
-
Can not access Verizon Email via our Iphones since yesterday (09/04)......Have deleted App multiple times and reloaded, but still does not work..... Can access email from laptop with no issues.....