cancel
Showing results for 
Search instead for 
Did you mean: 

Script Logic - Unable to clear data

0 Kudos
257

Hello Experts,

I'm trying to execute a logic file to clear the data based on some properties(on Account & Entity) but in the end it is not deleting the data. I've tried hard coding Entities but still I'm unable to see any change in output executed via UJKT/Package Run.

1. Version BPC10.1 SP8 , BW740 SP13


2. List of Dimensions for Finance Model: ACCOUNT, CATEGORY,GROUP, COSTCENTER,CURRENCY,DATASRC,ENTITY,FLOW,INTERCP,PROFITCENTER,
SCENARIO, TIME


3. RECLASS.LGF - Re classification is done on the basis of Account Property. [DISCOPS TO ACCT]= (other than blank) , Entity Property. [DISCOPS_HFS] =D , DATASRC(AUDIT) Property.[DISCOPS_DS]=Y. Now whenever the script run based on the above properties , reclassification is done.

This scenario is whenever the Entity Property.[DISCOPS_HFS] = other than blank was used , now the business has removed this property. So, in order to automatically clear the data from the DATASRC = DISCOPS and ACCOUNT Property. [DISCOPS TO ACCT]= (other than blank) . This logic should be added in the script.

Thus, to delete the data always whenever the Entity Property = DISCOPS_HFS is blank. DATSRC should always be DISCOPS. Accounts should always be Property = DISCOPS TO ACCT (other than blank).


4. DM Script (Not a Default logic)

PROMPT(SELECT,,,,"ENTITY,CATEGORY,TIME")

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SUSER,%USER%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPPSET,%APPSET%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SAPP,%APP%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,SELECTION,%SELECTION%)

TASK(/CPMB/DEFAULT_FORMULAS_LOGIC,LOGICFILENAME,RECLASS.LGF)


5. UJKT
DATA REGION -

CATEGORY=ACTUAL

ENTITY=AE10

TIME=2017.JAN


CODE - Provided Below


LGX:

*XDIM_SKIPNULLCHECK CURRENT

*XDIM_MEMBERSET CATEGORY = %GAAPONLY%

*XDIM_FILTER ENTITY = [ENTITY].PROPERTIES("CALC") = N

*START_BADI RUNLOGIC_PH

QUERY = OFF

WRITE = ON

LOGIC = RECLASS.LGF

APPSET = FPR

APP = Finance

DIMENSION ACCOUNT = <ALL>

DIMENSION CATEGORY = ACTUAL

DIMENSION GROUP = G_NONE

DIMENSION COSTCENTER = <ALL>

DIMENSION CURRENCY = <ALL>

DIMENSION DATASRC = <ALL>

DIMENSION ENTITY = AE10

DIMENSION FLOW = FOPE,FACT,FCLO

DIMENSION INTERCO = <ALL>

DIMENSION PROFITCENTER = <ALL>

DIMENSION SCENARIO = <ALL>

DIMENSION TIME = 2017.JAN

CHANGED = ENTITY.PARALLEL

DEBUG = OFF

*END_BADI

*COMMIT



LOG-

APPSET:FPR

APPLICATION: Finance

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:ACCOUNT WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:GROUP WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:COSTCENTER WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:DATASRC WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:FLOW WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:INTERCO WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:PROFITCENTER WILL QUERY ON ALL BASE MEMBERS.

[WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:SCENARIO WILL QUERY ON ALL BASE MEMBERS.

EXECUTION BADI:RUNLOGIC_PH

QUERY: OFF

WRITE: ON

Logic script RECLASS.LGF is processed.

1 Data Regions will be generated.

30 parallel processes will be used.

Dimension ENTITY property P02 1 members used for a new Data Region

Process Task 1 Started at 05:41:24 .

Process Task 1 Ended at 05:41:25 successfully.

BADI EXECUTION TIME IN TOTAL :2.00 ms.

SCRIPT RUNNING TIME IN TOTAL:2.00 s.

LOG END TIME:2017-12-28 05:41:25

6. Code:-

*XDIM_SKIPNULLCHECK CURRENT

*XDIM_MEMBERSET CATEGORY = %GAAPONLY%

*XDIM_FILTER ENTITY = [ENTITY].PROPERTIES("CALC") = N

*START_BADI RUNLOGIC_PH

	QUERY = OFF

	WRITE = ON

	LOGIC = RECLASS.LGF

	APPSET = FPR

	APP = Finance

	DIMENSION ACCOUNT = <ALL>

	DIMENSION CATEGORY = %CATEGORY_SET%

	DIMENSION GROUP = <ALL>

	DIMENSION COSTCENTER = <ALL>

	DIMENSION CURRENCY = <ALL>

	DIMENSION DATASRC = <ALL>

	DIMENSION ENTITY = %ENTITY_SET%

	DIMENSION FLOW = FACT,FCLO,FOPE

	DIMENSION INTERCO = <ALL>

	DIMENSION PROFITCENTER = <ALL>

	DIMENSION SCENARIO = <ALL>

	DIMENSION TIME = %TIME_SET%

	CHANGED = ENTITY.PARALLEL

	DEBUG = OFF

*END_BADI

*COMMIT


RECLASS.LGF:-

*SELECT(%DA%, "[ID]","ACCOUNT", "[DISCOPS_TO_ACCT] <>  ''")
*SELECT(%DE%, "[ID]","ENTITY", "[DISCOPS_HFS] = 'D' AND ID = %ENTITY_SET%")
*SELECT(%DD%, "[ID]","DATASRC", "[DISCOPS_DS] = 'Y'")
*SELECT(%ED%, "[ID]", "ENTITY","[DISCOPS_HFS] = ''")

*XDIM_SKIPNULLCHECK CURRENT 
*XDIM_MEMBERSET ENTITY = %DE%
*XDIM_MEMBERSET ACCOUNT AS %CFDR% = 123212,A310005,312110
*XDIM_MEMBERSET ACCOUNT = <ALL>
*XDIM_MEMBERSET GROUP = <ALL>
*XDIM_MEMBERSET COSTCENTER = <ALL>
*XDIM_MEMBERSET CURRENCY = FC,USD
*XDIM_MEMBERSET DATASRC = DISCOPS
*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO
*XDIM_MEMBERSET INTERCO = <ALL>
*XDIM_MEMBERSET PROFITCENTER = <ALL>
*XDIM_MEMBERSET SCENARIO = <ALL>

*WHEN ACCOUNT
*IS <> %CFDR%
*REC(EXPRESSION = 0)
*ENDWHEN

*XDIM_MEMBERSET ACCOUNT = %DA%
*XDIM_MEMBERSET GROUP = <ALL>
*XDIM_MEMBERSET COSTCENTER = <ALL>
*XDIM_MEMBERSET CURRENCY = FC,USD
*XDIM_MEMBERSET DATASRC = %DD%
*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO
*XDIM_MEMBERSET INTERCO = <ALL>
*XDIM_MEMBERSET PROFITCENTER = <ALL>
*XDIM_MEMBERSET SCENARIO = <ALL>
*WHEN ENTITY.DISCOPS_HFS
*IS D
*WHEN CURRENCY
*IS FC,USD
*REC(FACTOR = -1,DATASRC = "DISCOPS")
*REC(FACTOR = 1,ACCOUNT = ACCOUNT.DISCOPS_TO_ACCT,DATASRC = "DISCOPS")
*ENDWHEN
*ENDWHEN

//ADDITIONAL CODE IN THE SCRIPT SHOWN BELOW TO CLEAR DATA (BUT NOT CLEARING ANY DATA) :-
*XDIM_MEMBERSET ENTITY = %ED%
*XDIM_MEMBERSET DATASRC = DISCOPS
*XDIM_MEMBERSET ACCOUNT = %DA%
*XDIM_MEMBERSET GROUP = <ALL>
*XDIM_MEMBERSET COSTCENTER = <ALL>
*XDIM_MEMBERSET CURRENCY = FC,USD
*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO
*XDIM_MEMBERSET INTERCO = <ALL>
*XDIM_MEMBERSET PROFITCENTER = <ALL>
*XDIM_MEMBERSET SCENARIO = <ALL>
*WHEN ENTITY
*IS %ED%
*REC(EXPRESSION = 0)
*ENDWHEN

*COMMIT  

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Issue is resolved now, correct script to delete the data:-

*XDIM_SKIPNULLCHECK CURRENT

*XDIM_MEMBERSET ENTITY = %ED%

*XDIM_MEMBERSET ACCOUNT = %DA%

*XDIM_MEMBERSET GROUP = <ALL>

*XDIM_MEMBERSET COSTCENTER = <ALL>

*XDIM_MEMBERSET CURRENCY = FC,USD

*XDIM_MEMBERSET DATASRC = DISCOPS

*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO

*XDIM_MEMBERSET INTERCO = <ALL>

*XDIM_MEMBERSET PROFITCENTER = <ALL>

*XDIM_MEMBERSET SCENARIO = <ALL>

*WHEN ACCOUNT

*IS %DA%

*REC(EXPRESSION = 0)

*ENDWHEN

former_member186338
Active Contributor
0 Kudos

Yes, skipnullcheck will help to avoid error with empty scope of some dimension.

But in you script the variable %ed% is assigned a fixed list of members with empty property DISCOPS_HFS

How it’s related to the issue?

0 Kudos

It was related to issue. I was not able to clear the data for the Entities that has property.DISCOPS_HFS=""
if I'm using Variable %ED% for entity then the ACCOUNTS with %DA% will get cleared for those %ED% Entities only. Maybe my wordings didn't had the correct choice of words.

former_member186338
Active Contributor
0 Kudos

Sorry, but incorrect!

Skipnullcheck will skip your code if there are no entities with empty property. Looks absolutely strange for me!

Also this strange code will run for each parallel process - what for???

0 Kudos

if I'm going to execute this script via DM , then I'll select the Top Node of Entity(that has 3041 base members), for that case we are using entity parallel process.

former_member186338
Active Contributor
0 Kudos

And in each parallel process you are trying to clear the same entities with empty property??

Looks absolutely strange.

0 Kudos

Strange but true .
Step -1 Clear Accounts

*SELECT(%DA%, "[ID]","ACCOUNT", "[DISCOPS_TO_ACCT] <>  ''")
*SELECT(%DE%, "[ID]","ENTITY", "[DISCOPS_HFS] = 'D' AND ID = %ENTITY_SET%")
*SELECT(%DD%, "[ID]","DATASRC", "[DISCOPS_DS] = 'Y'")
*SELECT(%ED%, "[ID]", "ENTITY","[DISCOPS_HFS] = ''")

*XDIM_SKIPNULLCHECK CURRENT 
*XDIM_MEMBERSET ENTITY = %DE%
*XDIM_MEMBERSET ACCOUNT AS %CFDR% = 123212,A310005,312110
*XDIM_MEMBERSET ACCOUNT = <ALL>
*XDIM_MEMBERSET GROUP = <ALL>
*XDIM_MEMBERSET COSTCENTER = <ALL>
*XDIM_MEMBERSET CURRENCY = FC,USD
*XDIM_MEMBERSET DATASRC = DISCOPS
*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO
*XDIM_MEMBERSET INTERCO = <ALL>
*XDIM_MEMBERSET PROFITCENTER = <ALL>
*XDIM_MEMBERSET SCENARIO = <ALL>
*WHEN ACCOUNT
*IS <> %CFDR%
*REC(EXPRESSION = 0)
*ENDWHEN

Step - 2 Copy data from one DATASRC to another DATASRC based on properties.

*XDIM_MEMBERSET ACCOUNT = %DA%
*XDIM_MEMBERSET GROUP = <ALL>
*XDIM_MEMBERSET COSTCENTER = <ALL>
*XDIM_MEMBERSET CURRENCY = FC,USD
*XDIM_MEMBERSET DATASRC = %DD%
*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO
*XDIM_MEMBERSET INTERCO = <ALL>
*XDIM_MEMBERSET PROFITCENTER = <ALL>
*XDIM_MEMBERSET SCENARIO = <ALL>
*WHEN ENTITY.DISCOPS_HFS
*IS D
*WHEN CURRENCY
*IS FC,USD
*REC(FACTOR = -1,DATASRC = "DISCOPS")
*REC(FACTOR = 1,ACCOUNT = ACCOUNT.DISCOPS_TO_ACCT,DATASRC = "DISCOPS")
*ENDWHEN
*ENDWHEN


Step -3 New --> Clear Account Data based on the Entity Property that has blank value.

*XDIM_MEMBERSET ENTITY = %ED%
*XDIM_MEMBERSET ACCOUNT = %DA%
*XDIM_MEMBERSET GROUP = <ALL>
*XDIM_MEMBERSET COSTCENTER = <ALL>
*XDIM_MEMBERSET CURRENCY = FC,USD
*XDIM_MEMBERSET DATASRC = DISCOPS
*XDIM_MEMBERSET FLOW = FOPE,FACT,FCLO
*XDIM_MEMBERSET INTERCO = <ALL>
*XDIM_MEMBERSET PROFITCENTER = <ALL>
*XDIM_MEMBERSET SCENARIO = <ALL>
*WHEN ACCOUNT
*IS %DA%
*REC(EXPRESSION = 0)
*ENDWHEN
former_member186338
Active Contributor
0 Kudos

Step 3 has a fixed set of entities and it’s incorrect to perform it in each parallel run. If you want to clear entities with empty property then put this code in the main script after runlogic call. Then it will be performed once!

0 Kudos

ok, I'll test it and let you know how much time it is saving if we write the step 3 in the main logic.

former_member186338
Active Contributor
0 Kudos

It’s not only time saving. Record lock error may happen when parallel processes will write data to the same intersection. It’s simply incorrect script design.

0 Kudos

Thanks, I have created a separate package for this and it will be executed on demand basis only. Max. 7/8 times per year. So no point in executing the Step3 again and again in the RECLASS package or in the main package.

former_member186338
Active Contributor
0 Kudos

Unable to comment on the separate package idea (depends on the data generation logic). But you can always put step 3 after runlogic execution in the main script. If there is no data to clear then it will not add extra execution time. By the way lite optimize with zero elimination is a good everyday job.

0 Kudos

Yes, lite optimize with zero elimination is running everyday.

former_member186338
Active Contributor
0 Kudos

Then adjust main script as I recommended.

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Kudos

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

Your question is like: My script is not working, but I don't want to provide full info!

0 Kudos

full script added.

former_member186338
Active Contributor
0 Kudos

Not full script only, BUT FULL INFO in line with:

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

Please read this blog again!

0 Kudos

More details added in the question.

former_member186338
Active Contributor
0 Kudos

Read my blog again. The required info is still missing! I do not want to spend my time to ask the same questions again and again.

0 Kudos

added all the info.

former_member186338
Active Contributor
0 Kudos

Still, something is not clear:

Which model is used to launch the main script? Dimensions of this model?

Not clear: “Entity Property.[DISCOPS_HFS] = other than blank was used , now the business has removed this property“

What do you need by remove?

0 Kudos

Model = Finance , Dimension list already shared in point 2. Sorry it was not clear. Initially property was DSICOPS_HFS="A", now if we remove this property it will become DISOPS_HFS="" .

former_member186338
Active Contributor
0 Kudos

“Remove property” means removing property at all, looks like you are talking about removing particular property value. Please use correct wording.

0 Kudos

Yes, you are right. Next time, I'll keep this in mind.

former_member186338
Active Contributor
0 Kudos

Read my comment about skipnullcheck