cancel
Showing results for 
Search instead for 
Did you mean: 

Logic required to count no of fecodes for a car

Former Member
0 Kudos

Hi,

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

Kindly help.

Your help is highly appreciated

Thanks and regards

Sujeer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

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.

collect itab4.

endloop.

your itab4 will have count

Regards

Madhan

Former Member
0 Kudos

Hi Madhan,

Thanks a lot that ans my question. I was not thing out of box. Couldn't imagine that collect can work

wonders at times...thanks for the quick help

Regards

Sujeer

Former Member
0 Kudos

Hi Madhan,

Thanks a lot that ans my question. I was not thinking out of the box. Couldn't imagine that collect can work

wonders at times...thanks for the quick help

Regards

Sujeer

Answers (0)