Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Add a Code to Change the ABAP Query

Former Member
0 Kudos
937

Hi All,

I have a requirement in which i need to add a check box to a selection screen in ABAP query i inserted this check box in the infoset .The report is using joins from table EKKO,EKPO and EKES and display all the Vendor Confirmation details but when the user clicks on the checkbox which is added on the selection screen the report should only display the latest date Vendor confirmation for each line item of the PO.So i need your help how and where should i add the code for this in the Query???

Result when no Checkbox is ticked

PO LineItem Date

100 1 15.01.2010

100 1 15.02,2010

100 1 15.02.2010

Result when Checkbox is ticked

PO LineItem Date

100 1 15.02,2010

100 1 15.02.2010

Please help!!!

Regards,

KB

2 REPLIES 2

Former Member
0 Kudos
191

HI,

After selecting data from tables EKKO,EKPO and EKES in internal table, sort that internal table in descending order of date and in ascending order of PO number and line item and then delete adjacent duplicates from that internal table by comparing PO number and line item. This will give you the latest entry for each PO number and line item.

PFB the sample code..

*--after select query on EKKO, EKPO and EKES

SORT itab po_number ascending line_item ascending date descending.

DELETE ADJACENT DUPLICATES FROM itab COMPARING po_number line_item.

Let's say input file contains following data

PO LineItem Date

100 1 15.01.2010

100 1 15.02.2010

101 1 15.02.2010

101 1 15.02.2010

Above code will give you output as given below :

PO LineItem Date

100 1 15.02.2010

101 1 15.02.2010

Regards,

Pranjali

Former Member
0 Kudos
191

Is it a report or you are creating a ABAP query in Sq01 ?

If SQ01 then open the corresponding Infoset in SQ02 in change mode and then click EXTRAS button on the toolbar.

in right pane, go to "Code" tabpage, Select "END-OF-SELECTION(before list)" in Code section dropdown and put your necessary logic there.

Regards

Munish Garg