Skip to Content
author's profile photo
Former Member

RFC function module to count records in DB table

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Jul 20, 2004 at 12:46 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on May 27, 2004 at 01:33 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.