SAP ICF

Get Example source ABAP code based on a different SAP table
  


ARTICLE

ICF - Internet Communication Framework
Internet Communication Framework (ICF) is a programming interface (API), based on interfaces and classes, used by ABAP programs to communicate with the Internet. All ABAP access to the Internet (and in the reverse direction) is made through ICF. ICF supports the Internet protocols HTTP, HTTPS, and SMTP and is a simple technical basis for more advanced programming interfaces. This means that ABAP programs do not usually access ICF directly and wrappers are used instead, such as Business Server Pages, Web Dynpro ABAP, Web Services ABAP, or ODATA-based services. Wrappers like these ensure that the conventions required for external communication are met, such as the model view controller approach (MVC) in Web Dynpro or Simple Object Access Protocol (SOAP) in Web services.
To communicate with the Internet using REST principles ( Representational State Transfer), the interfaces and classes in the ABAP REST Library in the package SREST should be used, since they adapt ICF accordingly.
ITOC

ICF Overview
The following figure is a (highly simplified) schematic overview of communications between ABAP and the Internet using ICF. It uses HTTP communication as an example.

IMAGE /SAP/PUBLIC/BC/ABAP/ABDOC_ICF.gif 478 490

The actual communication of the SAP NetWeaver application server with the Internet takes places through its Internet Communication Manager (ICM). The manager itself communicates with an AS ABAP work process, whose task handler controls ICF.
Communication can run in either direction, meaning that AS ABAP can be a server or a client. Within ICF, this aspect is implemented using different branches with their own interfaces and classes. ABAP programs can both respond to requests from the Internet and provide a service with data for further handling and itself query data from Internet. This is done by implementing the appropriate interfaces.

ICF Services
AS ABAP services that are to be accessed from the Internet need to be created as nodes in transaction SICF. This determines the properties of the service too. The initial node of the service tree stands for the AS ABAP Web address consisting of the host and the port. The position of the node in the tree determines the further URL path required to call a specific service. A URL can contain form fields after the actual address part, which are read by ICF.
Before an ABAP response can be made to a HTTP request sent to a service in the service tree in transaction SICF, at least one HTTP request handler must be assigned to the service. A HTTP request handler is a global class that implements the interface IF_HTTP_EXTENSION and is granted access to the ICF infrastructure. The interface has only one method, HANDLE_REQUEST, whose input parameter SERVER is a reference to the service represented by IF_HTTP_SERVER. The attributes and methods of the service make it possible to query properties of the request, such as the content of the form fields in the URL and to pass data to the server in a suitable format, such as HTML or XML. The most important are the attributes REQUEST and RESPONSE, which refer to objects that implement the interfaces IF_HTTP_REQUEST or IF_HTTP_RESPONSE .

Examples
See Calling a HTTP Service.
One production example of a self-programmed HTTP service is the Web version of this documentation itself.

ICF Clients
If the proxy setting for the HTTP client is configured appropriately in transaction SICF, ABAP programs can send requests to the Internet using ICF and receive responses. This is done using client objects from the class CL_HTTP_CLIENT, which implements the interface IF_HTTP_CLIENT. A client object can be created using a factory method from this class, which associates it with a Web address. Like a HTTP server, the attributes REQUEST and RESPONSE reference objects that implement the interfaces IF_HTTP_REQUEST or IF_HTTP_RESPONSE and that can be used to send requests and receive responses.

Example
See ABAP as HTTP Client.

More Information
More information about ICF and ICM can be found in SAP Library under Internet Communication Framework.
This documentation also describes communication between AS ABAP and the Internet, based on class wrappers or ICF enhancements such as ABAP Web Services or the ABAP REST Library.