Show TOC

6.4 ABAP-Based APIs Locate this document in the navigation structure

 

NWBC provides an ABAP-based API (defined in the interface IF_NWBC_RUNTIME) that can be used directly within an ABAP session. This is the API that is used by NWBC for HTML directly and it is also the same API that is exposed via HTTP (see 6.5 HTTP-Based APIs).

An instance of the runtime can be obtained by calling the method CL_NWBC_RUNTIME=>GET. The GET method will also run one singleton of the runtime that has been configured for the specific set of parameters. The following parameters can be specified.

GET Parameters

Parameter

Optional

Description

COCKPIT

yes

Filters the user roles to show only those roles that should be visible for the specific cockpit.

ROLE_FILTER

yes

Alternatively, makes only this specified role visible within the NWBC runtime.

SERVER

yes

ICF server object that can be used as the runtime for URL generation. This object is specifically of interest in cases where there are proxies in the network, as the URL generation code can determine from the server object all relevant settings.

ICF_BASE_URL

yes

Direct path the NWBC HTTP handler within the ICF tree, by default /sap/bc/nwbc. For more information, see 7.6 ICF Configuration

BASE_URL

yes

The actual ICF path, which can be an alias, that was used to access NWBC, typically /nwbc.

FULL_QUALIFIED_BASE_URL

yes

The base url with server name and port. Used in cases where a fully qualified URL needs to be generated onto the NWBC runtime.

For example, the minimal call to obtain an instance of the runtime would be:

  DATA: nwbc_runtime TYPE REF TO if_nwbc_runtime.

  nwbc_runtime = cl_nwbc_runtime=>get( ).

IF_NWBC_RUNTIME Methods

Method

Description

GET_CONFIGURATION

Returns all configuration data in one easy-to-use structure (IF_NWBC_RUNTIME=>T_CONFIGURATION). This is typically information on the system, such as system host and URL data.

GET_SYSTEM_INFO

Returns all system-relevant information that is important for NWBC.

GET_USER_INFO

Returns a small set of user information. This can be used to render a welcome string.

GET_COCKPITS

Retrieves the list of configured cockpits that are available. These are the child nodes that have been configured within the ICF tree.

GET_COCKPITS_WITH_ROLES

For all the cockpits configured, compute also the list of roles that are visible via each cockpit. This is specifically of interest to present to the user the cockpits and the typical applications that are within the cockpit for selection. See the ~launch page as an example of usage of this API call.

GET_ROLES

Returns all roles that are available for this user with the current instance of the NWBC runtime.

GET_NAVIGATION_TREE

Returns a list of all menus configured over all roles for this instance of the NWBC runtime. This is the navigation tree that is presented to the user.

GET_OBN_TARGETS

Returns the complete set of possible OBN targets for all roles that are visible within the instance of the NWBC runtime.

RESOLVE_NAVIGATION

API call to resolve an OBN request.

GET_ALL_RUNTIME_INFO

Exports all NWBC runtime data in one call. This method has only real value in cases of testing or exporting of a specific complete set of runtime information.

GET_TROUBLE_SHOOTING_INFO

Gathers as much troubleshooting information as possible that can be used to answer specific questions on the system configured. This enables you to detect possible error situations.

All API methods will return structures and internal tables that are defined and commented within the interface IF_NWBC_RUNTIME (see public section). Most of the names are self-explaining and are thus not further documented here. However, the three main structures are quickly highlighted.

IF_NWBC_RUNTIME=>T_ROLE

Parameter

Type

Description

agr_name

agr_name

The role name (30 character key) as specific within transaction PFCG.

change_date

dats

Date on which the role was changed the last time.

change_time

tims

Time on which the role was changed the last time.

sort_index

i

Relative sort index of this role. Allows roles to be positioned relative to one another. This is just an integer number that can have any value on which will be sorted. The numbers do not have to be in sequence.

home_role

abap_bool

Indicates that this role should be sorted to the front (where the home icon is), effectively sort_index = 1.

name

string

User displayed name of the role.

description

string

A long description string for the role.

attributes

t_attributes

A freely defined set of attributes for the role (that could be used for further enhancements).

IF_NWBC_RUNTIME=>T_OBN_TARGET

Parameter

Type

Description

agr_name

agr_name

Role name in which OBN is configured.

object_id

string

Specific role entry to which this OBN points.

object_type

swo_objtyp

Key to business object, for example, SFLIGHT.

object_name

string

User-friendly name for the business object, for example, Flight.

method

swo_verb

Key to the method, for example, DISPLAY.

method_name

string

User-friendly method name, for example, Display.

priority

i

If more than one OBN is available within the same set of roles, the priority is used to decide on which OBN entry to use. The highest priority (= highest number) is used.

description

string

Descriptive text that describes the OBN mapping; not used at runtime.

parms

string

List of name and value pairs for the OBN parameter mapping, stored URL-encoded.

IF_NWBC_RUNTIME=>T_NAVIGATION_ENTRY

Parameter

Type

Description

object_id

string

Node id: entry of the node over all selected roles.

unique_id

string

Unique id that is computed to be "stable" for use in NWBC (sum of role name and origin_id)

parent_id

string

Parent node id.

sort_order

i

Sort sequence of the tree level.

target_system

string

If this application must be started on a different server, this is the corresponding SM59 reference. For more information, see 5.10 Remote Systems.

url

string

Application URL.

is_hidden

abap_bool

This entry is not shown in the navigation tree. For more information, see 5.5 Navigation Tree.

is_disabled

abap_bool

The entry is visible in the navigation tree, but disabled. For more information, see 5.5 Navigation Tree.

is_emphasized

abap_bool

The entry should be visualized more prominent in the navigation tree. For more information, see 5.5 Navigation Tree.

force_sapgui

abap_bool

Enable native SAP GUI rendering in the browser.

is_home_page

abap_bool

Home page of the parent folder. For more information, see 5.6 Default Pages and Service Maps.

is_service_map

abap_bool

This folder requires a service map. For more information, see 5.6 Default Pages and Service Maps.

link_collection

abap_bool

This folder is part of link collections. For more information, see 5.7 Link Collections.

single_top_level

abap_bool

Display only one top-level entry, the rest on the left panel. For more information, see 5.8 Single Top Level.

menu_entry

abap_bool

These entries belong in the top menu. For more information, see 5.9 Menu.

text

string

Display text.

description

string

Tooltip text.

icon

string

icon is only relevant for folder root nodes (level=1) when visualized on the shell.

icon_for_service_map

string

icon_for_service_map is only relevant for folders when displayed in a service map (48x48), format ~Pictogram/name. For more information, see 5.6 Default Pages and Service Maps.

is_top_level

abap_bool

Flag to indicate that the node is a top-level node.

has_children

abap_bool

This flag is set if the node has children.

application_alias

string

A string with no further meaning that applications can configure in PFCG to recognize entries again during a BAdI call.

Class CL_NWBC

Class CL_NWBC contains external functionality for NWBC. The two central methods are listed below.

CL_NWBC Methods

Method

Description

URL_CONSTRUCT

Contructs an NWBC URL onto a shell: It is possible to specify directly the relevant application to load in the canvas.

URL_LAUNCH

Launches an NWBC URL: NWBC for HTML is launched in a browser, NWBC for Desktop is launched directly as application.