The function RDSRI_INFOPROV_READ can also retrieve data from a so caled QueryProvider('Query as Infoprovider', QPROV). With the help of following simple example we discuss some technical details you need to take into account when writng a corresponding ABAP program.
Our simple test query with one basis key figure and one formula
uses the feature 'Query as Infoprovider'(see Query Properties in RSRT):
When we run the query in RSRT(ABAP BICS Mode), we get the follwoing result:
By using the button 'Technical Information' it is possible to get the technical names of the InfoObjects and query elements displayed. These technical names are needed when this QueryProvider is accessed with the function RSDRI_INFOPROV_READ. You can get them also be checking the query definition in the QueryDesigner:
In addition to the technical names of the query elements(characteristics and key figures), you also need to specify the correct ABAP data types. One convenient way to get them displayed is to check a transformation(or create a dummy transformation) which uses this provider as a source object:
See the following screenshots:
The ABAP types of the fileds of the internal table LT_S_DATA have to be equal as in a corresponding transformation.
When you define the internal table g_th_sfc you need the technical names of the InfoObjects:
When you define the internal table g_th_sfk(key figures) you need the technical names of the corresponding query structure element. In addition you have to to ad the prefix @Q:
The name of the QueryProvider is @QSTPE_QUERY_QPROV:
Our simple report returns the quers result in a simple list format:
When we compare the result with the query result in RSRT(same navigation state) we can see, as expected, the same values(apart from the number of decimal places of the formula)