Skip to content

Interface: IClientAPI

Hierarchy

Implemented by

Summary

Properties

Class Properties

Inherited Properties

Currently none inherited from the parent class(es).

Methods

Class Methods

Inherited Methods

Currently none inherited from the parent class(es).

Properties

actionResults

actionResults: any


binding

binding: Object


currentPage

currentPage: any


filterTypeEnum

filterTypeEnum: FilterType


nativescript

nativescript: any

Methods

base64StringToBinary

base64StringToBinary(base64: string): Promise‹any›

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›

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, oFunction: object, headers?: Object): Promise‹any›

Parameters:

serviceName: string

oFunction: object

Name Type
Name string
Parameters? object

Optional headers: Object

Returns: Promise‹any›

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


convertFilterCriteriaArrayToJSONString

convertFilterCriteriaArrayToJSONString(filters: Array‹FilterCriteria›): string

Parameters:

Name Type Description
filters Array‹FilterCriteria array of FilterCriteria, e.g. filters of the sectioned table.

Returns: string

the JSON string


convertJSONStringToFilterCriteriaArray

convertJSONStringToFilterCriteriaArray(jsonString: string): Array‹FilterCriteria

Parameters:

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

Returns: Array‹FilterCriteria

the array of FilterCriteria


count

count(serviceName: string, entitySet: string, queryOptions?: string, headers?: Object, requestOptions?: Object): Promise‹number›

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‹number›

returns a Promise which resolves to the result of the operation


create

create(serviceName: string, entitySet: string, properties: object, createLinks: ILinkSpecifierProxy[], headers?: object, requestOptions?: object): Promise‹any›

Parameters:

serviceName: string

entitySet: string

properties: object

Name Type
key string
value any

createLinks: ILinkSpecifierProxy[]

Optional headers: object

Name Type
key string
value any

Optional requestOptions: object

Name Type
key string
value any

Returns: Promise‹any›


createFilterCriteria

createFilterCriteria(filterType: FilterType, name: string, caption: string, filterItems: Array‹object›, isFilterItemsComplex?: boolean, label?: any, filterItemsDisplayValue?: any): FilterCriteria

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 Array‹object› Array of display value of the filter items. Default is null.
isFilterItemsComplex? boolean True if the filterItems contains logical/lambda operators, default is false. If set to true, name and caption properties are ignored.
label? any 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? any -

Returns: FilterCriteria

the created FilterCriteria


createLinkSpecifierProxy

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

Parameters:

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

Returns: ILinkSpecifierProxy


deleteODataCacheImages

deleteODataCacheImages(serviceFileName?: string, entityName?: string): any

Parameters:

Name Type
serviceFileName? string
entityName? string

Returns: any


dismissActivityIndicator

dismissActivityIndicator(id?: number): void

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

Parameters:

Name Type
page string

Returns: boolean


downloadInProgressForReadLink(readLink: string): boolean

Parameters:

Name Type
readLink string

Returns: boolean


evaluateTargetPath

evaluateTargetPath(path: string): any

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

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): any

Parameters:

Name Type Description
actionPath string the action path

Returns: any


formatBase64String

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

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

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

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 value:
  • 'short'
  • 'medium'
  • 'long'
  • 'full'
Default: medium

Returns: string

formatted string


formatDatetime

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

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 value:
  • 'short'
  • 'medium'
  • 'long'
  • 'full'
Default: medium (date), short (time)

Returns: string

formatted string


formatNumber

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

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

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

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

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 value:
  • 'short'
  • 'medium'
  • 'long'
  • 'full'
Default: short

Returns: string

formatted string


getActionResult

getActionResult(key: string): IActionResult

Parameters:

Name Type
key string

Returns: IActionResult


getAppClientData

getAppClientData(): Object

Returns: Object


getAppEventData

getAppEventData(): any

Returns: any


getAppName

getAppName(): string

Returns: string


getAppearanceMode

getAppearanceMode(): "light" | "dark"

Returns: "light" | "dark"

return the current ui appearance as light or dark


getAvailableThemes

getAvailableThemes(): string[]

Returns: string[]

return available themes in array


getBindingObject

getBindingObject(): Object

Returns: Object


getCircularImage

getCircularImage(base64EncodedImageStr: string): string

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 extensions.


getClientData

getClientData(): Object

Returns: Object


getDefinitionValue

getDefinitionValue(target: string): Promise‹any›

Parameters:

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

Returns: Promise‹any›

Promise resolution.


getGlobalDefinition

getGlobalDefinition(globalPath: string): any

Parameters:

Name Type
globalPath string

Returns: any


getIconTextImage

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

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 true 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

Returns: string

app language


getLogger

getLogger(): LoggerManager

Returns: LoggerManager


getMobileServiceAppId

getMobileServiceAppId(): string

Returns: string


getMobileServiceEndpointUrl

getMobileServiceEndpointUrl(): string

Returns: string


getODataCacheImagePath

getODataCacheImagePath(path: string, mimeType?: string): Promise‹string›

Parameters:

Name Type Description
path string OData direct image rendering path
mimeType? string Mime Type

Returns: Promise‹string›

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


getODataProvider

getODataProvider(serviceName: string): any

Parameters:

Name Type
serviceName string

Returns: any


getPageDefinition

getPageDefinition(pagePath: string): any

Parameters:

Name Type
pagePath string

Returns: any


getPasscodeSource

getPasscodeSource(): number

Returns: number


getPendingDownload

getPendingDownload(page: string): any

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

Parameters:

Name Type Description
path string target path into the binding

Returns: string


getRegion

getRegion(): string

Returns: string

app region


getRegions

getRegions(): Object

Returns: Object

list of regions in key value pairs


getSAPPassportHeaderValue

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

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 null 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 to '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 to '' if unspecified.

Returns: string

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


getSupportedLanguages

getSupportedLanguages(): Object

Returns: Object

list of supported languages in key value pairs


getTheme

getTheme(): string

Returns: string

return the current theme


getUseInAppCamera

getUseInAppCamera(): boolean

Returns: boolean


getVersionInfo

getVersionInfo(): Object

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: string, maxFileSize: number): any

    Parameters:

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

    Returns: any


    isAppInMultiUserMode

    isAppInMultiUserMode(): boolean

    Returns: boolean


    isCurrentPage

    isCurrentPage(pageName: string): boolean

    Parameters:

    Name Type
    pageName string

    Returns: boolean


    isDemoMode

    isDemoMode(): boolean

    Returns: boolean


    isDeviceCompliant

    isDeviceCompliant(): Boolean

    Returns: Boolean

    true if the device is compliant, false otherwise.


    isMediaLocal

    isMediaLocal(serviceName: string, entitySet: string, readLink: string): Promise‹boolean›

    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

    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›

    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›

    Parameters:

    Name Type
    path string
    params? any

    Returns: Promise‹any›


    sendRequest

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

    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, CONNECT, OPTIONS, and TRACE.
  • 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): any

    Parameters:

    Name Type Description
    badge number the number to set

    Returns: any


    setDebugSettings

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

    Parameters:

    Name Type Description
    debugODataProvider boolean boolean to add console logger to the OData provider set to Debug level
    tracingEnabled boolean 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(language: string): void

    Parameters:

    Name Type
    language string

    Returns: void


    setRegion

    setRegion(region: string): void

    Parameters:

    Name Type Description
    region string region

    Returns: void


    setTheme

    setTheme(newTheme: string): boolean

    Parameters:

    Name Type Description
    newTheme string theme name

    Returns: boolean

    return set theme result in boolean


    setUseInAppCamera

    setUseInAppCamera(value: boolean): void

    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

    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

    Parameters:

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

    Returns: void