I'm getting the syntax error:
"IT_COMBINE" is a table without a header line and therefore has no component called "EBELN".
I have tried using "into corresponding fields" and that does not work.
My code:
19 Data it_combine type standard table of ty_combine.
...
32 select ebeln lifnr ekorg bsart ekgrp
33 into table it_po
34 from ekko
35 where ebeln = it_combine-ebeln. " <=== SYNTAX ERROR
...
You can not use the fields in internal tables directly if you did not declare your internal table with header line.
There are 2 possibilities to change your code.
You have called field ebeln in line no 35. Since you did not declare it_combine with header line in line no 19, you can not use it_combine-ebeln like this. Instead you have to declare Work Area
Data wa_combine type ty_combine.
and use the work area in line no 35 as
Loop at it_combine into wa_combine .
select ebeln lifnr ekorg bsart ekgrp
into table it_po
from ekko
where ebeln = wa_combine-ebeln.
End Loop.
2 You have to declare your internal table with header line
Data it_combine type standard table of ty_combine with header line.
Refer to the Sap help document for breif description about header line and work area.
You can also use the addition "FOR ALL ENTRIES IN" for statement "SELECT":
SELECT DISTINCT ebeln netwr werks INTO TABLE it_combine
FROM ekpo
WHERE netwr IN s_netwr. "in is only for select options
CHECK it_combine[] IS NOT INITIAL. " not empty, obligatory
SELECT ebeln lifnr ekorg bsart ekgrp
INTO TABLE it_po
FROM ekko FOR ALL ENTRIES IN it_combine
WHERE ebeln = it_combine-ebeln.
"with header line" or additional work area - not need
Also, using "with header line" impossible in the OOP context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With