There are different solutions for sending document / file to an external NON-SAP System, this document highlights the technique of sending a file using simple HTTP URL.
This document illustrates how a HTTP client object is created using ABAP and the usage of different parameters/ attributes involved with it.
The file receiver component in the Webserver will be triggered using an HTTP URL, thereby certain aspects such as data security and validity should be accounted while designing the HTTP Service URL in the receiver system.
The attributes/parameter sent with the URL during the request, can be used for the below purpose.
- Describing metadata of the file/document that is sent.
- Security certificates/credentials of authenticity.
- Handshake during communication between the two systems.
These attributes can be sent as URL parameters or as a separate file to the external system along with the file.
A simple scenario of uploading a file using SAP WEB Application and transfer it to a web server using HTTP REQUEST POST is illustrated in this document.
The standard class ‘CL_HTTP_ENTITY’ is used for this purpose.
The code block to transfer the file is generic and can be added in a ABAP Report or it can also be reused by creating Function Module , ABAP Class etc. This technique can be used to send files currently existing in SAP system or from local clients system.
The receiving component should be enabled/active and it should receive the file when the file transfer is triggered from sender system (SAP) using HTTP URL Call .
The HTTP URL used here is provided by the receiving system.
The file transfer technique is explained below with an example, it divided into following parts.
1. Web Application using SAP Webdynpro ABAP to upload file from client system and transfer it to NON SAP System
using a custom method ‘SEND_DOCUMENT’.
2. ABAP class containing the method ‘SEND_DOCUMENT’ to transfer the uploaded file.
3. Executing the application.
1. Creating a simple Webdynpro ABAP application, which will use a custom method in a ABAP Class to transfer the uploaded file using HTTP URL.
- Create Component
- Create a node – ‘ND_FILE_UPLOAD’ to map UI element.
Attribute types used in the node.
FILE_NAME TYPE STRING
FILE_TYPE TYPE STRING
FILE_SIZE TYPE STRING
FILE_CONTENTS TYPE XSTRING
- Create a view – ‘V_UPLOAD’ and map the corresponding node – ‘ND_FILE_UPLOAD’ map it to the ‘FileUpload’ UI Element.
- The action handler of Submit button will calls a method SEND_DOCUMENT from webdynpro components assistance class as specified in the file ‘SUBMIT_ACTION’ attached with the document. The method used in the assistance class is elaborated in part 2 below.
- Create Webdynpro Application for the above component.
2. Create a class which contains the method for sending data to other systems.
- Create an ABAP class ‘YXX_CL_ARCHIVE_DOCUMENT’ with a PUBLIC method ‘SEND_DOCUMENT’.
- The logic in the ‘SEND_DOCUMENT’ method is present in the file ‘SEND_DOCUMENT’ attached with the document.
3. Excecuting the Application :
- Open the URL generated while creating the Webdynpro application, refer Figure 1.e for the URL.
- Upload a test file from local system.
- Submit – Trigger file transfer.
The demonstration above explains the file transfer technique using HTTP Request, this is help full in small file transfer.