Logic required to count no of fecodes for a car
Kindly help me in deriving a logic for the below issue.
I have 3 internal tables with data...
itab1 contains 1 field (FECODE) and values are for eg: 11, 12, 13, 14, 15....
itab2 contains 1 field (CARTYPE) and values are for eg: PA-1, PA-2, PA-3,PA-4,PA-5
itab3 contains 2 fields(CARTYPE AND FECODE) values for eg : PA-1, 11; PA-1, 11; PA-1, 12; PA-1,13
PA-2, 11; PA-2,14; PA-3,12; PA-3,15; PA-3,15 ...So on which means it contains duplicate records as well
TASK: my task is to count the no of occurance of FECODE for CARTYPES
SO THE RESULT SHOULD BE FECODE, CARTYPE, COUNT
for eg: IT WOULD BE: PA-1, 11, 2 : PA-1,12,1 : PA-1,13,1 , PA-2,11,1...........PA-3,15,2.
You can use only the 3rd itab or combination or all of the itabs
Your help is highly appreciated
Thanks and regards
Madhan Doraikannan replied
Create a itab4 with similar structure of itab3 and with one extra field count of type i and change FECODE to character type.
loop at itab3.
itab4-cartype = itab3-cartype.
itab4-fecode = itab3-fecode.
itab4-count = 1.
your itab4 will have count