cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

script logic

Former Member
0 Likes
297

Hi All,

I am trying to get value A= (value in dimension1.property) - 1

For example, if value in dimension1.property is 8 then A=7.

I try to use following script but it is error (no attribute = PROPERTY -1):

*SELECT(%A%,PROPERTY - 1,DIMENSION1,ID = ASSET)

What is the proper way to achieve the desired result?

P.S:

The script is in the default.lgx in BPC netweaver 10.0

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Likes

Sorry, but absolutely incorrect syntax...

*SELECT(%A%,PROPERTY,DIMENSION1,ID = ASSET) //%A% will be 8

...

*REC(EXPRESSION=%A%-1...

But please, explain the full logic you want to implement! I suspect you are going in the wrong direction

Vadim

Former Member
0 Likes

Hi Vadim,

Thank you for your prompt reply.

Actually , I am trying to understand how the system works.

The scenario will be like this:

  • User enter data in period 1 and period 2

  • If let say in the default.lgx, i have "REC.... to write data from period 1.
  • But then, I also have BADI WRITE BACK that mention data from period 1 will be ignored.

The result is data entered in period 1 is ignored.

Is this correct? If yes, means BADI WRITE BACK will overwrite default.lgx

It is just a scenario to understand which one is more powerful.

former_member186338
Active Contributor
0 Likes

Ups, not related to the original question...

Anyway, the sequence of events is like:

1. User enter data and press save.

2. Write back badi will process the data BEFORE saving in the cube!

3. Data us saved in the cube.

4. default.lgf will be launched with the scope of send data

5. Data altered in default.lgf will be ready to save.

6. Write back badi will process the results of default.lgf

7. Data is saved finally!

Vadim

Former Member
0 Likes

1. User enter data and press save.

    -> user enter USD 500 in period 1, USD 300 in period 2

2. Write back badi will process the data BEFORE saving in the cube!

    -> customized write back badi said ignore data entered in period 1.

3. Data us saved in the cube.

    -> USD 300 in period 2 is saved

4. default.lgf will be launched with the scope of send data

    -> in the default.lgf, there is a script to write (...REC...) USD 500 in period 1, USD 300 in period 2

5. Data altered in default.lgf will be ready to save.

    ->  USD 500 in period 1, USD 300 in period 2 is ready to save

6. Write back badi will process the results of default.lgf

     -> customized write back badi said ignore data entered in period 1

7. Data is saved finally!

    -> USD 300 in period 2 is saved.

As the final result, only USD 300 in period 2 is saved.

Is my understanding correct?

former_member186338
Active Contributor
0 Likes

"4. default.lgf will be launched with the scope of send data

    -> in the default.lgf, there is a script to write (...REC...) USD 500 in period 1, USD 300 in period 2"

Incorrect! USD 500 will not be saved and will not be processed by default.lgf!b Only SAVED data is processed by default.lgf!

Vadim

Former Member
0 Likes

how about this one?

1. User enter data and press save.

    -> user enter USD 500 in period 1, USD 300 in period 2

2. Write back badi will process the data BEFORE saving in the cube!

    -> customized write back badi said ignore data entered in period 1.

3. Data us saved in the cube.

    -> USD 300 in period 2 is saved

4. default.lgf will be launched with the scope of send data

    -> in the default.lgf, there is a script to write (...REC...) USD 500 in period 1, USD 300 in period 2

        (no period restriction) and deduct all the value by USD 100.

        But because only USD 300 in period 2 is saved in the cube as in the step 3 above, default.lgf  will only

        proceed USD 300 in period 2.

5. Data altered in default.lgf will be ready to save.

    -> USD 500 in period 1, USD 300  USD 200 in period 2 is ready to save

6. Write back badi will process the results of default.lgf

     -> customized write back badi said ignore data entered in period 1

7. Data is saved finally!

    -> USD 300  USD 200 in period 2 is saved.

former_member186338
Active Contributor
0 Likes

Something like this, but it depends how write back badi is written...

In our system write back badi can differentiate data originally sent by user and data created by default.lgf.

Sample:

Accounts: Price, Volume, Amount

Write back badi prevent write to Amount by direct send, but allow to write by default.lgf

Script default.lgf

*WHEN ACCOUNT

*IS VOLUME

*REC(EXPRESSION=%VALUE%*[ACCOUNT].[PRICE], ACCOUNT=AMOUNT

*ENDWHEN

*WHEN ACCOUNT

*IS PRICE

*REC(EXPRESSION=%VALUE%*[ACCOUNT].[VOLUME], ACCOUNT=AMOUNT

*ENDWHEN

Hope it's clear

Vadim

Former Member
0 Likes

How do we differentiate write back badi sent by users or created by Default.LGF?

Just wondering, why don't we just put the amount calculation in the BADI instead of default.lgf? What is the consideration?

former_member186338
Active Contributor
0 Likes

"How do we differentiate write back badi sent by users or created by Default.LGF?" - look on the write back badi parameter: IF_DEFAULT_LOGIC


"Just wondering, why don't we just put the amount calculation in the BADI instead of default.lgf?" - Because it's not a very easy job You have to read missing data from cube for the expression variables, then perform the calculations. In our case we have to calculate 10-20 expressions and it's very easy to perform in script logic. If any changes required - just correct the default.lgf.


Vadim

Former Member
0 Likes

Thank you......

former_member186338
Active Contributor
0 Likes

Some extra info:

a. To do something only with records initially send by input schedule (not by default.lgf or DM, etc..):

IF IF_DEFAULT_LOGIC IS INITIAL AND I_MODULE_ID = 'MAN'.

b. I have tested the following sequence to have a clear understanding of the scope of default.lgf executed after write back badi:

1. I have 2 members in the ACCOUNT dimension: PAGESD and GSALESD

2. ACCOUNT dimension has property: MANINP. This property for PAGESD is set to "Y" and is empty for GSALESD.

3. Write back badi will check the property for any record with IF_DEFAULT_LOGIC IS INITIAL AND I_MODULE_ID = 'MAN' and will reject the record with empty MANINP (in this case GSALESD).

4. Default.lgf script:

*WHEN ADV

*IS *

*REC(EXPRESSION=%VALUE%+1)

*ENDWHEN

5. Initially PAGESD:1 and GSALESD:1

6. I am sending by input schedule PAGESD:2 and GSALESD:2

7. Result - record for GSALESD is rejected by write back badi and default.lgf is calculated:

PAGESD:3 and GSALESD:1

It means that the scope of default.lgf after write back is the scope of the SAVED records, not the initial scope of send records (with initial scope the result will be PAGESD:3 and GSALESD:2).

Vadim

Answers (0)