I have an issue with my code ABAP and I can't figure out what it is.
I want to get 3 fields from EKKO and 1 field from EKPO after select-options:
SELECT-OPTIONS: s_ebeln FOR ekpo-ebeln.
SELECT eko~ebeln eko~aedat ekp~elikz
FROM ekko as eko
JOIN ekpo as ekp
ON eko~ebeln = ekp~ebeln
into table it_eko2
WHERE eko~ebeln in s_ebeln.
The issue is I'm getting nothing for ekp~elikz (if I remove the condition WHERE eko~ebeln in s_ebeln I get the fields needed).
I tried to get 4 fields eko~ebeln eko~aedat ekp~elikz from corresponding to the PO numbers range entered by the users but I'm getting the three fields from ekko only instead.
Any help please ?
Actully the select statement you provided should work.
There is the output from my sample data:
And the program - I just selected additionally the ebelp (item number):
Please note that every entry in the header table
EKKO(EinKaufsbelegKOpf - Purchasing document header) table corresponds to 1 or more entries in the position tableEKPO(EnKaufsbelegPOsition - Purchasing document item) table.The field
elikz(EndLIeferungsKennZeichen - Delivery completed indicator) has char(1) type, which is an indicator, and contais either' '(space) or'X'symbol - maybe no item in your selection has 'X' set and it looks like as nothing was selected.Try also to set a breakpoint and check in the debugger what data is actully present in s_ebeln range table - below is the sample from my case (selected two single values):
Table: S_EBELN[]
If the condition range table is empty - all entries from the db-tables will be selected, which could be a lot of data.
And one more step - try to use the transaction
se16 / se16nto manually select the document(s) by ebeln and check wheather the documents in question exist and which values the fields have.