Skip to content

Class: ClientAPI

The ClientAPI is a developer-facing class that provides access to a context (page or control, for example). It can be passed to a rule to provide access to the context of that rule, e.g. the associated binding and UI element as well as other useful data.

Hierarchy

Implements

Summary

Constructors

Properties

Class Properties

Inherited Properties

Currently none inherited from the parent class(es).

Accessors

Class Accessors

Inherited Accessors

Currently none inherited from the parent class(es).

Methods

Class Methods

Inherited Methods

Currently none inherited from the parent class(es).

Constructors

Constructor

+ new ClientAPI(_context: IContext): ClientAPI

Parameters:

Name Type
_context IContext

Returns: ClientAPI

Properties

Protected _context

_context: IContext

Accessors

actionResults

Get Signature

getter

Access to the action results from the client data

Returns

any

provide property for action results

Implementation of IClientAPI.actionResults


binding

Get Signature

getter

Access to the context's binding property

Returns

Object

Provide a simple property access to the binding

Implementation of IClientAPI.binding


currentPage

Get Signature

getter

Get the topmost page in the navigation stack

Returns

any

Get the topmost page in the navigation stack

Implementation of IClientAPI.currentPage


filterTypeEnum

Get Signature

getter

Returns enum for specifying filterType in createFilterCriteria API. Has two values, Filter and Sorter.

Returns

typeof FilterType

Returns Enum for specifying filterType in createFilterCriteria API. Has two values, Filter and Sorter.

Implementation of IClientAPI.filterTypeEnum


mdkWindows

Get Signature

getter

Returns

IMDKWindows

Methods

Protected _clientAPIProps

_clientAPIProps(): IClientAPIProps

Returns: IClientAPIProps


Protected _getExecuteSource

_getExecuteSource(): ExecuteSource

Returns: ExecuteSource


base64StringToBinary

base64StringToBinary(base64: string): Promise<any>

This method converts base64 string to binary data

Implementation of IClientAPI.base64StringToBinary

Parameters:

Name Type Description
base64 string base64 string

Returns: Promise<any>

a promise with a binary data once it is resolved


binaryToBase64String

binaryToBase64String(binary: any): Promise<string>

This method converts binary data to a base64 string.

Implementation of IClientAPI.binaryToBase64String

Parameters:

Name Type Description
binary any The binary data as a Uint8Array.

Returns: Promise<string>

a promise with a string once it is resolved


callFunction

callFunction(serviceName: string, functionInfo: function information, headers?): Promise<any>

Invoke an OData function import. Returns a Promise which resolves to the result(if existing) of the operation

Parameters:

Name Type Description
serviceName string service name
functionInfo function information
Name

string

Parameters?

{ key: string; value: any; }

Parameters.key

string

Parameters.value

any

headers?

Object

optional -- request headers

Returns: Promise<any>

returns a Promise which resolves to the result (if existing) of the operation

Implementation of IClientAPI.callFunction


convertFilterCriteriaArrayToJSONString

convertFilterCriteriaArrayToJSONString(filters: FilterCriteria[]): string

Convert array of FilterCriteria to JSON string, which can be restored back later using convertJSONStringToFilterCriteriaArray().

Implementation of IClientAPI.convertFilterCriteriaArrayToJSONString

Parameters:

Name Type Description
filters FilterCriteria[] array of FilterCriteria, e.g. filters of a sectioned table.

Returns: string

the JSON string


convertJSONStringToFilterCriteriaArray

convertJSONStringToFilterCriteriaArray(jsonString: string): FilterCriteria[]

Convert a JSON string returned by from convertFilterCriteriaArrayToJSONString() to an array of FilterCriteria.

Implementation of IClientAPI.convertJSONStringToFilterCriteriaArray

Parameters:

Name Type Description
jsonString string JSON string returned from convertFilterCriteriaArrayToJSONString().

Returns: FilterCriteria[]

the array of FilterCriteria


count

count(serviceName: string, entitySet: string, queryOptions?: string, headers?: Object, requestOptions?: Object): Promise<any>

Perform a count on an entity set.

Implementation of IClientAPI.count

Parameters:

Name Type Description
serviceName string service name
entitySet string entityset name
queryOptions? string query options
headers? Object request headers
requestOptions? Object request options

Returns: Promise<any>

returns a Promise which resolves to the result of the operation


create

create(serviceName: string, entitySet: string, properties: an object to store the properties using key/value pair, createLinks, headers?, requestOptions?): Promise<any>

Perform an operation to create OData entity. Returns a Promise of the operation result.

Parameters:

Name Type Description
serviceName string service name
entitySet string entity set name
properties an object to store the properties using key/value pair
key

string

value

any

ILinkSpecifierProxy[]

list of readlinks

headers?

request headers

key

string

value

any

requestOptions?

request options

key

string

value

any

Returns: Promise<any>

Implementation of IClientAPI.create


createFilterCriteria

createFilterCriteria(filterType: FilterType, name: string, caption: string, filterItems: object[], isFilterItemsComplex?: boolean, label?: string, filterItemsDisplayValue?: string[]): FilterCriteria

Create filter criteria for non-supported controls(except Filter & Sorter formcell) to be used in Filter page.

Implementation of IClientAPI.createFilterCriteria

Parameters:

Name Type Description
filterType FilterType filterTypeEnum value (Filter or Sorter).
name string Property name on which the filter is applied. If FilterCriteria is complex query, name will be used as CustomQueryGroup to match with FastFilter items in FilterFeedbackBar.
caption string Name of the control.
filterItems object[] Array of filter items.
isFilterItemsComplex? boolean True if the filterItems contains logical/lambda operators, default is false. If set to true, name and caption properties are ignored.
label? string label to be displayed beside display value when the item is being shown as selected item on filter feedback bar. Default is empty string.
filterItemsDisplayValue? string[]

Returns: FilterCriteria

the created FilterCriteria


createFilterSelection

createFilterSelection(name: string, values: object[]): FilterSelection

Create filter selection as initial values for FilterBar controls

Parameters:

Name Type Description
name string name of FilterBar control on which the filter value is applied.
values object[] Array of filter values.

Returns: FilterSelection

the created FilterSelection


createLinkSpecifierProxy

createLinkSpecifierProxy(property: string, entitySet: string, queryOptions?: string, readLink?: string): ILinkSpecifierProxy

Create LinkSpecifierProxy to be consumed by odata link action. one of queryOptions or readLink is required.

Implementation of IClientAPI.createLinkSpecifierProxy

Parameters:

Name Type Description
property string property name
entitySet string entityset name
queryOptions? string query options
readLink? string readlink name

Returns: ILinkSpecifierProxy


createSorterSelection

createSorterSelection(name: string, values: object[]): FilterSelection

Create filter selection as initial values for FilterBar sorter controls

Parameters:

Name Type Description
name string name of FilterBar control on which the sorter value is applied.
values object[] Array of sorter values.

Returns: FilterSelection

the created FilterSelection


deleteODataCacheImages

deleteODataCacheImages(): void

Delete OData cache images Note: This function is for iOS & Android only

Implementation of IClientAPI.deleteODataCacheImages

Returns: void


dismissActivityIndicator

dismissActivityIndicator(id?: number): void

Dismiss activity indicator

Implementation of IClientAPI.dismissActivityIndicator

Parameters:

Name Type Description
id? number The id of the activity indicator to be dismissed. If no id is provided, the top activity indicator will be dismissed. Using ids ensures that the right text will be shown at all times if multiple indicators can be displayed, for example due to chained actions.

Returns: void


downloadInProgressForPage

downloadInProgressForPage(page: string): boolean

Determine if a dowload is in progress for this page

Implementation of IClientAPI.downloadInProgressForPage

Parameters:

Name Type
page string

Returns: boolean


downloadInProgressForReadLink(readLink: string): boolean

Determine if a dowload is in progress for this readLink

Implementation of IClientAPI.downloadInProgressForReadLink

Parameters:

Name Type
readLink string

Returns: boolean


evaluateTargetPath

evaluateTargetPath(path: string): any

Evaluate a target path and return the value from the resulting context.

Implementation of IClientAPI.evaluateTargetPath

Parameters:

Name Type Description
path string the target path to be evaluated

Returns: any

the value from the resulting context If an element is on the context, consider that the final value. Otherwise use binding.


evaluateTargetPathForAPI

evaluateTargetPathForAPI(path: string): IClientAPI

Evaluate a target path and return the ClientAPI instance which encapsulates the result

Implementation of IClientAPI.evaluateTargetPathForAPI

Parameters:

Name Type Description
path string the target path to be evaluated. Cannot be undefined or empty

Returns: IClientAPI

a ClientAPI instance holding the result of target path evaluation, which can vary from a simple string to a view representation.


executeAction

executeAction(actionPath: string): Promise<IActionResult>

Execute an action. To ensure that the application waits for the action to complete, you must return the Promise returned by this method as the result of the rule. Not doing this may cause the action binding and pressed item to be reset before the action completes.

Implementation of IClientAPI.executeAction

Parameters:

Name Type Description
actionPath string the action path

Returns: Promise<IActionResult>


formatBase64String

formatBase64String(base64: string, contentType: string): string

This method formats MDK base64 string with content type

Implementation of IClientAPI.formatBase64String

Parameters:

Name Type Description
base64 string base64 string
contentType string base64 content type like "image/jpeg", "application/pdf"

Returns: string

formatted base64 string.


formatCurrency

formatCurrency(value: number, currencyCode: string, customLocale?: string, customOptions?: any): string

This method is to format number into currency display format according to selected locale

Implementation of IClientAPI.formatCurrency

Parameters:

Name Type Description
value number numeric value to be formatted into currency display format
currencyCode string currency code to format
customLocale? string custom locale to be used in formatting the value
customOptions? any custom options to be used in formatting the value. The available options are:
  • minimumIntegerDigits: The number of integer digits allowed as output. Default is 1 (System default).
  • minimumFractionDigits: The minimum number of digits after the decimal separator allowed as output. Default is 0 (System default).
  • maximumFractionDigits: The maximum number of digits after the decimal separator allowed as output. The default is managed by system default based on currency code.
  • useGrouping: Determines whether the display should show the group separator. The default is managed by system default based on currency code.

Example: {maximumFractionDigits:2,useGrouping:true}

Returns: string

formatted number in currency display format


formatDate

formatDate(date: Date, customLocale?: string, customTimeZone?: string, customOptions?: any): string

This method is to format date object into locale Date string.

Implementation of IClientAPI.formatDate

Parameters:

Name Type Description
date Date date value to be formatted into locale string. Accepted values are datetime object, datetime in UTC string, timestamp number, datetimeoffset string
customLocale? string custom locale to be used in formatting the value
customTimeZone? string custom time zone to be used in formatting the value, must be a valid time zone name e.g. UTC, GMT+8, Europe/Berlin
customOptions? any custom options (in JSON object format) for formatting the value. Currently the supported key is 'format' with the following possible values:
  • 'short'
  • 'medium'
  • 'long'
  • 'full'
The default is 'medium'. For example: { "format": "long" }.

Returns: string

formatted string


formatDatetime

formatDatetime(date: Date, customLocale?: string, customTimeZone?: string, customOptions?: any): string

This method is to format date object into locale DateTime string

Implementation of IClientAPI.formatDatetime

Parameters:

Name Type Description
date Date date value to be formatted into locale string. Accepted values are datetime object, datetime in UTC string, timestamp number, datetimeoffset string
customLocale? string custom locale to be used in formatting the value
customTimeZone? string custom time zone to be used in formatting the value. Must be a valid time zone name e.g. UTC, GMT+8, Europe/Berlin
customOptions? any custom options (in JSON object format) for formatting the value. Currently the supported key is 'format' with the following possible values:
  • 'short'
  • 'medium'
  • 'long'
  • 'full'
The default is 'medium' for date and 'short' for time. For example: { "format": "full" }.

Returns: string

formatted string


formatNumber

formatNumber(value: number, customLocale?: string, customOptions?: any): string

This method is to format number according to selected locale

Implementation of IClientAPI.formatNumber

Parameters:

Name Type Description
value number numeric value to be displayed in format according to selected locale
customLocale? string custom locale to be used in formatting the value
customOptions? any custom options to be used in formatting the value. The available options are:
  • minimumIntegerDigits: The number of integer digits allowed as output. Default is 1 (System default).
  • minimumFractionDigits: The minimum number of digits after the decimal separator allowed as output. Default is 0 (System default).
  • maximumFractionDigits: The maximum number of digits after the decimal separator allowed as output. Default is 2 (MDK default).
  • useGrouping: Determines whether the display should show the group separator. Default is true (MDK default).

Example: {maximumFractionDigits:2,useGrouping:true}

Returns: string

formatted number


formatPercentage

formatPercentage(value: number, customLocale?: string, customOptions?: any): string

This method is to format number to into percent display format

Implementation of IClientAPI.formatPercentage

Parameters:

Name Type Description
value number numeric value to be formatted into percent display string
customLocale? string custom locale to be used in formatting the value
customOptions? any custom options to be used in formatting the value. The available options are:
  • minimumIntegerDigits: The number of integer digits allowed as output. Default is 1 (System default).
  • minimumFractionDigits: The minimum number of digits after the decimal separator allowed as output. Default is 0 (System default).
  • maximumFractionDigits: The maximum number of digits after the decimal separator allowed as output. Default is 2 (MDK default).
  • useGrouping: Determines whether the display should show the group separator. Default is true (MDK default).

Example: {maximumFractionDigits:2,useGrouping:true}

Returns: string

formatted number in percentage


formatScientific

formatScientific(value: number, customLocale?: string, customOptions?: any): string

This method is to format scientific style number according to selected locale

Implementation of IClientAPI.formatScientific

Parameters:

Name Type Description
value number numeric value to be displayed in scientific style according to selected locale
customLocale? string custom locale to be used in formatting the value
customOptions? any custom options to be used in formatting the value: The available options are:
  • minimumIntegerDigits: The number of integer digits allowed as output. Default is 1 (System default).
  • minimumFractionDigits: The minimum number of digits after the decimal separator allowed as output. Default is 0 (System default).
  • maximumFractionDigits: The maximum number of digits after the decimal separator allowed as output. Default is 2 (MDK default).
  • useGrouping: Determines whether the display should show the group separator. Default is true (MDK default).

Example: {maximumFractionDigits:2,useGrouping:true}

Returns: string

formatted number


formatTime

formatTime(date: Date, customLocale?: string, customTimeZone?: string, customOptions?: any): string

This method is to format date object into locale Time string

Implementation of IClientAPI.formatTime

Parameters:

Name Type Description
date Date date value to be formatted into locale string. Accepted values are datetime object, datetime in UTC string, timestamp number, datetimeoffset string
customLocale? string custom locale to be used in formatting the value
customTimeZone? string custom time zone to be used in formatting the value. Must be a valid time zone name e.g. UTC, GMT+8, Europe/Berlin
customOptions? any custom options (in JSON object format) for formatting the value. Currently the supported key is 'format' with the following possible values:
  • 'short'
  • 'medium'
  • 'long'
  • 'full'
The default is 'short'. For example: { "format": "long" }.

Returns: string

formatted string


getActionResult

getActionResult(key: string): IActionResult

Get the action result stored under the unique key

Implementation of IClientAPI.getActionResult

Parameters:

Name Type
key string

Returns: IActionResult


getAppClientData

getAppClientData(): IClientData

Get the Application context client data object. This starts out as a plain JavaScript object, and can be modified to hold application state. Can only be accessed for IClientAPI instances associated with a UI element, because that guarantees that the data will last for the lifetime of that element.

Implementation of IClientAPI.getAppClientData

Returns: IClientData


getAppearanceMode

getAppearanceMode(): "light" | "dark"

This method is to get current ui appearance of the app.

Implementation of IClientAPI.getAppearanceMode

Returns: "light" | "dark"

return the current ui appearance as light or dark


getAppEventData()

getAppEventData(): any

Get the data which provides additional information about an app event such as an app launch or exit, if such an event just occurred.

Returns: any

Deprecated

  • use getEventData() instead, which returns a typed proxy with named properties for easier and safer access to event data.

Implementation of IClientAPI.getAppEventData


getAppName

getAppName(): string

This method is to get the value of _Name property for client application

Implementation of IClientAPI.getAppName

Returns: string


getAvailableThemes

getAvailableThemes(): string[]

This method is to get available themes in app settings.

Implementation of IClientAPI.getAvailableThemes

Returns: string[]

return available themes in array


getBindingObject()

getBindingObject(): Object

Get the current context's binding object

Returns: Object

Deprecated

Implementation of IClientAPI.getBindingObject


getCircularImage

getCircularImage(base64EncodedImageStr: string): string

Converts a regular rectangular image into a circular one.

Implementation of IClientAPI.getCircularImage

Parameters:

Name Type Description
base64EncodedImageStr string The Base64 image string which is to be made circular

Returns: string

A Base64 string of the circular image, this image will be in PNG format.


getClientData

getClientData(): IClientData

Get the client data object. This starts out as a plain JavaScript object and can be modified to hold application state. Can only be accessed by the IClientAPI instances associated with a UI element, because that guarantees that the data will last for the lifetime of that element.

Implementation of IClientAPI.getClientData

Returns: IClientData


getDefinitionValue

getDefinitionValue(target: string): Promise<any>

Return the value for given definition.

Implementation of IClientAPI.getDefinitionValue

Parameters:

Name Type Description
target string : any valid definition like rule/action path/global path/binding/targetpath etc

Returns: Promise<any>

Promise resolution.


getEventData

getEventData(): IBaseEventData

Gets the event data instance, which provides additional information about an event that’s triggered, if such an event has occurred. This function will return a proxy instance only when ClientAPI is an event; otherwise, it returns null. Always check if this API returns null.

Implementation of IClientAPI.getEventData

Returns: IBaseEventData


getGlobalDefinition

getGlobalDefinition(globalPath: string): any

Get the global definition for the specified path

Implementation of IClientAPI.getGlobalDefinition

Parameters:

Name Type
globalPath string

Returns: any


getGlobalSideDrawerControlProxy

getGlobalSideDrawerControlProxy(): ISideDrawerControlProxy

Get the global side drawer control proxy

Returns: ISideDrawerControlProxy


getIconTextImage

getIconTextImage(iconText: string, width: number, height: number, isCircular: boolean, stylesJSON?: string): string

Creates an Image out of text provided in the iconText parameter. A max of two letters can be displayed on the image.

Implementation of IClientAPI.getIconTextImage

Parameters:

Name Type Description
iconText string Text that is to be used for generating the IconTextImage
width number Width of the image
height number Heght of the image
isCircular boolean Decides whether the image should be circular in shape
stylesJSON? string FontSize, FontColor and BackgroundColor can be given in a Json to style the IconTextImage

Returns: string

a Base64 string of IconTextImage.


getLanguage

getLanguage(): string

This method is to get current app language from app settings.

Implementation of IClientAPI.getLanguage

Returns: string

app language


getLogger

getLogger(): LoggerManager

Get the singleton instance of the LoggerManager. If it has not been initialized yet, it throws exception

Implementation of IClientAPI.getLogger

Returns: LoggerManager


getMobileServiceAppId

getMobileServiceAppId(): string

This method is to get AppId used for application in SAP Mobile Services.

Implementation of IClientAPI.getMobileServiceAppId

Returns: string


getMobileServiceEndpointUrl

getMobileServiceEndpointUrl(): string

This method is to get Endpoint Url of connection to application in SAP Mobile Services.

Implementation of IClientAPI.getMobileServiceEndpointUrl

Returns: string


getODataCacheImagePath

getODataCacheImagePath(path: string, mimeType?: string): Promise<string>

Get OData cache image path Note: This function is for iOS & Android only.

Implementation of IClientAPI.getODataCacheImagePath

Parameters:

Name Type Description
path string OData direct image rendering path
mimeType? string Mime type, which is used to determine the image file extension if the image type can not be resolved from the path.

Returns: Promise<string>

OData cache image path


getODataProvider

getODataProvider(serviceName: string): ODataProviderProxy

Get OData provider based on service name

Implementation of IClientAPI.getODataProvider

Parameters:

Name Type
serviceName string

Returns: ODataProviderProxy


getPageDefinition

getPageDefinition(pagePath: string): any

Get Page metadata definition for the specified path as JSON object.

Implementation of IClientAPI.getPageDefinition

Parameters:

Name Type
pagePath string

Returns: any


getPasscodeSource

getPasscodeSource(): number

Get the passcode source

Implementation of IClientAPI.getPasscodeSource

Returns: number

passcode source

  • 0 - no passcode or unknown
  • 1 - user
  • 2 - device (iOS only)
  • 3 - device and user (Android only)
Note: Android must always have a passcode for biometrics hence value 3.


getPendingDownload

getPendingDownload(page: string): any

This method delgates to the AppSettingsManager to determine if the current page has a pending download.

Implementation of IClientAPI.getPendingDownload

Parameters:

Name Type Description
page string page object path

Returns: any

returns a pending download for this page, which is a JSON action binding associated with the download. Otherwise undefined.


getReadLink(path: string): string

get the current context's binding's read link if any. Undefined otherwise

Implementation of IClientAPI.getReadLink

Parameters:

Name Type Description
path string target path into the binding

Returns: string


getRegion

getRegion(): string

This method is to get current app region from app settings.

Implementation of IClientAPI.getRegion

Returns: string

app region


getRegions

getRegions(): Object

This method is to get list of regions

Implementation of IClientAPI.getRegions

Returns: Object

list of regions in key value pairs


getSAPPassportHeaderValue

getSAPPassportHeaderValue(componentName: string, action: string, traceFlag: string, componentType: string, prevComponentName?: string, userId?: string): string

Get SAP Passport header value

Implementation of IClientAPI.getSAPPassportHeaderValue

Parameters:

Name Type Description
componentName string Name of the initial component. Default to 'MDK' if empty or null.
action string Name of executed action. Default to 'HTTP_Request' if empty.
traceFlag string Trace configuration. Accepted values are: StatisticsOnly, SAPTraceLevel_SQL, SAPTraceLevel_Buffer, SAPTraceLevel_Enqueu, SAPTraceLevel_RFC, SAPTraceLevel_Permission, SAPTraceLevel_Free, SAPTraceLevel_CFunction, DSR_ABAP_Trace_Flag, SAPTraceLevel_ABAPCondens0, SAPTraceLevel_ABAPCondens1, DSR_SAT_Trace_Flag, ESP_WebService_Flag, HTTP, TRCLVL_None, TRCLVL_Low, TRCLVL_Medium, TRCLVL_High. Default is 'TRCLVL_Low' if empty or null.
componentType string Type of initial component. Accepted values are: Undefined, Webas, J2EE, Trex, ICM, Gateway, CPIC, Browser, TraceLib, DotNet, Eclipse, PI_For_SAP_Sender, SCP_For_NonSAP_Sender, PI_For_NonSAP_Sender, SAP_Partner, SCP_Request_Or_Determination_Later_In_Processing, S4, SFSF, Ariba, Concur, Fieldglass, Callidus, BYD, IBP, Hybris, SMB_B1, Industry_Cloud, Leonardo, Customer_Checkout, CoPilot. Default to 'Undefined' if empty or null.
prevComponentName? string Optional. Name of previous component. Default to initial component name if unspecified.
userId? string Optional. ID of user who is processing the request. Default is '' if unspecified.

Returns: string

a string of SAP Passport value to be used on request header. The header name to be used is "SAP-PASSPORT".


getSupportedLanguages

getSupportedLanguages(): Object

This method is to get list of supported languages

Implementation of IClientAPI.getSupportedLanguages

Returns: Object

list of supported languages in key value pairs


getTheme

getTheme(): string

This method is to get current theme from app settings.

Implementation of IClientAPI.getTheme

Returns: string

return the current theme


getUseInAppCamera

getUseInAppCamera(): boolean

This method is to get the current state of usage of in-app camera for Android Attachment form cell control.

Implementation of IClientAPI.getUseInAppCamera

Returns: boolean


getVersionInfo

getVersionInfo(): Object

Get the versions of application, definitions, SDK and etc.

Implementation of IClientAPI.getVersionInfo

Returns: Object

It returns an array of key/value pairs to represent the versions for different components. iOS app and Android app may have different components and versions.

iOS app may include the following keys:

  • "Application Version": AppVersion from MDKProject.json
  • "Definitions Version": Version from Application.app in the metadata
  • "SAPMDC": MDK client version
  • SDK libraries used by MDK:
    • "SAPCommon"
    • "SAPFiori"
    • "SAPFioriFlows"
    • "SAPFoundation"
    • "SAPOfflineOData"
    • "SAPOData"

    Android app may include the following keys:

  • "Application Version": AppVersion from MDKProject.json
  • "Definitions Version": Version from Application.app in the metadata
  • "MDKClient Version": MDK client version
  • SDK libraries used by MDK:
    • "com.sap.cloud.android:foundation"
    • "com.sap.cloud.android:onboarding"
    • "com.sap.cloud.android:fiori"
    • "com.sap.cloud.android:odata"
    • "com.sap.cloud.android:offline-odata"

    Web application may include the following keys:

  • "Definition Version": Version from Application.app in the metadata
  • "WebClient Version": Web client version
  • SDK libraries used by MDK:
    • "@ui5/webcomponents Version"
    • "ui5-webcomponents-mdk Version"


    initializeLogger

    initializeLogger(fileName?: undefined = undefined, maxFileSize?: undefined = undefined): void

    Initializes the LoggerManager and adds the log file handlers

    Implementation of IClientAPI.initializeLogger

    Parameters:

    Name Type Description
    fileName? undefined = undefined Optional, File name of the local log file on the client device. If missing, default value is ClientLog.txt
    maxFileSize? undefined = undefined Optional, Max file size before rollover of the local log file on the client device. If missing, default value is 5MB

    Returns: void


    isAppInMultiUserMode

    isAppInMultiUserMode(): boolean

    Determine if the application is in single or multi user mode.

    Implementation of IClientAPI.isAppInMultiUserMode

    Returns: boolean


    isCurrentPage

    isCurrentPage(pageName: string): boolean

    Determine if the page is the topmost page in the navigation stack

    Implementation of IClientAPI.isCurrentPage

    Parameters:

    Name Type
    pageName string

    Returns: boolean


    isDemoMode

    isDemoMode(): boolean

    Determine if it is in demo mode

    Implementation of IClientAPI.isDemoMode

    Returns: boolean


    isDeviceCompliant

    isDeviceCompliant(): Boolean

    This method ensures the device meets compliance standards.

    Implementation of IClientAPI.isDeviceCompliant

    Returns: Boolean

    true if the device is compliant, false otherwise.


    isMediaLocal

    isMediaLocal(serviceName: string, entitySet: string, readLink: string): Promise<boolean>

    Get whether or not the media object for the supplied readLink is available in local

    Implementation of IClientAPI.isMediaLocal

    Parameters:

    Name Type Description
    serviceName string service name
    entitySet string entityset name
    readLink string readlnk name

    Returns: Promise<boolean>

    a promise with a boolean result once it is resolved


    localizeText

    localizeText(key: string, dynamicParams?: string[]): string

    This method is to localize text

    Implementation of IClientAPI.localizeText

    Parameters:

    Name Type Description
    key string key of text to be localized
    dynamicParams? string[]

    Returns: string

    localized text


    read

    read(serviceName: string, entitySet: string, properties: string[], queryOptions?: string, headers?: Object, requestOptions?: Object): Promise<any>

    Perform a query on an entity set. Returns a Promise which resolves to the result of the operation

    Implementation of IClientAPI.read

    Parameters:

    Name Type Description
    serviceName string service name
    entitySet string entityset name
    properties string[] list of properties to be read
    queryOptions? string query optins
    headers? Object request headers
    requestOptions? Object request options

    Returns: Promise<any>

    returns a Promise which resolves to the result of the operation


    sendMobileServiceRequest()

    sendMobileServiceRequest(path: string, params?: any): Promise<any>

    Send a request to application's SAP Mobile Services

    Parameters:

    Name Type
    path string
    params? any

    Returns: Promise<any>

    Deprecated

    • use the new sendRequest API

    Implementation of IClientAPI.sendMobileServiceRequest


    sendRequest

    sendRequest(path: string, params?: any): Promise<IHttpResponse>

    This method is to send a request to application's SAP Mobile Services.

    Example of the params parameter:

    {
      method: "<string>",
      header: {
        "<key1>": "<value as string>",
        "<key2>": "<and so on>",
      },
      body: "<string>"
    }
    

    Implementation of IClientAPI.sendRequest

    Parameters:

    Name Type Description
    path string Relative path of request via application's SAP Mobile Services.
    params? any Optional. An object consists of method, header, and body of request.
    Note: If params is not given, request is set as GET method by default. See description above for the example.
  • method is string representing the HTTP Method to use. Supported value for methods are: GET, HEAD, POST, PUT, DELETE, PATCH and OPTIONS.
  • header should be an object with key-value pair
  • body should be request body String, Binary, FormData, JSON object or Array.
  • - String should be a string converted from data payload based on the "Content-Type" set in header.
  • - Binary should be native data from file. The "Content-Type" in header should be set according to the content of file.
  • - FormData is converted to binary with the request body specially formatted as a series of "parts", separated with MIME boundaries. The "Content-Type" in header should be set to multipart/form-data.
  • - JSON Object or Array is converted to JSON string. The "Content-Type" in header is set to application/json by default.
  • Returns: Promise<IHttpResponse>

    Returns a Http response object


    setApplicationIconBadgeNumber

    setApplicationIconBadgeNumber(badge: number): void

    Set the application icon badge number Note: This function is for iOS only

    Implementation of IClientAPI.setApplicationIconBadgeNumber

    Parameters:

    Name Type Description
    badge number the number to set

    Returns: void


    setDebugSettings

    setDebugSettings(debugODataProvider?: boolean = false, tracingEnabled?: boolean = false, categories?: string[] = []): void

    Client API to enable/override the DebugSettings during runtime

    Implementation of IClientAPI.setDebugSettings

    Parameters:

    Name Type Description
    debugODataProvider? boolean = false boolean to add console logger to the OData provider set to Debug level
    tracingEnabled? boolean = false boolean to turns on tracing (execution time) for rules, actions, and so on.
    categories? string[] = [] array of tracing categories to enable the console log based on categories.

    Returns: void


    setLanguage

    setLanguage(languageKey: string): void

    This method is to set app language into app settings.

    Implementation of IClientAPI.setLanguage

    Parameters:

    Name Type Description
    languageKey string language key

    Returns: void


    setRegion

    setRegion(region: string): void

    This method is to set app region into app settings. Different from the region specifier in SetLanguage, setRegion only affects formatting, e.g. date and number formats.

    Implementation of IClientAPI.setRegion

    Parameters:

    Name Type Description
    region string region

    Returns: void


    setTheme

    setTheme(newTheme: string): boolean

    This method is to set theme into app settings and apply for application. Application will restart from main page, with new theme effect.

    Implementation of IClientAPI.setTheme

    Parameters:

    Name Type Description
    newTheme string theme name

    Returns: boolean

    return set theme result in boolean


    setUseInAppCamera

    setUseInAppCamera(value: boolean): void

    This method is to enable or disable usage of in-app camera for Android Attachment form cell control. The new value will be effective immediately. Specifically for already rendered attachment formcell controls on the current page will only take effect after being resetted through control reset() API. Do note that by calling control reset() API, the existing attachments would be discarded.

    Implementation of IClientAPI.setUseInAppCamera

    Parameters:

    Name Type Description
    value boolean value to enable or disable usage of in-app camera for Android Attachment form cell control

    Returns: void


    showActivityIndicator

    showActivityIndicator(text?: string): number

    Show activity indicator with specified text

    Implementation of IClientAPI.showActivityIndicator

    Parameters:

    Name Type Description
    text? string The text to be shown

    Returns: number

    The id which can be used to dismiss the activity indicator


    updateProgressBanner

    updateProgressBanner(message: string): void

    Update an existing progress banner with new text. If no progress banner action is in progress, no banner will be displayed.

    Implementation of IClientAPI.updateProgressBanner

    Parameters:

    Name Type Description
    message string The text to show on the progress banner

    Returns: void


    Static Create

    Create(context: IContext): ClientAPI

    Create an instance of ClientAPI or its extended classes such as PageProxy, ControlProxy.

    Parameters:

    Name Type Description
    context IContext an object with IContext type to represent the UI element

    Returns: ClientAPI


    Static setMdkWindows

    setMdkWindows(mdkWindows: IMDKWindows): void

    Parameters:

    Name Type
    mdkWindows IMDKWindows

    Returns: void