$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

Bypass script logic section based on variable???

Oct 30, 2016 at 02:55 PM

80

avatar image

I have a logic script that sets a variable list of accounts based on a property:

*SELECT(%ASIS_ACCOUNTS%,"[ID]","ACCOUNT","[RATETYPE] = 'AS_IS'")

Then there is a section of the script that will copy the FC values to USD for any of these "AS-IS" flagged accounts.

*XDIM_MEMBERSET ACCOUNT=%ASIS_ACCOUNTS%
*XDIM_MEMBERSET BUSINESS=<ALL>
*XDIM_MEMBERSET CATEGORY=%CATEGORY_SET%
*XDIM_MEMBERSET CURRENCY=FC
*XDIM_MEMBERSET DATASRC=BAS(ALL_DATASRC)
*XDIM_MEMBERSET FLOW=<ALL>
*XDIM_MEMBERSET FUNCAREA=<ALL>
*XDIM_MEMBERSET GROUPS=G_NONE
*XDIM_MEMBERSET INTCO=<ALL>

*WHEN ENTITY.CURRENCY
*IS USD
*WHEN ACCOUNT.RATETYPE
*IS AS_IS
*REC(FACTOR=1,CURRENCY=USD)
*ELSE
*ENDWHEN
*ELSE
*ENDWHEN

*COMMIT

Essentially the ACCOUNT.RATETYPE check is unnecessary as it's used to scope the ASIS_ACCOUNTS variable but I didn't write this script.

After applying some recent system updates, we are now getting a failed status on the package running from Data Manager.

RUN_LOGIC:No value assigned to dimension "ACCOUNT"
model: Finance. Package status: ERROR

It seems that if NO accounts have this "AS_IS" value in their RATETYPE property, it won't be able to set the scope for ACCOUNT properly in the XDIM_MEMBERSET statement. The result, no value is assigned to dimension ACCOUNT as expected.

To resolve this issue, a test account member was created with the property set and the script completed fine.

Is there a way to bypass a section of the script based on the value of variable %ASIS_ACCOUNTS%?

For example, if %ASIS_ACCOUNTS% is blank (no accounts referenced) I can skip over this section of code to bypass the error. The logic only applies to accounts with this property, so if there are none, I don't want the code to run.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Vadim Kalinin Oct 30, 2016 at 03:20 PM
0

First - incorrect primary tag, has to be: SAP BusinessObjects Planning and Consolidation, version for SAP NetWeaver

Second: to skip part of the script you have to use FOR/NEXT:

*SELECT(%ASIS_ACCOUNTS%,"[ID]","ACCOUNT","[RATETYPE] = 'AS_IS' AND CALC='Y'")
//%ASIS_ACCOUNTS% will be empty or number of accounts
//*SELECT(%ASIS_ACCOUNTS%,"[ID]","ACCOUNT","[RATETYPE] = 'AVG' AND CALC='Y'")
*SELECT(%CP%,"[CALC]","ACCOUNT","[ID]=%ASIS_ACCOUNTS%")
//%CP% will empty or single or multiple 'Y'
*SELECT(%TAC%,"[ID]","ACCOUNT","[CALC]=%CP% AND [ID]="PL100")
//PL100 - just some existing account, %TAC% will be empty or PL100
*FOR %T%=%TAC% //if %TAC% is empty the code inside FOR/NEXT will not execute
//Some code
*XDIM_MEMBERSET ACCOUNT=%TAC%
*NEXT
Show 7 Share
10 |10000 characters needed characters left characters exceeded

Result in UJKT: For RATETYPE=AVG (number of AVG accounts):

LGX:

*XDIM_MEMBERSET ACCOUNT=PL100

RATETYPE=AS_IS (none of ACCOUNT has AS_IS):

LGX:


0

Full code:

*SELECT(%ASIS_ACCOUNTS%,"[ID]","ACCOUNT","[RATETYPE] = 'AS_IS' AND CALC='Y'")
*SELECT(%CP%,"[CALC]","ACCOUNT","[ID]=%ASIS_ACCOUNTS%")
*SELECT(%TAC%,"[ID]","ACCOUNT","[CALC]=%CP% AND [ID]="PL100") //Instead of PL100 use any valid base account
*FOR %T%=%TAC%
//Will be executed once if at least one account has [RATETYPE] = 'AS_IS'
*XDIM_MEMBERSET ACCOUNT=%ASIS_ACCOUNTS%
*XDIM_MEMBERSET BUSINESS=<ALL>
*XDIM_MEMBERSET CATEGORY=%CATEGORY_SET%
*XDIM_MEMBERSET CURRENCY=FC
*XDIM_MEMBERSET DATASRC=BAS(ALL_DATASRC)
*XDIM_MEMBERSET FLOW=<ALL>
*XDIM_MEMBERSET FUNCAREA=<ALL>
*XDIM_MEMBERSET GROUPS=G_NONE
*XDIM_MEMBERSET INTCO=<ALL>

*WHEN ENTITY.CURRENCY
*IS USD
*REC(FACTOR=1,CURRENCY=USD)
*ENDWHEN

*NEXT
0

Ah, I see... you're ending up with a boolean type scenario. So, I suppose I'm correct in assuming that it WOULD be a bad thing to loop through the logic for each account in the list.

I'll give that a shot and see how the testing works out.

Thanks again Vadim... I'm always happy to see posts with your responses; you're always very helpful.

0

"it WOULD be a bad thing to loop through the logic for each account in the list" - yes, absolutely bad!

I am emulating IF %ASIS_ACCOUNTS%<> empty THEN... with FOR/NEXT!

FOR/NEXT in script logic is not a real loop, just a text processing instruction to copy text between FOR and NEXT number of times (or skip text if variable is empty)

0

Sorry, one mistake in my code:

Not CALC=Y, but CALC=N

0

Right, I was just looking in RSA1 for that flag... seems like CALC=N is assigned to base level (as in data is entered at that level) and CALC=Y are assigned to parent levels of the hierarchy (as in data needs to be calculated at that level).

Thanks.

0

Just a typing mistake :)

0
Richard Houtby Oct 30, 2016 at 03:39 PM
0

Thanks Vadim. Sorry about the primary tag, I've corrected it. (I'm new to the forum)

So, with the FOR-NEXT syntax, it won't unnecessarily duplicate the code like a traditional FOR-NEXT and essentially run the XDIM_MEMBERSET several times over and over? Does it literally run through the scoping for each record defined in the loop? It seems like there might be performance impacts to processing each record individually like that versus setting the scope and not using a FOR-NEXT loop. As long as there aren't any negative impacts, I will try that.

I'm still working on getting security access to UJKT at the moment, for now, I have to test UJKT via our basis team.

Curious to note, this logic without matching members didn't seem to error before but now ends in package error after applying support packs and hana revisions.

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

Sorry, but if you look on my code the statements inside FOR/NEXT will be executed ONLY once or not executed at all.

To achieve it I used special SELECT statements (please read explanation in comments!)

0

P.S. Don't use useless COMMIT!

0

It seems like the consultants execute a *COMMIT after each sub-query in the logic. I'm not sure why they did that or if not having some commits would impact later sub queries.

I'll have to look into removing the *COMMIT statements when things settle down a bit to see if there is any impact to functionality or performance.

0

COMMIT is absolutely useless with when/endwhen. Autocommit will happen after endwhen. You can debug yourself in ABAP :)

0