Start of Content Area

Syntax documentation Client Data Bag API  Locate the document in its SAP Library structure

The EPCF client data bag API provides methods to store data in a transient data buffer on the client.

EPCM.storeClientData(nameSpace, name, value)

This method saves data in value under a key. The key is generated by combining the parameters nameSpace and name. If the key already exists, the stored data will be overwritten.

Parameter Description

Parameter

Type

Description

nameSpace

String

URN for the first part of the key under which the data is stored. nameSpace will be combined with name.

name

String

This name, combined with namespace, creates the key under which the data is stored.

value

String

Data to be stored.

Caution

The parameter value must be of type String. Primitive data types will be converted to String, complex data types and references are not supported. This restriction is necessary to guarantee that the client data bag functions are working in a JavaScript environment using the browser cookies for clients that have no Java support.

 

Usage

<SCRIPT language ="JavaScript">

  var selectedPerson = "Tim Taylor"

  EPCM.storeClientData( "urn:com.sap.myObjects", "person",

  selectedPerson );

</SCRIPT>

 

EPCM.loadClientData(nameSpace, name)

This method returns the data stored under the specified key as String. The key is generated by a combination of the parameters nameSpace and name. If the key does not exist, the method returns null.

Parameter Description

Parameter

Type

Description

nameSpace

String

URN for the first part of the key from which the data is reloaded. nameSpace will be combined with name.

name

String

This name, combined with namespace, is the key from which the data is reloaded.

Usage

<SCRIPT language ="JavaScript">

  var person=EPCM.loadClientData("urn:com.sap.myObjects", "person");

  if ( person != null ){

  /* process person */

  }

</SCRIPT>

 

deleteClientData(nameSpace, name)

This method deletes the data stored under the specified key and the key itself. The key is generated by a combination of the parameters nameSpace and name.

Parameter Description

Parameter

Type

Description

nameSpace

String

URN for the first part of the key which is. nameSpace will be combined with name.

name

String

This name, combined with namespace, is the key from which is deleted.

Usage

<SCRIPT language ="JavaScript">

  EPCM.deleteClientData( "urn:com.sap.myObjects", "person" );

</SCRIPT>

 

End of Content Area