cancel
Showing results for 
Search instead for 
Did you mean: 

SAC Data Action : send date value parameter

0 Kudos
2,242

Hi Experts

Could anyone help me with the below code please.

simple code but not working. I need to pass dynamic values to my data action for that I am first trying it out with constants then I will replace with script variables in Javascript.

DA_1.setParameterValue("CC_P", "GB1"); => company code dimension

DA_1.setParameterValue("MY_P", "202304"); => DATE dimension format "YYYYMM"

DA_1.execute();

The code above does not produce any errors, but it also does not perform the desired action of storing a value in the planning model. I would greatly appreciate any help or insights you can provide.

Thank you in advance.

Best regards,

M

Accepted Solutions (1)

Accepted Solutions (1)

N1kh1l
Active Contributor

malya_7

You need to use fully qualified member names when assigning the parameter for e.g. [SAP_CEP_PRODUCT].[H1].[MZ-FG-C900] See an example below.

Parameter setup: Hierarchy defined in parameter should be used in JavaScript assignment

Data Action: Keep most if the member scoped in MEMBERSET

MEMBERSET [d/MEASURE] = "QUANTITY"
MEMBERSET [d/SAP_CEP_PRODUCT]=BASEMEMBER([d/SAP_CEP_PRODUCT] , %P_Product%)
MEMBERSET [d/SAP_CEP_SALESORG]=BASEMEMBER([d/SAP_CEP_SALESORG] , %P_SalesOrg%)

MEMBERSET [d/SAP_CEP_CUSTOMER]="#"
MEMBERSET [d/SAP_CEP_ENTITY]="#"

DATA([d/CALMONTH]=%P_Date%)=1
Application.showBusyIndicator("Preparing for execution..."); 
// format is [DIMNAME].[HIERID].[MEMBER], the hierarchy id should be same as defined in param
DataAction_1.setParameterValue("P_Product","[SAP_CEP_PRODUCT].[H1].&["+"MZ-FG-C900"+"]");
DataAction_1.setParameterValue("P_SalesOrg","[SAP_CEP_SALESORG].[H1].&["+"SO0001"+"]");
DataAction_1.setParameterValue("P_Date","[CALMONTH].[YQM].&[" + "202301" +"]");
DataAction_1.execute();

Application.refreshData();
Application.hideBusyIndicator();
Application.showMessage(ApplicationMessageType.Success,"Executed Successfully");

Before DA run

After DA run

DA Monitor logs

Hope this helps !!

Please accept/upvote if this helps you

Nikhil

0 Kudos

Hi Nikhil,

Thanks for your reply again.

My date dimension is passing correctly now, but not the company code.

For my Company code dimension hierarchy is not enabled. so I am passing directly the value

DataAction_1.setParameterValue("CC_P","[Comp_code].&[" + "IE01" + "]");

DataAction_1.setParameterValue("P_Date","[Date].[YQM].&[" + "202302" + "]");

DataAction_1.execute();

N1kh1l
Active Contributor
0 Kudos

malya_7

Just try passing the member name without any qualifier if there is no hierarchy. All my dimensions had hierarchies so i did not face this issue

DataAction_1.setParameterValue("CC_P", "IE02")

Nikhil

Answers (3)

Answers (3)

N1kh1l
Active Contributor

malya_7

You should also provide a snapshot of your DA_1 formula code. The API to set parameter to Data Action looks fine.

"but it also does not perform the desired action of storing a value in the planning model." - That depends on what your Data Action code /step is . The java script API will only set the parameters for company code and time dimension and run the data action those seems to be ok.

You can check the Data Action monitor to see if the Data Action was triggered and what did it do exactly

Nikhil

0 Kudos

Hi Nikhil

I replaced comp_code with another dimension it worked but not working for organization dimension. is there any reason?

my organization dimension comp_code does not have hierarchy, but enabled person responsible.

Thanks

M

N1kh1l
Active Contributor
0 Kudos

malya_7

Can you just try passing without dimension name qualifier

DataAction_1.setParameterValue("CC_P", "IE02")

OR

DataAction_1.setParameterValue("CC_P", "[Comp_code].[IE02]")
0 Kudos

It Worked now. Thank you very much for your time.

M

0 Kudos

Hi Nikhil

Thanks for your quick reply.

my DA code: this will write a new record with the parameter combination assigns Rowcount=1 and also it will make sure always the company code has only one record.

VARIABLEMEMBER #period OF [d/Date]

VARIABLEMEMBER #compcode OF [d/Comp_code]

DELETE([d/Comp_code] = %CC_P%)

DATA([d/Measures] = "RowCount", [d/Comp_code] = %CC_P%, [d/Date] = %MY_P%) = 1

when I execute the above java code: the DataAction monitor gives this error:

It is not able to assign the parameters. if I execute Data action directly, it executes perfectly. but not through the Javascirpt.

Thanks

M