Skip to Content

This fifth part in the series “How to write dynamic BPC Script Logic” has relatively few earth shattering jolts but the tension is building up below the surface as we continue our journey to uncharted territory.

XDIM_MEMBERSET with keyword BAS and more

In general, help documentation is fairly accurate when it comes to XDIM_MEMBERSET. However, there are more valid use cases than the help documentation describes. Below you can find some examples most of which are properly documented.

Scope selection can contain multiple members.
   *XDIM_MEMBERSET P_ACCT = PL5111, PL5112, PL2111


XDIM_MEMBERSET can be combined with BAS to set the scope to base members of a hierarchy node.
   *XDIM_MEMBERSET P_ACCT = BAS(PL5000)


Keyword BAS can digest multiple members to set the scope to base members of several hierarchy nodes.
   *XDIM_MEMBERSET P_ACCT = BAS(PL5100, PL5200)


Keyword DEP can be used to select direct children of a hierarchy node.
   *XDIM_MEMBERSET P_ACCT = DEP(PL5110)


Keyword ALL can be used to select all children of a hierarchy node.
   *XDIM_MEMBERSET P_ACCT = ALL(PL5100)

Not equal to sign can be used to exclude a member.
   *XDIM_MEMBERSET P_ACCT <> PL5111


Not equal to sign can be combined with BAS to exclude base members of a hierarchy node.
   *XDIM_MEMBERSET P_ACCT <> BAS(PL5300)


The help documentation specifies that you cannot combine bas() with any other member set. This does not seem to be true as the following statement works.

   *XDIM_MEMBERSET ACCOUNT = BAS(PL3000), PL5111


It is worth pointing out that any duplicate base members resulting from BAS will be automatically removed. The following statement exemplifies how this works. Let’s assume that PL3100 is a child of PL3000. In this case, retrieving base members of both PL3100 and PL3000 would result in overlapping sets. However, the system only lists a single occurrence of each account if you use a script like the one below.

   *XDIM_MEMBERSET ACCOUNT = BAS(PL3000, PL3100)


There is one more thing I want to mention as it is not specified in the documentation. Keyword BAS also accepts base level members in addition to calculated members. The example below will return base level members belonging to the hierarchy node PL3000 plus the base level member PL5111.

   *XDIM_MEMBERSET ACCOUNT = BAS(PL3000, PL5111)


In the above examples, you may also use variables instead of fixed member values and I recommend you do. Let’s see how we can use the SELECT statement to pick up base members of a given hierarchy node. This is not possible directly, but you can combine SELECT variables with XDIM_MEMBERSET, XDIM_ADDMEMBERSET, XDIM_FILTER and WHEN. The example below gives an idea how to use BAS with a SELECT variable. Here we set the scope for base members under the calculated member PL3000.

    *SELECT(%ACCOUNTSRC%, ID, ACCOUNT, ID = PL3000) 
    *XDIM_MEMBERSET ACCOUNT = BAS(%ACCOUNTSRC%)


Update 2015-12-13:  It is possible to select all base members of a given hierarchy node after all. Instead of SELECT we can resort to our good old friend XDIM_MEMBERSET. The following statement will do the job.

*XDIM_MEMBERSET ACCOUNT as %ACCOUNTSRC% = BAS(PL3000)

This is really great because we can pass this variable to standard programs such as *RUNALLOCATION or *RUN_PROGRAM CURR_CONVERSION.


In the sixth and final part of this series, we will see that the keyword IS has similar dynamic capabilities and then some. I will also show more examples of variable usage. Some of the things I am about to reveal are Wikileaks magnitude so stay tuned.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Vadim Kalinin

    Hi Sami,

    In general the issue is that documentation is not updated to the recent SP levels… What you are writing here was explained in some specific notes…

    Vadim

    (0) 
    1. Sami Järvinen Post author

      Thanks Vadim for your feedback.

      I feel privileged to get your attention. Your posts always demonstrate clarity of thought combined with never ending patience. I have to admit I am a member of your fan club 🙂

      I want to give some background information to clarify my motivation for writing this series. You are absolutely right, the documentation is out there for the most part. The thing is, it can be below the radar for the majority of BPC users. The Help documentation is the first stop where most people land when they search for reliable information. Unfortunately, it can end up being the last stop.

      I do read the Notes regularly but I believe I am not the only person who has sometimes tossed valuable wheat of information with the chaff. I found out many script logic features by the arduous process of trial and error. I reread some of the Notes you are referring to only after writing most of this series. Before doing so, I thought many of my findings were not officially supported. So I had to modify my text considerably after reading those Notes again carefully.

      The documentation is scattered and this can lead to false conclusions about what’s possible and what’s not. In many cases, the conclusion is not doing justice to the product. Trial and error is great for learning but it takes time and time is usually an important factor in decision making. So I wanted to share my experience hoping that this will encourage users to explore what Script Logic is really capable of.

      Especially if you have an IT backround, it is easy to give up on Script Logic too easily and continue using ABAP for most tasks. I hope that my posts make it a little bit easier for others to find the right up to date information. As I am in no position to represent SAP, my posts should not be treated as a replacement for official documentation. Some things I described are definitely not best practice (or they approach lunacy as a colleague kindly remarked). But I hope I have managed to encourage users to give Script Logic a fair chance and experience the fun side of BPC as I did experimenting.

      (0) 
  2. Jaco de Kock

    Hi,

    I have a question regarding this.

    I have trouble writing a code to write to each of the base members, hopefully this example will clarify:

    *WHEN CUSTOMER

    *IS = PL0095001717_D      

            *XDIM_MEMBERSET CUSTOMER = BAS(PL0095001717)

            *REC(EXPRESSION=%VALUE%)

    *ENDWHEN

    *COMMIT

    Customer PL0095001717 has 23 children (on base level), I want the the value entered for PL0095001717_D to be replicated in the children.

    (Just to clarify that PL0095001717_D is a Dummy customer from a Hierarchy, PL0095001717 is the actual Hierarchy member in the master data).


    How can I change the code?

    I would assume that this example would work, but it is not writing to them:

    *REC(EXPRESSION=%VALUE%, CUSTOMER = BAS(PL0095001717))


    Please be so kind and assist,


    Thanks,

    Jaco de Kock

    (0) 
    1. John Leggio

      Hi Jaco,

      You should create a question in the SAP Planning and Consolidation, version for SAP NetWeaver

      However you need create a FOR loop and the scoping should come first:

      *SELECT(%Customers%, ID, CUSTOMER, PARENTH1= PL0095001717

      *XDIM_MEMBERSET CUSTOMER = PL0095001717_D

      *WHEN CUSTOMER

      *IS = PL0095001717_D     

      *FOR %CurCust% = %Customers%

      *REC(EXPRESSION=%VALUE%, CUSTOMER=%CurCust% )

      *NEXT

      *ENDWHEN

      *COMMIT

      If that doesn’t work try posting a question of what you have tried.

      Thanks

      (0) 
    2. Vadim Kalinin

      Hi Jaco,

      100% agree with John – open a new discussion!

      And in the discussion I will explain you how to use *RUNALLOCATION for this requirement!

      Vadim

      (0) 

Leave a Reply