What I would like to achieve is a join between tables ESLL, EKPO, EKKO via SAP Query. Specifically these are the steps I would like to achieve:
ESLL-PACKNO
based on ESLL-EXTSRVNO
given;ESLL-SUB_PACKNO
equal to the ESLL-PACKNO values of the steps before;ESLL-PACKNO
values equal to EKPO-PACKNO and retrieve the following fields: EKPO-EBELN
, EKPO-EBELP
, EKPO-MATKL
.I have already written some code inside the infoset, but I do not know how to fix it. In the "data" section I have written:
DATA: it_esll TYPE TABLE OF esll.
DATA: it_esll2 TYPE TABLE OF esll.
DATA: it_ekpo TYPE TABLE OF ekpo.
In the "start-of-selection" section I have written:
SELECT packno
FROM esll
INTO TABLE it_esll.
IF sy-subrc EQ 0.
SELECT packno FROM esll
into TABLE it_esll2
for ALL ENTRIES IN it_esll
where sub_packno EQ it_esll-packno.
IF sy-subrc EQ 0.
SELECT ebeln ebelp bukrs werks matkl menge netpr peinh
FROM ekpo
into TABLE it_ekpo
for ALL ENTRIES IN it_esll2
WHERE packno EQ it_esll2-packno.
endif.
endif.
And, in order to display all the information I want, I have put the following joins: ESLL-PACKNO --> EKPO-PACKNO --> EKPO-EBELN --> EKKO-EBELN
At then end I would like to display these information:
Could you please help me?
One option could be to use Alias table in your infoset, something like this:
So you can avoid ABAP