Show TOC

NWBC Application ContextLocate this document in the navigation structure

Use

When NWBC starts an application, it provides a startup parameter sap-nwbc-context ( CL_NWBC=>CONTEXT_HTTP_FORM_FIELD) on the URL. This parameter provides the application with information about the context in which the application was started. NWBC itself does not require the information, it is important only if this information is relevant to the started application.

All applications (or application frameworks) can retrieve this context and supply the startup context to NWBC within the started session with method CL_NWBC=>CONTEXT_SET_FROM_HTTP_REQUEST. The context string is stored statically within the session and can be retrieved at any time.

Note

If the application is running stateless, the application should preserve the context string over roundtrips and re-initialize the string to NWBC at each time (if this context information is required). For Web Dynpro ABAP, these steps are already completed automatically by the Web Dynpro ABAP runtime, making the startup context available within the session for the application to reference.

The NWBC context can be retrieved at any time with the CL_NWBC=>CONTEXT_GET call. This method returns a structure with all relevant context information. (Note that in future the structure can be extended to contain more information.) Most importantly, directly after the context has been retrieved, the application should validate that a valid context does exist.

Example:

    DATA: nwbc_context TYPE CL_NWBC=>T_CONTEXT.

    nwbc_context = CL_NWBC=>CONTEXT_GET( ).

    IF nwbc_context-valid = abap_true.

       ... here the rest of context can be referenced ...

    ENDIF.

The following information is returned in the context:

Name

Type

Description

valid

abap_bool

Set to abap_true if the NWBC context has been initialized for this ABAP session

runtime_version

string

The value of the current ABAP runtime ( if_nwbc_runtime=>version)

role_name

string

The name of the role that contains the application

role_id

string

The ID of the entry within the role

nwbc_shell

string

The current variant of active NWBC: either NWBC for Desktop ( CL_NWBC=>FOR_DESKTOP) or NWBC for HTML ( CL_NWBC=>FOR_HTML)

canvas_window

string

Indicates the type of window in which the application has been started: main shell window ( CL_NWBC=>CANVAS__WINDOW__MAIN), an application window ( CL_NWBC=>CANVAS__WINDOW__APP) or an embedded window in an external portal ( CL_NWBC=>CANVAS__WINDOW__EMBEDDED)

More Information

Web Dynpro ABAP