Skip to Content
0
Jan 08, 2012 at 08:19 AM

calculate # of rows dynamically for an itab

28 Views

Hello Gurus,

I have an internal table itab1:

col1 | col2 | col3 |

A | X | 123 |

A | | 456 |

A | X | 999 |

B | | 456 |

B | X | 999 |

C | X | 123 |

C | X | 456 |

C | X | 999 |

Now, I need to calculate values for A, B, C, or it could be anything...with respect to col2....

That is, currently,

for A with X, COUNT is 2 and

total COUNT for A is 3

for B with X, COUNT is 1 and

total COUNT for B is 2

for C with X, COUNT is 3 and

total COUNT for C is also 3

Now, since it is dynamic, I can not use describe, or loop using where clause as rows selection depends upon DB table..

Is it possible to use field symbol to capture these values dynamically...or

use AT END clause with FS...?

I dont know how to calculate the number of rows for a specific condition between at end and endat..

Kindly help in deciding the optimized approach....

Thanks in advance..

BR

Malhar