Reputation: 145
I want to report from a selection on multiple tables with filters to apply. Nothing new, but I'm wondering what is the best possible implementation (considering I'm using an S/4HANA system).
Data
For example, we want to retrieve the data from the tables:
EKKO
order headerEKPO
order itemEKKN
order item assignmentEKBE
order item historicTables have the following relationships :
EKKO
1 - n EKPO
EKPO
1 - n EKKN
EKPO
1 - n EKBE
Filters
We would like at least one element of each table to be present (INNER JOIN), if the header does not have an item we do not upload the header data, if the item has no allocation we do not upload the data of the post, etc.
We would apply filters to several table areas, for example
EKPO-WERKS
plantThe first solution would be to make a selection on all the tables with joins and then disassemble them after with LOOP AT ... GROUP BY...
then LOOP AT GROUP
.
But already there I'm asking myself questions !
In what order should the data be selected ? EKKO
->EKPO
->etc. or EKPO
->EKKO
etc.
Select headers then the items according to the headers then the assignment according to the items etc.
The advantage is that it is more readable (not sure) and we have less redundant data, on the other hand we must apply certain filters post selection in ABAP.
Another solution ?
So I'm a little lost and I would like to have your opinion.
Upvotes: 0
Views: 1264