on 07-26-2018 6:27 PM
using a db lookup (and maybe that is not the right expression type in this case), I want to select a single field (or table line) from a table, call it customer number, where I specify a value for selection parameter, call it product - but where I also want to select only the table entry where the date is most recent, call it creation date. Is this possible?
I cannot find a way to incorporate the creation date sort into the selection condition - and did not expect to be able to do so.
I have tried using select into a structure and then using the aggregation of maximum for creation date, but the returned value does not correspond to the correct line in the table.
I know I could select all entries and then do a table operation against the resulting table, but I was hoping for a way to do it in the single expression. How can it be done?
There are no hard rules as to what should be done in BRF, I would implement this as a procedure call expression and do the SELECT in a method. Or a DB lookup expression on a CDS view.
On a more general note, it does raise an interesting question of what belongs in the code or DB layer, and what belongs in a rule. In my experience I've seen overuse of BRFplus with very complex technical logic that should really be in code. Personally I believe something should go into the rule engine if it should be changeable and/or if it provides transparency (i.e. business-relevant). Rules can get complex enough, no need to clutter them with unnecessary technical detail.
In this case, selecting from a view MOST_RECENT_CUST_FOR_MATL is clear enough for anyone to understand, and highly unlikely that the date criteria needs to be edited. Therefore I'd avoid doing anything complex in BRFplus to achieve a simple result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.