‎2008 Jan 02 3:45 PM
Hi,
I have an ABAP Query and just created a new field which requires ABAP Code to do the following :-
The report is for Purchase Orders and Purchase Requisitions. 2 Purchase Orders may have the same requisition, so what I want to do is count the number of the same requisitions in the report
e.g.
PO Req Count
45000001 10015 2
45000020 10015 2
Can some one please provide with the full code? Points will be awarded
Thanks
‎2008 Jan 02 4:24 PM
If you ONLY need number of requistions following code works...
DATA : BEGIN OF itab OCCURS 0,
banfn LIKE eban-banfn,
ebeln LIKE ekko-ebeln,
END OF itab.
DATA : count(2) TYPE p.
DATA : no_of_records(3) TYPE p.
"your code goes here to get POs and Reqs.
SORT itab BY banfn ebeln.
LOOP AT itab.
ADD 1 TO count.
AT END OF banfn.
IF count GE 2.
ADD count TO no_of_records.
ENDIF.
CLEAR count.
ENDAT.
ENDLOOP.
WRITE 😕 no_of_records.
‎2008 Jan 03 4:40 PM
Hi,
No errors in the below code but it is bringing a value 0 even though there are duplicates in the table which is suggesting to me that the code is not working.
Any help would be appreciated. Thanks
DATA : BEGIN OF itab OCCURS 0,
aufnr LIKE ekkn-aufnr,
END OF itab.
DATA : count(2) TYPE p.
DATA : no_of_records(3) TYPE p.
Clear no_of_records.
select aufnr from ekkn into itab.
endselect.
SORT itab BY aufnr.
LOOP AT itab.
ADD 1 TO count.
AT END OF aufnr.
IF count GE 2.
ADD count TO no_of_records.
ENDIF.
CLEAR count.
ENDAT.
ENDLOOP.
*WRITE 😕 'Good Bye'.
DUPLICATES = NO_of_records.
‎2008 Jan 02 4:59 PM
Hi Adeel,
Sort the table by Purchase Requisitions.
Loop at Itab.
count = count + 1.
At New Req.
Count is the number of same requisitions.
Here you can modify the table Itab where req = itab-req and Count = count.
Endat.
Endloop.
Hope it helps.
Lokesh
Edited by: Lokesh Aggarwal on Jan 2, 2008 5:01 PM
‎2008 Mar 03 9:52 PM