Skip to Content

NULL values in a Rec statement with When/EndWhen

Hi all.

I've been through the whole internet trying to find ANYTHING that can explain exactly how to use XDIM_SKIPNULLCHECK, FOR/NEXT with ISEMPTY or ANYWAY to be able to use script logic to skip the null check.

I've tried

XDIM_SKIPNULLCHECK with ALL, CURRENT, with and without [] and also ISEMPTY.

But the code still skips all blanks.

We are not allowed to use ABAP at the client - Policy issues.

And the scope is VERY specific so I can't use IIF.

What we are trying to achieve is to lookup a value, then XDIM specific value and then in the rec we have to %VALUE%-LOOKUP and save to specific Audittrail member. But if %VALUE% is NULL, it skips. We need it to then do 0-LOOKUP.

How should I use the above options?

Is there ANY documentation other than Note 2146749 that explains how and where to use those 2?

I've tried:

*Select(...

*XDIM_SKIPNULLCHECK [ALL/CURRENT]

*XDIM_MEMBERSET...

*WHEN....

I've even tried it just before the WHEN and even just before the rec.

The *FOR %I% = %ISEMPTY& if tried in about 23 different ways.

I might be missing something or I'm just and "id10t" but at this stage it does not seem like those SAP solutions work.

Oh and REF_MASTERDATA takes WAY to long...Takes about 45min for one month and we will need to run this code almost daily for different areas and for 5 years at a time in 10+ different script logics.

Any help would be AWESOME!

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Mar 18, 2017 at 05:34 PM

    If both are parents on the same level then the script will be:

    *WHEN ACCOUNT.ACCTYPE
    *IS=INC //strange - if you scope accounts why do you need to check for INC?
    *WHEN AUDITTRAIL
    *IS BAS(AUD_TOT)
    *REC(EXPRESSION=%VALUE%,AUDITTRAIL=AUD_9300)
    *IS BAS(AUD_GT)
    *REC(EXPRESSION=-%VALUE%,AUDITTRAIL=AUD_9300)
    *ENDWHEN
    *ENDWHEN

    Add comment
    10|10000 characters needed characters exceeded

    • For sure it will not work because AUD_TOT is a children of AUD_GT!

      But I do not understand the calculation logic based on your script:

      For each member in BAS(AUD_TOT) =%VALUE%

      You want to subtract total:

      %VALUE%-[AUDITTRAIL].[AUD_GT]

      And store the result in AUD_9300

      It will be equal to:

      Let's N = number of base members in BAS(AUD_TOT)

      [AUDITTRAIL].[AUD_TOT] - N * [AUDITTRAIL].[AUD_GT] = [AUDITTRAIL].[AUD_TOT] - N * ([AUDITTRAIL].[AUD_TOT]+[AUDITTRAIL].[AUD_9200]+[AUDITTRAIL].[AUD_8400])

      Is it correct? What do you want to achieve????

  • Mar 17, 2017 at 09:29 AM

    "What we are trying to achieve is to lookup a value, then XDIM specific value and then in the rec we have to %VALUE%-LOOKUP and save to specific Audittrail member. But if %VALUE% is NULL, it skips." not 100% clear what do you want to achieve?? Can you explain a business case?

    WHEN/ENDWHEN loop will scope only not empty records... (by default *WHEN_REF_DATA = TRANS_DATA)

    To my mind in your case instead of LOOKUP pull method it's better to use push!

    If you lookup a different model use *DESTINATION_APP

    And you can combine push and pull - anyway it will be faster then *WHEN_REF_DATA = MASTER_DATA

    P.S. *XDIM_SKIPNULLCHECK has no relation to transaction data values! https://launchpad.support.sap.com/#/notes/2146749/E

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Vadim

      We've tried push but then the results are not correct. Not sure why...

      What we try to achieve is this:

      We have AUDITTRAIL dimension:

      Total

      Group1

      Group 1.1

      ...Base of 1.1

      Group 1.2

      ...Base of 1.2

      Group 1.3

      ...Base of 1.3

      Group 2

      Group 2.1

      ...Base of 2.1

      Member X (Base members under Total)

      We lookup Group 1 of members then we scope XDIM_MEMBERSET BAS(Group2) (this will be %VALUE%)

      Then we do the WHEN etc and REC looks like this:

      REC(EXPRESSION=%VALUE%-LOOKUP(Group1),AUDITTRAIL=Member X)

      BUT there is a few intersections that has value in Group1 but is BLANK(Null) in Group 2.

      This must also go to member X but then obviously as blank - group 2 = -group2 in member

      Group 1 is the "driving" group. Everywhere that Group 1 has values, Member x MUST be Group2 - Group1

      So this works for all members that has values in group 2 as well as group 1.

      If we try a push there is other values and following scripts that fail.

      So I just need some way to read masterdata other than REF_MASTERDATA because that takes to long (as mentioned)

      I hope this explanation makes sense.

  • Mar 17, 2017 at 12:11 PM

    "We've tried push but then the results are not correct. Not sure why" - Sorry, but you have to clearly explain the case, including full info about models, dimensions, members etc...

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

    With the current description I can't help you!

    "So I just need some way to read masterdata other than REF_MASTERDATA because that takes to long (as mentioned)" - There is NO way!

    Use push!

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 17, 2017 at 03:11 PM

    The correct script will something like:

    *WHEN ACCOUNT.ACCTYPE
    *IS=INC
    *WHEN AUDITTRAIL
    *IS BAS(AUD_TOT)
    *REC(EXPRESSION=%VALUE%,AUDITTRAIL=AUD_9300)
    *IS AUD_GT //AUD_GT is not in BAS(AUD_TOT)
    *REC(EXPRESSION=-%VALUE%,AUDITTRAIL=AUD_9300)
    *ENDWHEN
    *ENDWHEN

    Or... I need more info about AUDITTRAIL dimension and the calculation logic you want to achieve!

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 20, 2017 at 08:56 AM

    Hi. This is what was given to me just now to explain:

    Hope this makes sense.

    Scenario1 is where the script "skips" the calc

    Add comment
    10|10000 characters needed characters exceeded