Show TOC

6.4 ABAP-Based APIsLocate this document in the navigation structure

Use

NWBC provides an ABAP-based API (defined in 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 made available through HTTP.

An instance of the runtime can be obtained by calling the CL_NWBC_RUNTIME=>GET method. The GET method also runs one singleton of the runtime that has been configured for the specific set of parameters. You can specify the following 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

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 of the NWBC HTTP handler within the ICF tree, by default /sap/bc/nwbc.

BASE_URL

yes

The actual ICF path that 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( ).

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, also compute the list of roles that are visible through each cockpit. This is particularly useful when presenting the user with the cockpits and typical applications that are within the selected cockpit. For information about an example of usage of this API call, see 4.8 ~launch Page .

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 is only useful when testing or exporting 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 return structures and internal tables that are defined and commented in the IF_NWBC_RUNTIME interface (see public section). Most of the names are self-explanatory. The main structures are briefly described.

Parameter

Type

Description

agr_name

agr_name

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

change_date

dats

Date on which the role was last changed

change_time

tims

Time at which the role was last changed

sort_index

integer

Relative sort index of this role. Allows roles to be positioned relative to one another. This is a simple integer that can have any value according which is 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

Displayed user 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 can be used for further enhancements)

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

integer

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

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

integer

Sort sequence of the tree level

target_system

string

If this application must be started on a different server, this is the corresponding reference configured in transaction RFC Destinations (Display/Maintain) ( SM59) .

url

string

Application URL

is_hidden

abap_bool

This entry is not visible in the navigation tree.

is_disabled

abap_bool

The entry is visible in the navigation tree but disabled.

is_emphasized

abap_bool

The entry should be displayed more prominently in the navigation tree.

force_sapgui

abap_bool

Enables native SAP GUI rendering in the browser

is_home_page

abap_bool

Home page of the parent folder.

is_service_map

abap_bool

This folder requires a service map.

link_collection

abap_bool

This folder is part of link collections.

single_top_level

abap_bool

Display only one top-level entry and the rest on the panel

menu_entry

abap_bool

These entries belong in the top menu.

text

string

Display text

description

string

Tooltip text

icon

string

Only relevant for folder root nodes ( level=1) when displayed on the shell

icon_for_service_map

string

Only relevant for folders when displayed in a service map (48x48), format ~Pictogram/name

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 transaction 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:

Method

Description

URL_CONSTRUCT

Constructs an NWBC URL onto a shell: You can directly specify the relevant application to load in the content area.

URL_LAUNCH

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