Skip to Content
-1

SAP BPC 10.1 Problem with script logic calculation

Nov 28, 2017 at 07:45 AM

91

avatar image
Former Member
// Определение переменных выборки
*SELECT(%AuditJournal%,[ID], AUDITID, "ENABLEJRN = 'Y'")
*SELECT(%HeadDT%,[ID], ENTITY, "DT_HEAD = 'Y'")
*SELECT(%HeadEntity%,[ID], ENTITY, "HEAD = ''")
*SELECT(%NotHeadEntity%,[ID], ENTITY, "HEAD <>''")
*SELECT(%FlowJournal%,[ID], FLOW, "ENABLEJRN = 'Y'")
*SELECT(%SELECT_ACCOUNTTAX%,[ID], ACCOUNT, DIMLIST2 <>'')
*SELECT(%SELECT_ENTITY1%,[ID], ENTITY, DTAX = 'DTAX')
// *SELECT(%AUDIT%,"[ID]",AUDITID,"DATASRC_TYPE<>'A'")


*LOOKUP Consolidation
    *DIM ACCOUNTDT:FLOW = "F_NONE"
    *DIM ACCOUNTDT:AUDITID = "UPLOAD_DATA_FORM"
    *DIM ACCOUNTDT:MATURING = "M_NONE"
    *DIM ACCOUNTDT:CURRENCY_TRANS = "C_NONE"
    *DIM ACCOUNTDT:PARTNER = "I_NONE"
    *DIM ACCOUNTDT:CONS_GROUP = "G_NONE"
    *DIM ACCOUNTDT:CURRENCY = "LC"
    *DIM ACCOUNTDT:ENTITY = "TECH_T2RU"
    *DIM ACCOUNTDT:VERSION = "%VERSION_SET%"
    *DIM ACCOUNTDT:ACCOUNT = "64006510300000"
*ENDLOOKUP




*XDIM_MEMBERSET CURRENCY_TRANS = BAS(CUR)
*XDIM_MEMBERSET PERIOD = %PERIOD_SET%
*XDIM_MEMBERSET VERSION = %VERSION_SET%
*XDIM_MEMBERSET CONS_GROUP = %CONS_GROUP_SET%
*XDIM_MEMBERSET AUDITID = SA_DTA_DTL transfer
*XDIM_MEMBERSET ENTITY = %ENTITY_SET%
*XDIM_MEMBERSET CURRENCY = LC
*XDIM_MEMBERSET ACCOUNT = 10001410900000,10001140305000,10001310610000,23102350600000
*XDIM_MEMBERSET FLOW =%FlowJournal%
*WHEN_REF_DATA=MASTER_DATA
		*WHEN ENTITY
			*IS %NotHeadEntity%
 *WHEN CONS_GROUP 
      *IS G_NONE 
  *WHEN AUDITID
    *IS SA_DTA_DTL transfer
    *REC(FACTOR = 0, AUDITID = Z_BUFFER) 
	*REC(FACTOR = 0, AUDITID = Z_BUFFER,ENTITY=ENTITY.HEAD)
    *REC(EXPRESSION = (%VALUE%*(-1)), AUDITID = Z_BUFFER) 
  *ENDWHEN
*ENDWHEN
*ENDWHEN
*COMMIT




*XDIM_MEMBERSET CURRENCY_TRANS = BAS(CUR)
*XDIM_MEMBERSET PERIOD = %PERIOD_SET%
*XDIM_MEMBERSET VERSION = %VERSION_SET%
*XDIM_MEMBERSET CONS_GROUP = %CONS_GROUP_SET%
*XDIM_MEMBERSET AUDITID = %AUDITID_SET%
*XDIM_MEMBERSET ENTITY = %ENTITY_SET%
*XDIM_MEMBERSET CURRENCY = LC,RUB
*XDIM_MEMBERSET ACCOUNT = BAS(24002390000000),10001410900000,10001140305000,10001310610000,64006510300000
*XDIM_MEMBERSET FLOW =%FlowJournal%


// добавить развилку для G_NONE и T2RU *WHEN CONS_GROUP *IS G_NONE *ENDWHEN
  *WHEN CONS_GROUP 
      *IS G_NONE 
   *WHEN AUDITID
     *IS %AUDITID_SET%
		*WHEN ENTITY
			*IS %NotHeadEntity%
	
	
*WHEN ACCOUNT
  *IS 10001410900000,10001140305000,10001310610000,23102350600000
  *REC(FACTOR = 0)
*ENDWHEN
    
    
      *WHEN ACCOUNT
          *IS BAS(24002390000000)// что именно надо заказчику с РЕ 10001310605000 
          *WHEN ACCOUNT
              *IS <> 23102350600000 , BAS(23102350300000)
        
                *REC(EXPRESSION = (%VALUE%*(LOOKUP(ACCOUNTDT))*(-1)), ACCOUNT = 23102350600000) 
                *REC(EXPRESSION = (%VALUE%*(LOOKUP(ACCOUNTDT))), ACCOUNT = 23102350600000, AUDITID = SA_DTA_DTL transfer) 
                *REC(EXPRESSION = (%VALUE%*(LOOKUP(ACCOUNTDT))), AUDITID = SA_DTA_DTL transfer, FLOW = 220, ACCOUNT = 10001310610000)
                *REC(EXPRESSION = (%VALUE%*(1-LOOKUP(ACCOUNTDT))), FLOW = 220, ACCOUNT = 10001310610000)
                *REC(EXPRESSION = (%VALUE%>0)?(%VALUE%*(LOOKUP(ACCOUNTDT))):0,FLOW = 114,ACCOUNT = 10001140305000,MATURING = M_NONE,SEGMENT = 1202010, CURRENCY_TRANS = C_NONE,PARTNER = I_NONE)
                *REC(EXPRESSION = (%VALUE%<0)?(%VALUE%*(LOOKUP(ACCOUNTDT))):0,FLOW = 114,ACCOUNT = 10001410900000,MATURING = M_NONE,SEGMENT = 1202010, CURRENCY_TRANS = C_NONE,PARTNER = I_NONE)
                *REC(EXPRESSION = (%VALUE%>0)?(%VALUE%*(-1)*(LOOKUP(ACCOUNTDT))):0,FLOW = 114,ACCOUNT = 10001140305000,MATURING = M_NONE,AUDITID = SA_DTA_DTL transfer,SEGMENT = 1202010, CURRENCY_TRANS = C_NONE,PARTNER = I_NONE)
                *REC(EXPRESSION = (%VALUE%<0)?(%VALUE%*(-1)*(LOOKUP(ACCOUNTDT))):0,FLOW = 114,ACCOUNT = 10001410900000,MATURING = M_NONE,AUDITID = SA_DTA_DTL transfer,SEGMENT = 1202010, CURRENCY_TRANS = C_NONE,PARTNER = I_NONE)
        


      *ENDWHEN
  *ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
*COMMIT




*XDIM_MEMBERSET CURRENCY_TRANS = BAS(CUR)
*XDIM_MEMBERSET PERIOD = %PERIOD_SET%
*XDIM_MEMBERSET VERSION = %VERSION_SET%
*XDIM_MEMBERSET CONS_GROUP = %CONS_GROUP_SET%
*XDIM_MEMBERSET AUDITID = Z_BUFFER,SA_DTA_DTL transfer
*XDIM_MEMBERSET ENTITY = %ENTITY_SET%
*XDIM_MEMBERSET CURRENCY = LC
*XDIM_MEMBERSET ACCOUNT = 10001410900000,10001140305000,10001310610000,23102350600000
*XDIM_MEMBERSET FLOW =%FlowJournal%


*WHEN ENTITY
	*IS %NotHeadEntity%
  *WHEN CONS_GROUP 
      *IS G_NONE 
//     *REC(EXPRESSION = (%VALUE%*(-1)), AUDITID = Z_BUFFER)
    *REC(EXPRESSION = (%VALUE%*(-1)), AUDITID = Z_BUFFER, ENTITY=ENTITY.HEAD)
*ENDWHEN
*ENDWHEN
*COMMIT


*XDIM_MEMBERSET CURRENCY_TRANS = BAS(CUR)
*XDIM_MEMBERSET PERIOD = %PERIOD_SET%
*XDIM_MEMBERSET VERSION = %VERSION_SET%
*XDIM_MEMBERSET CONS_GROUP = %CONS_GROUP_SET%
*XDIM_MEMBERSET AUDITID = Z_BUFFER, SA_DTA_DTL transfer
*XDIM_MEMBERSET ENTITY = %HeadDT%
*XDIM_MEMBERSET CURRENCY = LC
*XDIM_MEMBERSET ACCOUNT = 10001410900000,10001140305000,10001310610000,23102350600000
*XDIM_MEMBERSET FLOW =%FlowJournal%


  *WHEN CONS_GROUP 
      *IS G_NONE 
  *WHEN AUDITID
    *IS Z_BUFFER,SA_DTA_DTL transfer
	 *WHEN ENTITY
    *IS %HeadDT%
	
    *REC(EXPRESSION=%VALUE%, AUDITID = SA_DTA_DTL transfer)
	
  *ENDWHEN
*ENDWHEN
*ENDWHEN
*COMMIT


<br>
2312312312.jpg (181.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Vadim Kalinin Nov 28, 2017 at 07:56 AM
0
Show 11 Share
10 |10000 characters needed characters left characters exceeded
Former Member

We have several entities in our sap bpc system. Some of them head for another - example ENTITY 2000 is HEAD of ENTITY 2400 (Dimension property HEAD). When we post and unpost journals on CHILD (2400) ENTITY (journal AUDIT for example upload_data) we need record this value*0.2 on special AUDIT SA_DTA and put delta on the HEAD (2000) ENTITY on special SA_DTA with reverse sign. We create special AUDIT Z_BUFFER for recording delta on %ENTITY_SET% but, when we post first journal ([AUDIT].[SA_DTA],[ENTITY].[%ENTITY_SET%] = empty, no transactional data) our logic doesn't work. But when we input data on SA_DTA using CSV - everythink work fine. What is problem in logic??

2312312312.jpg (181.6 kB)
0

"Some of them head for another - example ENTITY 2000 is HEAD of ENTITY 2400 (Dimension property HEAD). When we post and unpost journals on CHILD (2400) ENTITY (journal AUDIT for example upload_data) we need record this value*0.2 on special AUDIT SA_DTA and put delta on the HEAD (2000) ENTITY on special SA_DTA with reverse sign."

Sorry, but the logic description is unclear!

"this value" ???

"delta" ???

Use SIMPLE example if you want to get an answer!

Please read again:

https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/

0
Former Member

I read your post, unfortunately it does not solve my question (

we have ENTITY 2400, 2300, 2200, 2100, 2500 with property ENTITY.HEAD = 2000, The property of ENTITY 2000 ENTITY.HEAD is EPMTY.

we have ENTITY 3400, 3300, 3200, 3100, 3500 with property ENTITY.HEAD = 3000, The property of ENTITY 3000 ENTITY.HEAD is EPMTY.

we post journal on some child entity, some audit (for example corr_upload the value is 1000) we must reflectin on the ENTITY HEAD

EXAMPLE post_journal_1

[audit].[corr_upload],[entity].[2400],[account].[10001310600000] = 1000

VALUE(1000) must be multiplied 0.2 and put to another slice,

the package must create record

[audit].[SA_DTA transfer],[entity].[2400],[account].[10001310600000] = -200

[audit].[SA_DTA transfer],[entity].[2000],[account].[10001310600000] = 200

post_journal_2

[audit].[corr_upload],[entity].[2400],[account].[10001310600000] = -3000

[1000-3000=-2000]

package must create record

[audit].[SA_DTA transfer],[entity].[2400],[account].[10001310600000] = 400

[audit].[SA_DTA transfer],[entity].[2000],[account].[10001310600000] = -400[200-600_(delta)]

post_journal_3

[audit].[corr_upload],[entity].[2200],[account].[10001310600000] = 3000

package must create [audit].[SA_DTA transfer],[entity].[2200],[account].[10001310600000] = -600

[audit].[SA_DTA transfer],[entity].[2000],[account].[10001310600000] = [-400+600_(delta)=200]

For created and recording delta to HEAD ENTITY we created new AUDIT - Z_BUFFER and decided to apply the following logic:

1.LAST VALUE ON [audit].[SA_DTA transfer],[entity].[2400=child],[account].[10001310600000]*(-1) put to [audit].[Z_BUFFER],[entity].[2400=child],[account].[10001310600000]

2. CREATE NEW VALUE ON [audit].[SA_DTA transfer],[entity].[2400=child],[account].[10001310600000] by multyplying [audit].[corr_upload],[entity].[2400=child],[account].[10001310600000] * 0.2

3. ADD NEW VALUE ON [audit].[SA_DTA transfer]],[entity].[2400=child],[account].[10001310600000] TO [audit].[Z_BUFFER],[entity].[2400=child],[account].[10001310600000] AND WRITE NEW VALUE (DELTA) [audit].[Z_BUFFER],[entity].[2400=child],[account].[10001310600000]

4. ADD NEW VALUE (DELTA) [audit].[Z_BUFFER],[entity].[2400=child],[account].[10001310600000] TO [audit].[SA_DTA transfer]],[entity].[2000=HEAD],[account].[10001310600000]

BUT when we FIRST post journal on [audit].[corr_upload] and start a package the first step is empty, 2nd - work fine, 3rd and 4th empty like a first step. BUT WHEN WE put data on [audit].[SA_DTA transfer] by csv for EXAMLE ZERO value LOGIC WORK IS FINE. we dont understand why it happened.

0

Just to confirm - do you run script using DM package and not as default.lgf/journal.lgf?

0

Delta logic in post_journal_3 is unclear!

And looks like you don't want to spend some time to provide required information based on https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues

Do you really need answers??

0
Former Member
Vadim Kalinin

Yes it not default.lgf/journal.lgf this logic for calculating a deferred tax will run script using DM package.

Is there any way to address the head of ENTIT in the sample?

For example, I can write the value by property

* XDIM_MEMBERSET FLOW =% FLOW_SET%

* XDIM_MEMBERSET ENTITY =% ENTITY_SET%

* WHEN ENTITY * IS% ENTITY_SET%

* REC (EXPRESSION = (% VALUE% * (- 1)), ENTITY = ENTITY.HEAD

* ENDWHEN

we choose a ENTITY = 2400 and logic will generate a record on ENTITY = 2000

but can I refer to this HEADENTITY

* XDIM_MEMBERSET ENTITY =% ENTITY_SET%

* WHEN ENTITY.HEAD * IS <> '' (will choose ENTITY 2000 and ENTITY 3000 but I need just 2000.)

* ENDWHEN

I try use% ENTITY% .HEAD - doesn work correctly

0

Sorry, but you are trying to play with the code instead of thinking about full logic.

And not providing the required info (have to type again):

1. Always provide BPC version and SP level of core BPC system...

3. Please describe models/applications: full list of dimensions and some members examples relevant to the script discussed. - models used????

And have to repeat: "I suspect that the idea with a buffer is completely wrong and the whole script has to be redesigned."

0

P.S. And for the test case please forget about journals!

Script logic is working with final value saved, not with delta values used in journals.

Describe a test case using simple input schedule.

Sample: User saved data:

[audit].[corr_upload],[entity].[2400],[account].[10001310600000] = 1000

[audit].[corr_upload],[entity].[2200],[account].[10001310600000] = 3000

With ENTITY 2400, 2200 having ENTITY.HEAD = 2000

Extra records to be generated:

[audit].[SA_DTA transfer],[entity].[2400],[account].[10001310600000] = -200 (-1*1000*0.2)

[audit].[SA_DTA transfer],[entity].[2200],[account].[10001310600000] = -600 (-1*3000*0.2)

And aggregated by ENTITY:

[audit].[SA_DTA transfer],[entity].[2000],[account].[10001310600000] = 200 (1000*0.2)

[audit].[SA_DTA transfer],[entity].[2000],[account].[10001310600000] = 600 (3000*0.2)

Resulting in:

[audit].[SA_DTA transfer],[entity].[2000],[account].[10001310600000] = 800 (200+600)

Is it correct?

0

P.S. I suspect that the idea with a buffer is completely wrong and the whole script has to be redesigned.

1
Former Member

THANK you!

0

That's why I am asking you about business logic to implement, not about code details!

0
avatar image
Former Member Nov 28, 2017 at 09:28 AM
0

we need in first step some statement like

*REC (EXPRESSION = (%VALUE% <>EMPTY)?(%VALUE%)) : 0

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Useless idea!

If there is no value then no record will be looped in WHEN/ENDWHEN!

0