Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to calculate no.of records for a specific company Code and Transaction

Hi All,

Could you please help me how to calculate or count no.of records, in a table which are having a specific Company Code and Transaction Code and populate in an output table displaying that these many records are present for this company code and Transaction code.

The table is having the data like this:

LOB TRAN CODE COUNT

X1 1

X1 2

X1 3

X1 4

F1 NB 5

F1 NB 6

F1 NB 7

F1 NB 8

F1 NB 9

F1 NB 10

F1 NB 11

F1 NB 12

F1 NB 13

F1 NB 14

F1 NB 15

F1 NB 16

F1 NB 17

F1 NB 18

F1 NB 19

F1 NB 20

F1 NB 21

F1 NB 22

F1 NB 23

F1 24

F1 25

F1 26

F1 27

In the above table there are totally 27 records,where as the no.of records with F1 as company code and NB as transaction code are 18..so i have to display like F1 NB and 18 as one record as output.

Thanks and Regards,

Johny

Tags:
Former Member
Former Member replied

Hi Dude,

Data : V_count type i.

U loop at the internal table.

Inside the loop U write the READ Statement with key F1 as company code and NB as transaction code .

if sy-subrc is initial.

V_count = V_count + 1.

endif.

Endloop.

write : V_count.

Hope this solves UR Problem.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question