2024 Apr 09 5:42 PM - edited 2024 Apr 09 6:05 PM
Hi,
I am trying to check supplier purchasing history from table EKKO.
Unfortunately data is too huge to output in Excel or flat file.
I am trying to write query in SQ02 to sort data in table EKKO according to its creation date and then select one row per supplier with latest PO date.
I am not quite familiar with ABAP so struggling to write the code.
Can someone please help or guide on this ?
SELECT LIFNR FROM EKKO
WHERE LIFNR EQ 'XXXX'.
In above statement its saying INTO is missing but I don't want to insert data I just want to modify selection criteria and output table.
Br,
Murtuza
Hello MSadri ,
I'm not sure if I understand clearly your need, but if the goal is to have a query with one row per supplier with his latest PO creation date you can do as follow:
First create your Infoset in SQ02 with table EKKO (like you seem already did).
Next, go to Extra/Code:
In this area put the following code:
field-symbols <output_table> type any table.
assign ('%G00[]') to <output_table>. " %G00[] represent the final alv
sort <output_table>
descending by " To get the latest date on top
('EKKO-LIFNR') " Supplier's account number
('EKKO-AEDAT'). " Creation date
" Keep the first line (with latest PO creation based on previous sort) and
" delete all the duplicate line comparing supplier's account number
delete adjacent duplicates from <output_table>
comparing ('EKKO-LIFNR').
I choose LIFNR and AEDAT but it can be any fields in EKKO table.
You must add this fields in the corresponding field group (SQ02), and you must check the fields for displaying it in you final view (SQ01), if you don't you will get a dump.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandra,
Thanks for replying.
I am writing code inside infoset-- code section -- Free code.
I am just trying to filter selection programmatically as data is too huge to output. I am trying to write select statement in infoset to select only desired data. Goal is to sort table EKKO depending on creation date and then output lastest po date per supplier. So let's say one supplier has 1000 POs so only row with latest PO date is needed for that supplier.
I just felt writing query might help and I am not sure whether this type of requirement can be accommodated here.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.