Send xml file from sap to third party url through https
Hi,
I have a requirement to send the xml file from ecc to a 3rd party url through HTTPS. How can we achieve this using ABAP.
Client doesn't have XI enviroment. The client has provided the 3rd party url where the file needs to be uploaded.
Please help ! <removed by moderator>
Thanks in advance.
Regards,
Chitra.K
Edited by: Thomas Zloch on Sep 12, 2011 12:58 PM
Hi Chitra,
I had similar requirement and here is what I did: -
REPORT Z_HTTP_POST_TEST_AMEY.
DATA: L_URL TYPE STRING ,
L_PARAMS_STRING TYPE STRING ,
L_HTTP_CLIENT TYPE REF TO IF_HTTP_CLIENT ,
L_RESULT TYPE STRING ,
L_STATUS_TEXT TYPE STRING ,
L_HTTP_STATUS_CODE TYPE I ,
L_HTTP_LENGTH TYPE I ,
L_PARAMS_XSTRING TYPE XSTRING ,
L_XSTRING TYPE XSTRING ,
L_IS_XML_TABLE TYPE STANDARD TABLE OF SMUM_XMLTB ,
L_IS_RETURN TYPE STANDARD TABLE OF BAPIRET2 ,
L_OUT_TAB TYPE STANDARD TABLE OF TBL1024
MOVE 'https://<hostname>/xxx/yyy/zzz' TO L_URL.
MOVE '<XML as string>' TO L_PARAMS_STRING.
*STEP-1 : CREATE HTTP CLIENT
CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
EXPORTING
URL = L_URL
IMPORTING
CLIENT = L_HTTP_CLIENT
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
OTHERS = 4 .
"STEP-2 : AUTHENTICATE HTTP CLIENT
CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
EXPORTING
USERNAME = 'testUser'
PASSWORD = 'testPassword'.
"STEP-3 : SET HTTP HEADERS
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = 'Accept'
VALUE = 'text/xml'.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
EXPORTING NAME = '~request_method'
VALUE = 'POST' .
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
EXPORTING CONTENT_TYPE = 'text/xml' .
"SETTING REQUEST DATA FOR 'POST' METHOD
IF L_PARAMS_STRING IS NOT INITIAL.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = L_PARAMS_STRING
IMPORTING
BUFFER = L_PARAMS_XSTRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
EXPORTING DATA = L_PARAMS_XSTRING .
ENDIF.
"STEP-4 : SEND HTTP REQUEST
CALL METHOD L_HTTP_CLIENT->SEND
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2.
"STEP-5 : GET HTTP RESPONSE
CALL METHOD L_HTTP_CLIENT->RECEIVE
EXCEPTIONS
HTTP_COMMUNICATION_FAILURE = 1
HTTP_INVALID_STATE = 2
HTTP_PROCESSING_FAILED = 3.
"STEP-6 : Read HTTP RETURN CODE
CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_STATUS
IMPORTING
CODE = L_HTTP_STATUS_CODE
REASON = L_STATUS_TEXT .
WRITE: / 'HTTP_STATUS_CODE = ',
L_HTTP_STATUS_CODE,
/ 'STATUS_TEXT = ',
L_STATUS_TEXT .
"STEP-7 : READ RESPONSE DATA
CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
RECEIVING DATA = L_RESULT .
"STEP-8 : CLOSE CONNECTION
CALL METHOD L_HTTP_CLIENT->CLOSE
EXCEPTIONS
HTTP_INVALID_STATE = 1
OTHERS = 2 .
"STEP-9 : PRINT OUTPUT TO FILE
CLEAR : L_XSTRING, L_OUT_TAB[].
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = L_RESULT
IMPORTING
BUFFER = L_XSTRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = L_XSTRING
TABLES
BINARY_TAB = L_OUT_TAB .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:AMEYHTTP_POST_OUTPUT.xml'
TABLES
DATA_TAB = L_OUT_TAB .
Also, following is the detailed link for use of HTTP_CLIENT class: -
http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/1f/93163f9959a808e10000000a114084/content.htm
Also, in below link, you can ignore XI specific part and observe how its sending XML to external URL:-
(I know it describes call to SAP XI server's URL, but it can be used to call any URL)
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/ae388f45-0901-0010-0f99-a76d785e3ccc
In addition to all above, following configs to be present at ABAP application server: -
1. The hostname used to URL should be present in SAP ABAP application server's 'hosts' file.
2. Security certificate (if available) for URL to be called must be installed in SAP ABAP application server.
Let me know if you achieve any progress with it...
Similar Messages
-
Uploading an XML file from SAP into third party URL
Hi,
I need to Upload an XML file from sap into Third party URL. Can any body tell me the possible ways in SAP to achieve this task. Also explain me the proceedure.
Thanks in advance.
-NamdevSorry. If they only said HTTP/HTTPS and didn't say explicitly web service, it means they don't want it.
One thing I'm not sure is, do you have an URL at the third-party system that you need to contact, or should you provide one at your SAP system that they will contact?
If it is the first one, to send an HTTP request to a given URL using ABAP, you'll find an example here: [SAP Library: Example Program: Executing an HTTP Request|http://help.sap.com/saphelp_nw70/helpdata/en/1f/93163f9959a808e10000000a114084/frameset.htm]
Sandra -
Sending XML file from SAP to Windows Based file server with FTP function
Hi Gurus,
We are using SAP BW 3.0B version.
I need to convert data in ODS to XML format and send this XML file to remote server which is not a SAP application server, it is just a Window Based file server with FTP function..
By writing some ABAP code I have converted ODS data into XML format (which gets saved in my local system)
(Is that I need to put this file in Application Server to send it to the other servers? )
Now the thing is how I can send this file to that Windows Based file server.
plz suggest me.... what can be done......
Thanks in Advance
Madhusudhan
Edited by: Madhusudhan Raju on Dec 3, 2009 4:25 AMI dont think the above code support windows OS. Because I always execute this script via UNIX.
I think you can try this option, go to command prompt, goto the destination path where you have an XML file using cd....
ftp (destination servername), specify the username and password.
afterthat, use the command put and filename.
check whether the file had reached destination successfully or not.
For automation purpose, you can use the following script like
ftp: -s: test.txt (servername)
In test.txt,
UserName
Password
bin
cd /files
put file.xml
bye
Also, you can check in SM69, there will be some SAP external commands to automate the file transfer.
Thanks
Sat
http://support.microsoft.com/?kbid=96269 -
Can we send .csv file from sap srm system to sap pi?
Hi Experts,
we have 3 options send the data from sap systems to sap pi.i. e.proxy,idoc and rfc only
How can we send .csv file from sap srm to sap pi?
Regards,
AnjanAnjan
As you know SAP SRM and SAP PI are different boxes.
*_Option 1:_*
we need a shared AL11 directory in between SAP SRM and SAP PI (Ask basis to setup shared folder). Place / Populate the file in the folder from SAP SRM and then it can be picked through sender file communication channel.
In this case you (Basis team) will share one folder which is visible from the AL11 transaction of both the systems (SRM and PI). You will drop .csv file using some report or program from SRM at this location and from PI you can read that file using File communication channel (NFS mode).
Option 2:
Setup a FTP at SRM environment and expose some folder which can be accessible from PI. Use sender file communication channel at PI end to pick the file.
You can use this option incase sharing of folder is not possible (due to network / other constrains). Here FTP server is required to expose any folder as FTP so as it can be accessible from internet (remote location). You need to expose some folder at SRM machine. You will drop .csv file using some report or program from SRM at this location. Now PI can fetch the file from that location using sender file communication channel (FTP Mode) providing user credentials.
Hope it clears now.
Regards
Raj -
Send binary files from SAP System to SAP XI/PI
Dear experts,
in our SAP ERP-System we have a link to JPG files which are stored in an archive. We want to send these files with some other information to our SAP XI and then store them on a file server. Is there a way to send a MIME attachment via RFC? Or is there another way to send binary files from SAP ERP to SAP XI? We want to avoid polling the files on OS level.
Thanks and regards,
DavidMost recommended way is to go for ABAP proxies. They support attachments.
Regards,
Prateek -
How to send a XML file from SAP to WEB SERVICE
Hi folks,
i m creating a XML file with purchase order data, while saving the purchase order.now i need to send this XML file to some WEB SERVICE i.e to some perticular address in WEB.
can anyone give the step by step procedure to do this web service configuration? it's really urgent.
points must be awarded.
Thanks & Regards
pabitraHi all,
i need to send some purchase order data from SAP to WEB SERVICE. while saving the purchase order, i want to send some data from SAP to WEB SERVICE ( a perticular address in WEB).
i want to see those datas in xml format in WEB.
Now i am using SAP 4.7 version. Is this web service configuration is possible or not?
In SE37, i can not see the CREATE WEB SERVICE option in utilitities--> More utilities menu.is it possible in 4.7???
can anyone give any suggestion ? it's very urgent.
Thnaks
pabitra -
Commitment Interface from SAP to third party system!
When we created Purchase Requisition or Purchase Order, the commitment will be created. The third party system needs to track the commitment. So SAP needs to send the commitment to the third party system by this interface.
But when the Goods have been delivered, the commitment will be zero out and the actual will be posted to SAP. SAP needs to send the offsetting records to the third party system. In this way, the third party systems knows that how much commitments have been reduced.
My problem is that I cannot find the right table to record the offsetting entry. In the table COSP, I can identify the commitment by the Business Transaction -- RMBA and RMBE. But it did not record the offsetting entry. It just becomes zero when the goods have been delivered. But I have nothing from that table to send to the third party system.
Does anyone meet this problem before? Can you share some experience on this?
ThanksHi ,
As pointed ...above you can for a file to file scenario you can create just the Business service in integration Directory and create two file communication channels for sender and reciever under it.
However if it was file to idoc or file to rfc ..
then you need create ts web as abap ..identifying your R/3 system
System Name: <you can give a 3 character id here of r/3 system ...i.e like IDS>
System Home : <can be found in status of R/3 system>
Installtion Number : In transaction Slicense in R/3
Host Name : Same as System home can be specified.
Message Server: <3600+instance Number can be found in the log pad to the r/3 system itself >
associate a bussiness system with this ...create a product and a software component version ...In swcv in respository ..develop your object under it ...
Import this business system in Configuration ..and create your communication chanel under it.
Regards ,
Deepak -
Sending xml file from client to servlet
Hi,
I am writing the server component of an applcation, such that it will receive xml files from the clients(standalone application similar to javaSwing stuff but it's coded in C#), and the servlet will have to extract the data from the xml file and update the mySql database. it will also fulfill the client's request for xmlFiles (and extract data from DB, format to xml file and send back to client)
I'm new to implementing the servlet receiving files from clients so would need some help.
I've got 3 questions to ask:
1) How does the servlet receive/returns the xml file from the client as a series of httpPost request/response. Do i send a File or the file's contents as a String to/from the client?
2) Is it also a must to use socket for the file transfers? I have read in other posts about sockets as well as HttpURLConnection but i don't quite understand.
3) When I send a file back to the client(client is standalone application written in C# whereas server is coded in java), what do i specify for the HttpResponse.setContentType() in my servlet? (i'm returning the xml file to client)
Would really appreciate for any help rendered. If you have any useful links, would appreciate them too. Thanks a lot.
KarenI've got 3 questions to ask:
1) How does the servlet receive/returns the xml file
from the client as a series of httpPost
request/response. Do i send a File or the file's
contents as a String to/from the client?The server will listen on some port for requests. The client has to open a socket to this server to send the file as string to the server.
see http://java.sun.com/docs/books/tutorial/networking/index.html
>
2) Is it also a must to use socket for the file
transfers? I have read in other posts about sockets as
well as HttpURLConnection but i don't quite
understand.You use HttpURLConnection to make a request using the http protocol, instead of opening a socket and then writing the html headers yourself.
3) When I send a file back to the client(client is
standalone application written in C# whereas server is
coded in java), what do i specify for the
HttpResponse.setContentType() in my servlet? (i'm
returning the xml file to client)Its up to your receiving program how to interpret this though, so you probably dont need this. -
Sending Data from BI to Third Party System through CIB Interface
Hi Experts ,
We have a requirement where we need to send data from BI to any Third Party System through CIB Interface . We do not have to use the OHD's . Please share the documents for the same .
Regards
GarimaHi,
My problem is solved.
Sol: Getting wrong data from third party sytem. They are adding spaces in front of the payload and end of the payload so it was not processing. After deleting that spaces its is working fine.
Thanks for your help.
Thanks & Regards,
Purshothamm -
How to send xml file from local folder to azure storage
Hi,
My plan is i have xml files which are under folders in my local.
I want to use mobile service to send xml files to azure storage,
how shall i do that, either by c# or mobile service.
If internet stop, I will use my mobile service to transfer all xml files to azure storage and run web job to do to update azure
sql by xml file.
please advice.
SupermanHi,
You could refer the following link for assistance with uploading image files to Azure Blob Storage using Mobile Services:
http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/
And for image files you could refer the following link:
http://stackoverflow.com/questions/25977406/upload-a-text-file-with-azure-mobile-services
Regards,
Malar. -
Send PDF, EXCEL, MS Word from SAP to third party
Hi All,
My requirement is we have to upload docs from PC and send to third party system.
Now my doubt is how can we upload the docs like PDF , Excel, MS Word etc from PC to sap and send it to third party.
Thanks & Regards
Satyamkumar JhaHi Prabhudas,
Thanks for your inputs.
I have one more doubt.
If you open any delivery in VL03N transaction just below the Menu bar there is button called 'Services for Object'. using this we can attach any document to this Delivery.
Is there any way to attach this newly uploaded document using some Z program (referring tcode CG3Z ) to this delivery.
Regards
Satyam -
RFC or BAPI to get ECC CST LST from SAP to third party
Hi Friends,
I want to find out RFC or BAPI to get ECC,CST and LST No. number from SAP system to third party software accourding to Ship to party.Please healp me.Hi,
Thanks very much for your answer. In fact, table UVERS is empty both on SAP Wharehouse server and Netweaver, but you put me on the right way...
I finally found that table CVERS_REF was enough, but I don't have the version of the component like in the status window...
I doubt also I'm right using the RFC_READ_TABLE, but I don't know yet if a BAPI exists for what I'm looking for.
Regards
François MAESEELE -
hi
i need to create an XML with some values file from Oracle Forms 6.0 and then send this XML file To a URL to access the database,which in turn will send me XML file with new values.Can any body help me out as i don't have any ideas
Regards
SunilSunil,
and this must be using a URL and can't be handled by a database stored procedure ?
Anyway, your scenario can be achieved using teh Java Importer in Forms 6i and above. You woudl write a Java program that takes a String and loads it to an URL. It then checks the response URL for its content.
Frank -
Help: question on send XML file from java client to java server
Hi, I am now to Java, and now I am going to set up a simple network in the lab.
I have created a random array of data and transferred to XML file on my client. Now, I would like to send it to the server. I am wondering how I can put the XML file into my client, and do I need any parser to let the server show what random date it has received?
Anybody can give me any idea or some basic code? Thank you.
Now, I am referring the KnockKnock example in Java online tutorial. But, not clear how to deal with the XML File.
FengyuanThere are several ways you can achieve this: one could be that you transfer data over HTTP, using Servlets for instance. Have a Servlet listening on the Server with content type 'text/xml', POST the XML data to the server and have the Servlet to receive the data and re-compose the XML file. This can be achieved with different libraries:
1) JAXB --> this is good because is the JDK standard, also for web services
2) Castor (http://www.castor.org/) -
Is it safe to remove setup32/setup64 files from the uninstall\third party directory?
Found 2 setupfiles in the %PROGRAM FILES%\common files\adobe\installers\uninstall\thirdparty\{GUID}\Adobe Photoshop lightroom 5 ccm directory.
SAFE to get rid of them? living a limited c:\ SSD boot device... so gotta be thrifty... Thanks!Hi Raj,
The “Everyone” share access is a remnant of legacy Exchange functionality (pre-Exchange 5.0).
For Exchange 2003, we do not see any Microsoft Exchange 2003 dependencies upon those shares.
From the Exchange perspective, it is safe to remove the “Everyone” share permission.
However, there may be any 3rd party applications which still use Exchange 2003 in a legacy fashion, their ability to access proxy DLLs/addressing templates, and reading diagnostic logging pages may be hampered.
To mitigate such a risk, I suggest we can replace “Everyone” with “Authenticated Users” in order to bypass any audit concerns, yet still allow 3rd party applications to access those shares. Additionally, here is a KB descripted the detailed functions about
these shared folder:
http://support.microsoft.com//kb/812290
Regards,
Winnie Liang
TechNet Community Support
Maybe you are looking for
-
Error occurs while posting the transaction by user in F-02
Dear Friends, Kindly give me acceptable solution to the below error/ticket while user posting a transaction in F-02. ERROR: " system error in routine FI_TAX_CHK_PRICING_DATA_ error code 13 function builder TAX2"
-
PPro2 best bitrates for transcoding in AME to DVD
Hello. I have created a 165-minute movie (including 8 minutes of motion menus) to be authored with menus/chapters in TMPG Authoring Works 4. I'm exporting from PPro2 via Adobe Media Encoder for transcoding to mp2, and have space left over due to my
-
Simple Tap 2.0 causes power plan idle timer ineffective
Hi, I installed Simple Tap 2.0 and power management 3.62, and I found that simple tap causes power plan idle timer ineffective e.g.. the display wouldn't dim or turn off, machine wouldn't go sleep or hibernate after idling certain time. So I disabled
-
Query to Identify Sets Having Given Pattern
Hi, Assume that i have following table Id Code 1 aaa 1 bbb 1 ccc 2 aaa 2 bbb 2 ddd 3 bbb 3 eee The records will be grouped by Id. I want to identify sets having following criteria 1. Set should have at least one record with code like 'a%' and should
-
HT1338 macbook pro install discs
Hi I'm working on a MacBook Pro dead hard drive. I have a iMac install disc that will not install on the MacBook. can I download the install dics image or do I have to by new discs. Thanks for any help. Regards, Rob.