Show TOC

Accessing Header FieldsLocate this document in the navigation structure

Use

Using GET_HEADER_FIELD() / GET_HEADER_FIELDS(), the HTTP request handler can access all attributes of the HTTP header (name/value pairs). Examples are the attributes content-length and content-type.

You can use the methods SET_HEADER_FIELD() and SET_HEADER_FIELDS() to, modify the request header for the HTTP client, for example.

Caution

Some header fields must not be set with the method SET_HEADER_FIELD(). The description of the individual header fields explains how you should access them.

Features
  • These methods can be used to access all HTTP header fields that are sent as part of a request.

  • Each field is addressed using its name (for example, "content-type" for the content type attribute of the HTTP header).

  • The most common HTTP header fields are defined with initial values in the interface IF_HTTP_HEADER_FIELDS.

  • You can find the SAP-specific header fields in interface IF_HTTP_HEADER_FIELDS_SAP.

You can display these interfaces in transaction SE24.

In addition to these fields, there are a number of other fields that are not pure field attributes of the HTTP header, but that can be derived from the HTTP request line. These fields are known as pseudo header fields. A typical example is the query string part of a URL, or the method of the request (for example, GET or POST). To make a clear distinction between pseudo header fields and genuine header fields, pseudo header fields begin with the prefix ~ (tilda) (~query_string, for example).

More Information

  • List of the Pseudo Header Fields

    Note

    The SAP header fields that are written in italics should not be changed with method SET_HEADER_FIELD()! The permitted access type is specified at the end of the corresponding field description.

  • For a list of typical fields in the HTTP header, see the HTTP/1.1 specification (http://www.w3.org).

Example
  1. Enter the URL http://hostname:portname/sap/bc/icf/demo/example_1 in your browser.

  2. Replace the substrings hostname and portname with the current values of your system.

    (You can execute the example in the same way by calling transaction SICF and following the path default_host - sap - bc - icf - demo - example_1. Right-click the example to open a field. Choose: Test service

    Your browser starts automatically and executes the example program.)