Wednesday, 2 December 2015

Put Time series to DB and read back


Macros are used primarily to perform the calculation in the planning grid, these calculations maybe situational and can be used to highlight a planning state.

The “Function” used in the macros are used to perform a special operation on the values given as Arguments of the function. The TS_GET and TS_SET are primarily used in order to transfer the live cache data to Database and extract from Database back to Livecac. Each data set transferred to the Database is associated with four attributes which identifies the data set uniquely.

We will see how we can use the function to save the time series data and how to retrieve it back from database in the rest of the document.

These functions can only send the time series value to Database not the order series as it is not capable to store the order type information.

How to use TS_SET:


TS_SET can only be used to transfer the time series values to live cache. This function uses 5 arguments and stores an area of time series from Live-cache to Database.  All these time series values are associated with four different attributes. Values of these attributes can be set using TS_SET function at the time while specifying the area of time series. Following section will take you though the syntax of TS_SET.

Syntax


Following is the syntax:

TS_SET( ARG1, … ARG5)

Where

ARG1 – First identifier can be a string of 10 characters.

ARG2 – Second identifier can be a string of 10 characters.

ARG3 – Third identifier can be a string of 10 characters.

ARG4 – Last identifier, can be a string of 10 characters.

ARG5 – Area of time series of a Keyfigure to be saved to database.

Example of TS_SET



 

In the above example, we have called the function with following values:

Argument 1: ‘Identifier1’

Argument 2: ACT_USER

Argument 3: ‘KEY2ANYKEY’

Argument 4: ‘KEYVAL3ANY’

Argument 5: Area of a Key figure promotion starting from 19.11.2012 till 15.12.2014 (104 week).

Result:


Once the macro executes the step having the function as TS_SET, the Time series values can be seen in the table /SAPAPO/ADV_SERI.





Figure 1 Times series saved in the data base

 

How to use TS_GET:


The data which we have saved can be read into a time series Keyfigure using macro function TS_GET. This function can be called with six arguments. The function can only right the data into a time series Keyfigure (Or auxiliary KFs). We have the choice to restrict the number of columns to be extracted from the database.

Syntax:


TS_GET will have six arguments as follows:

TS_GET (ARG1..ARG6). Where

ARG1:  First identifier in the database refers to column series ID of the table /SAPAPO/ADV_SERI.

AGR2: Second identifier in the database refers to column Key1 of the table /SAPAPO/ADV_SERI

AGR3: Third identifier in the database refers to column Key2 of the table /SAPAPO/ADV_SERI

AGR4: Fourth identifier in the database refers to column Key3 of the table /SAPAPO/ADV_SERI

AGR5: Start column. Values will be picked up from DB to Keyfigure starting from this column.

ARG6: End column. Value in this column will be specified as the end column, values will be picked up from BD to Keyfigure till this column.

Example:



 

 

In the above example, we have called the function with following values:

Argument 1: ‘Identifier1’

Argument 2: ACT_USER

Argument 3: ‘KEY2ANYKEY’

Argument 4: ‘KEYVAL3ANY’

Argument 5: We want to extract the data starting from the column 1.

Argument 6: Till the column 5.

Result:


Once the macro is executed, the initial 5 entries copied from Keyfigure Promotion which were copied to DB will have been extracted and copied to Keyfigure Impact as follows:

Following will be the result in Keyfigure impact: