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

script - copy using logic

sap_user62
Active Participant
0 Kudos
564

Friends,

Env - 10.1 standard

I am looking for a functionality to copy data from a single account to another (script, badi etc)

Copy data from Account1 to Account2, for the current month ( for one specific audit trail ,rest of the dimensions should be remain same) only if the SenderCostCenter is populated with drivers percentages [Different audit trail].

example,

Scripts are easy to read and maintain, but does Does lookup function on every SenderCostCenter take a lot of time. i am inclining towards badi just for the performance.

Is there any other alternatives.

Thank you for your time.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

sap.user62

It's not possible to test for ANY costcenter 🙂

You have to perform some precalculations for driver:

*XDIM_MEMBERSET ACCOUNT=P_DRIVER
*XDIM_MEMBERSET AUDITTRAIL=DRIVERS
*XDIM_MEMBERSET Costcenter=<ALL>
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION=(%VALUE%==0) ? 0 : 1,Costcenter=TEST_CC) //Create TEST_CC in Costcenter dimension
*ENDWHEN

*XDIM_MEMBERSET ACCOUNT=AL_OPEX
*XDIM_MEMBERSET AUDITTRAIL=T_DATA
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION=(([Costcenter].[TEST_CC],[ACCOUNT].[P_DRIVER],[AUDITTRAIL].[DRIVERS])>0) ? %VALUE% : 0,ACCOUNT=ALSENDER)
*ENDWHEN

TEST_CC will contain 1...n or nothing for each SenderCostCenter

If TEST_CC>0 then write tr data.

former_member186338
Active Contributor

sap.user62

Convert to answer - Done!

You can also add code to clear TEST_CC before writing.

Answers (2)

Answers (2)

former_member186338
Active Contributor
0 Kudos

Why do you scope drivers??? Only transaction data have to be scoped.

*XDIM_MEMBERSET ACCOUNT=AL_OPEX
*XDIM_MEMBERSET AUDITTRAIL=T_DATA
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION=(([ACCOUNT].[P_DRIVER],[AUDITTRAIL].[DRIVERS])==0) ? 0 : %VALUE%,ACCOUNT=ALSENDER)
*ENDWHEN

([ACCOUNT].[P_DRIVER],[AUDITTRAIL].[DRIVERS]) - tuple expression

sap_user62
Active Participant
0 Kudos

I have updated the script to scope only transaction data. It correctly scopes are the transaction records, but it writes 0 values to the new account for all scoped records.

I even tried to [CostCenter],[ALL] but it still write a record with zero value,

Next I tried this, 
*REC(EXPRESSION=(([Costcenter].[502041],[ACCOUNT].[P_DRIVER],[Audittrail].[DRIVERS])==0) ? 0 : %VALUE%, ACCOUNT= ALSENDER) 
*ENDWHEN

and it writes the correct transaction values to the new account.

I think this operator looks for a complete match for the rest of the dimensions other than the account and audittrail we specify in the operator.

Is there a way to get the cost centers in the expression or make the expression to ignore Cost center.

former_member186338
Active Contributor
0 Kudos

sap.user62

Sorry, but I do not understand your issue with Cost Center.

In your sample: CostCenter and SenderCostCenter are the same for data and for driver value!

Can you post a real report with real ID's

sap_user62
Active Participant
0 Kudos

Data from production for single sendercostcenter.

note - AL_OPEX has the pre allocated data that is pushed from finance to allocation model. So we have both sendercostcenter and costcenter as the same number, as finance does not have a separate sendercostcenter dimension.

former_member186338
Active Contributor
0 Kudos

sap.user62

Sorry, but for T_DATA line we have 505003 for both sendercostcenter and costcenter

What driver line you want to test for some value??? Any costcenter or ???

sap_user62
Active Participant
0 Kudos

Sorry, but for T_DATA line we have 505003 for both sendercostcenter and costcenter -

T_DATA auditrail has the pre allocated data that is pushed from finance to allocation model. So we have both sendercostcenter and costcenter as the same number, as finance does not have a separate sendercostcenter dimension.

What driver line you want to test for some value??? Any costcenter or ???

- Any cost center, We want to check if there is atleaset one allocation driver for the current month.

sap_user62
Active Participant
0 Kudos

This is so helpful . Thank you Vadim!!

Please convert your comment to a reply I will accept the answer.

former_member186338
Active Contributor
0 Kudos

You don't need a lookup, just use member tuple and ternary operator to check:

*REC(EXPRESSION=([Audittrail].[Drivers]==0) ? 0 : %VALUE%,Account=XX2)

...

sap_user62
Active Participant
0 Kudos

Thank you.

*REC(EXPRESSION=([Audittrail].[Drivers]==0)?0:%VALUE%,Account=XX2)

when we look at condition, [audittrail].[drivers] = 0, does it expect a one to one match on rest of the dimensions except the audit trail?

in my case the account numbers for drivers and raw transaction data are different. also it possible in ternary operators to ignore one or two dimensions.

( like if category is actual, reporting currency is USD, then if there is a valid % for that sendercostcenter dimension, we need to update another account., you can ignore the values of the Costcenter dimension even if there is mismatch)

sap_user62
Active Participant
0 Kudos

I tried the following script, all the drivers percentages got copied over to the new account, but for the actual transaction data, empty records got updated.