cancel
Showing results for 
Search instead for 
Did you mean: 

RFC function module to count records in DB table

Former Member
0 Kudos

Hello all over there,

I need RFC enabled FM to count amount of data records in another SAP's database table.

I've tried to use FM: DB6_DIAG_COUNT_TABLE_ENTRIES but I got an error:

ORA-00942: table or view does not exist

when I supplied 'TABLESCHEMA' as import parameter.

Do you have an idea what is the purpose of this parameter?

Best regards,

Martin

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hallo Martin,

you could use the EM_GET_NUMBER_OF_ENTRIES. You just have to write your table name into the input table IT_TABLES in the TABNAME field. The thing is also RFC-enabled.

I hope this works for you.

Cheers, Gerard White.

thorsten_staby
Explorer
0 Kudos

I have tried the same RFC.

Use "SAPR3" as the table schema. It is the owner of the SAP database in DB2. I think this might only work in DB2, have not tried other databases. Be aware that DB6_DIAG_COUNT_TABLE_ENTRIES counts the entries in all clients, i.e. it is not a client dependent count. It is a count at the physical data level, and does not take into consideration any client fields.

If you find any other RFC to count table entries, including the possibility to include a where clause, I would be most interested. Something like a variant of RFC_READ_TABLE but that returns a record count only, and not the data itself.

cheers

Thorsten.

Former Member
0 Kudos

Why not write a custom function module that has the table name as a parameter and then inside the function perform a SELECT COUNT to get the number of records ?

Cheers

Colin.