Sometimes you need to know the amount of rows in a table before you access the table. If your only weapon in your arsenal is rfc_read_table, you have a problem, it can’t be done. I circumvented this limitation by inserting this piece of code:
Instead of returning the selected part of the table the program now returns the row count, if the parameter ROWCOUNT is set to a negative number. The result is returned in the file TABLE_ROWS.CSV. Admittedly this is a crude hack but it does the job. I am not sure of the (copy)rights of RFC_READ_TABLE so I just publish this addition to the program, but it’s a no-brainer to to figure out how to apply the snippet. (You do not have to be a brain surgeon to create the snippet either.)
This is an example how I pick up the rowcount for the DD03T table:
In the first job I specify a negative rowcount which activate the ABAP code snippet above in my RFC_READ_TABLE and the rowcount is stored in the TABLE_ROWS.CSV file which is picked up by the ‘TABLEROWS’ tag in the subsequent job ‘calcIterator’ job. When you know how many rows there are in table it’s easy to download the table in chunks. And that I show in another post.