cancel
Showing results for 
Search instead for 
Did you mean: 

Using variables in script logic.

12-30-2011 7:58 AM
499 views 7 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

I still haven't figured out how to assign a userdefined variable in a script.

My case is that I in my script commits data several times, after every commit I need to do a new *XDIM_MEMBERSET. Every time the *xdim_memberset is exactly the same.

Example - what I do now.

*XDIM_MEMBERSET ACCOUNT="REVENUE"

*XDIM_MEMBERSET VERSION="90"

*rec

*commit

*XDIM_MEMBERSET ACCOUNT="REVENUE"

*XDIM_MEMBERSET VERSION="90"

*rec

*commit

Etc.

It would be much easier, if I the beginning of each script for Account and Version defined a variable, and then having every *xdim_memberset use the variable. Then I only need to change the definition of the variable in the beginning of each script.

Example - what I want to achieve.

//Definition of constant variables.

%ACCOUNT_VARIABLE%= "ACCOUNT = REVENUE"

%VERSION__VARIABLE% = "VERSION=90"

*XDIM_MEMBERSET %ACCOUNT_VARIABLE%

*XDIM_MEMBERSET VERSION=%VERSION__VARIABLE%

*rec

*commit

*XDIM_MEMBERSET %ACCOUNT_VARIABLE%

+*XDIM_MEMBERSET VERSION=%VERSION__VARIABLE%

*rec

*commit

I've looked at the *SELECT and *MEMBERSET - but can't really get the syntax to work.....

Thank you,

Joergen

Edited by: Jørgen Dalby Andersen on Dec 30, 2011 7:58 AM

0 Likes

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Likes

Hi Joergen,

Unlike MS version NW writes data back to DB on ENDWHEN, so you don't need COMMIT, hence no need for those additional XDIM_MEBERSETs.

Hope this helps.

Gersh

Former Member
0 Likes

Hi,

I managed to get the syntax correct.

//Definition of constant variables.

*SELECT(%ACCOUNT_VARIABLE%, [ID], ACCOUNT,ID="REVENUE")

*SELECT(%VERSION_VARIABLE%, [ID], VERSION,ID="90")

*XDIM_MEMBERSET ACCOUNT=%ACCOUNT_VARIABLE%

*XDIM_MEMBERSET VERSION=%VERSION__VARIABLE%

*rec

*commit

*XDIM_MEMBERSET ACCOUNT=%ACCOUNT_VARIABLE%

*XDIM_MEMBERSET VERSION=%VERSION__VARIABLE%

*rec

*commit

Regards,

Joergen

krishna_priya1
Contributor
0 Likes

Yes you can use *SELECT statement . *MEMBERSET can be used in MS not in NW .

Syntax for *SELECT statement is below . There are some limitations in the condition.

*SELECT(%ACCT_VAR%, u201CIDu201D, u201CACCOUNTu201D, u201C[ID] = 'REVENUE'u201D)

*SELECT(%ACCT_VAR%, u201Cproperty that is to be in variableu201D, u201Cdimension nameu201D, u201Cconditionu201D).

Hope this helps.

Former Member
0 Likes

Hi pkrishnas,

thank you for your reply.

Would you by any chance also now how to limit to basemembers in a hierarchy in the select statement ?

I've tried the following syntax - but no luck.

*SELECT(%TEST%, [ID], ACCOUNT,ID=BAS(REVENUE))

Then the account hierarchy is for example like this:

Parent = REVENUE

Base = netsales and discount

And I try to get the *select statement to "filter" to netsales and discount.

Thank you,

Joergen

krishna_priya1
Contributor
0 Likes

To get all base members in a variable you can use XDIM_MEMBERSET. *Select can be used to get list based in properties .

*XDIM_MEMBERSET ACCOUNT AS %TEST% = BAS(REVENUE)

Former Member
0 Likes

Hi,

when I use *XDIM_MEMBERSET ACCOUNT AS %TEST% = BAS(REVENUE) - it work fine.

BUT ! after my first commit, it seems like the variable value is lost. And the *Xdim_memberset takes all.....

Fortunately enough, *select still contains the variable value after *commit.

Thanks,

Joergen

*Correction !

It actually works, it still contains the variable value after commit !!

Edited by: Jørgen Dalby Andersen on Dec 30, 2011 1:33 PM

krishna_priya1
Contributor
0 Likes

As i have already specified you can not get base members by specifying parent member in *SELECT . but can retrieve base members with properties . Ex : ACCTYPE = INC