I have two parts of the same table - one part (table_A) has only the VBELN and the very first POSNR and four or five fields which are common, so I extract them only once - they are (should be 😉 ) identical on all POSNR, so for reasons of speed, I load only one.
The other part (table_B) has the VBELN and all POSNR and four or five fields which are filled position-wise - there might be a different value on every line here, so I have to load all.
Lastly I need to join the two - but how to do that in one step?
The logical thing to do would seem to be a LEFT JOIN because I want to join the records of table_B to those from table_A where the VBELN is the same - but then that same logic is also applied to POSNR which is wrong - I have many more POSNR in table_B.
The apparently easiest thing would be loading all POSNR even for table_A, then the joining would be easier - but I cannot do that: There can in fact be different values in the common fields - I have discussed this with a colleague - but there must not be more than one value 😉 These exceptions are probably typos - or maybe not ... mysterious.
I will simply turn Things round and, instead of taking the "smaller" table_A and join the "bigger" table_B to it, I'll take table_B and join A to it - if I do it Right, table_B will have all POSNR, including those in table_A - then I can simply join or map everything.