Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RFC_READ_TABLE - Count?

Former Member
0 Likes
4,788

We are using RFC_READ_TABLE to retrieve data. Is there a chance to remotely call something similar for a count?

Sometimes we would need a quick estimation of the result's size before retrieving it. As with count this should be as fast / lightweight as possible.

Any ideas?

Regards TJ

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,819

Hi,

Check this.

Regards,

Senthil

12 REPLIES 12
Read only

Former Member
0 Likes
2,820

Hi,

Check this.

Regards,

Senthil

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,819

You can use the RFM 'RFC_GET_TABLE_ENTRIES'. You get the number of records via the param: NUMBER_OF_ENTRIES

BR,

Suhas

Read only

Former Member
0 Likes
2,819

Thanks for your quick response. As I see it, both approaches

- EM_GET_NUMBER_OF_ENTRIES

- RFC_GET_TABLE_ENTRIES

provide the overall count only, and there is no chance to provide a selection criteria as with RFC_READ_TABLE.

So I cannot use it, since I need to provide a "WHERE CLAUSE". I should have been a more specific on this.

I appreciate your help.

Regards

Read only

0 Likes
2,819

well in this case is better to make a new FM where you pass parameters for the where clause and you can make a select count to retrieve the number of rows in the selection

Read only

Former Member
0 Likes
2,819

Hi ,

You can use this FM TABLE_ENTRIES_GET_VIA_RFC where you can pass the table name and the where clause in SEL_TAB internal table of this FM.

Hope this will help.

Regards,

Debaraj

Edited by: Debaraj Sahoo on Aug 26, 2010 11:55 PM

Read only

Former Member
0 Likes
2,819

Thanks again for your support.

At JMG:

Writing own code is not possible in my particular case, since we focus on the remote program and do not want to "touch" the SAP system. Thanks anyway.

At DS:

TABLE_ENTRIES_GET_VIA_RFC seems to be very much the same as RFC_READ_TABLE. However, I still do not get how to call it just to get the count. It returns the full data table, not just the count. So I do have the same overhead as with RFC_READ_TABLE. It takes some time to transfer the data via RFC

Motivation:

I just want to predict how many data I will get for a certain query before I transfer it REMOTELY(!).

Read only

0 Likes
2,819

After a little search in SE90 I found CATT_GET_TABLE_ENTRIES, maybe this comes close.

Thomas

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,819

In the code for CATT_GET_TABLE_ENTRIES, i see:

SELECT COUNT(*) FROM (table) INTO x
   WHERE (itab).
  IF sy-subrc = 0.
    anzahl = sy-dbcnt.
  ELSE.
    anzahl = 0.
  ENDIF.

The OP could have created a simple custom RFC utilizing the SELECT statements instead of searching for standard "unreleased" FMs

BR,

Suhas

Read only

0 Likes
2,819

Well, he doesn't want to touch the system, and c'mon, are you never using unreleased FMs? I'm doing fine since 1993

Thomas

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,819

>

> c'mon, are you never using unreleased FMs? I'm doing fine since 1993

ROFL ....

Read only

Former Member
0 Likes
2,819

Thanks guys for supporting me:

@TZ; CATT_GET_TABLE_ENTRIES is a prospect, but it is not available in my WebAS 7.0 / nor in my WebAS 7.01. As of [this thread|; it even has a select condition. However, obviously it's beyond the scope of a standard WebAs 7.

@Susha: We simply cannot install something in the backend. The company I am working with is in .net business and does not want to have somebody to install a FM or something similar. I am completely aware this is simple to write, on the other hand I also get their point.

Read only

Former Member
0 Likes
2,819

On a slightly different note, do you think a quick Table Analyzer run (Tcode TAANA) would help you? True that you are not using your tool to check the number of entries, but it gets the work done. You'll have to run this in the system from which you are pulling data.

Regards,

Jinesh