Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Script logic - Determine the max value


We have a simple allocation of values from an account CUSTOMERS, based on a factor existing in a PERCENT account.

The CUSTOMERS account has to be an integer, so after the allocation we perform a round to obtain the correct value. The problem is, after the round, in some cases, the total does not match the value that was allocated in the first place:

                    PERCENT     CUSTOMERS

Product NA                              1346

Product 1          0.27                363.42           363

Product 2          0.35                471.1             471

Product 3          0.11                148.06           148

Product 4          0.27                363.42           363

                                                              SUM = 1345

In these cases, we want to determine the difference between the value after the round and the initial value to allocate and put this difference in the product that has the highest value, in this example, Product 2.

Our issue is how to find this member. I've found no MAX function in script logic and the only solution I'm seeing so far is to have all this values in a XDIM_MEMBERSET, store the first one in a temporary account, compare the next value with this temporary, if it is higher replace the value and so on, but it doesn't seem a good solution, we are talking about a huge amount of data, so all these comparisons will be slow...

Any ideas?



Former Member
Not what you were looking for? View more on this topic or Ask a question