depth1
depth1

Reputation: 145

Optimal way to select from multiple tables

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).

Specification

  1. Data
    For example, we want to retrieve the data from the tables:

    • EKKO order header
    • EKPO order item
    • EKKN order item assignment
    • EKBE order item historic

    Tables have the following relationships :

    • EKKO 1 - n EKPO
    • EKPO 1 - n EKKN
    • EKPO 1 - n EKBE
  2. 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 plant
      • etc...

Implementation

  1. Select with join

The 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.

  1. Multiple Select

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.

  1. ???

Another solution ?

Conclusion

So I'm a little lost and I would like to have your opinion.

Upvotes: 0

Views: 1264

Answers (0)

Related Questions