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

how to call a function with generic table parameter

Former Member
0 Likes
1,450

Hi everybody

I need to call function module RSAR_ODS_API_GET (from BW). It recive an internal table with request ids and should return in E_T_DATA "unstructured" data from the psa and in E_T_RSFIELDTXT the description of the data structure, I guess

from sap help only thing I have reggarding how to use the function module is :

"You can call up the function module RSAR_ODS_API_GET with the list of request IDs given by the function module RSSM_API_REQUEST_GET. The function module RSAR_ODS_API_GET no longer recognizes InfoSources on the interface, rather it recognizes the request IDs instead. With the parameter I_T_SELECTIONS, you can restrict reading data records in the PSA table with reference to the fields of the transfer structure. In your program, the selections are filled and transferred to the parameter I_T_SELECTIONS.

The import parameter causes the function module to output the data records in the parameter E_T_DATA. Data output is unstructured, since the function module RSAR_ODS_API_GET works generically, and therefore does not recognize the specific structure of the PSA. You can find information on the field in the PSA table using the parameter E_T_RSFIELDTXT."

unfortunately I when running de report bellow, I get a dump which says:

Function parameter "E_DATA" is unknown

in the definition of the interface E_DATA has no type, which means it can recive any table type, right?

So I have two questions?

1) How to get the code working

2) How do I use the parameter E_T_RSFIELDTXT to parse the data returned in E_DATA

by debuging RSSM_API_REQUEST_GET for this code I found it try to put an internal table with the struct of the database table /BIC/B0000151000 in E_DATA

Thanks a lot for any help

rgds

my test report is:

REPORT ZTEST_PSA_API.

TABLES: /BIC/B0000151000 .

TYPE-POOLS: RSSM.

TYPES: BEGIN OF STC_REQ_LINE,

sign(1),

option(2),

low TYPE rsa_request,

high TYPE rsa_request,

END OF STC_REQ_LINE,

IT_REQUEST TYPE STC_REQ_LINE OCCURS 0.

DATA: lit_request TYPE RSSM_T_API_REQUEST_GET WITH HEADER LINE,

lc_system TYPE RSSM_T_API_LOGSYS,

lit_request1 TYPE IT_REQUEST WITH HEADER LINE.

DATA: lc_dtarget_name TYPE RSA_ODSNAME,

lit_meta_data TYPE RSARC_T_RSFIELDTXT.

DATA: lt_psa_data LIKE /BIC/B0000151000 OCCURS 0.

CALL FUNCTION 'RSSM_API_REQUEST_GET'

EXPORTING

I_SOURCE = '2LIS_13_VDITM'

I_TYP = 'D'

I_DATEFROM = '20060627'

IMPORTING

E_T_REQUEST = lit_request[]

E_T_LOGSYS = lc_system

EXCEPTIONS = 1.

READ TABLE lit_request.

lit_request1-sign = 'I'.

lit_request1-option = 'EQ'.

lit_request1-low = lit_request-request .

APPEND lit_request1 .

break-point .

CALL FUNCTION 'RSAR_ODS_API_GET'

EXPORTING

I_T_REQUEST = lit_request1[]

IMPORTING

E_ODSNAME = lc_dtarget_name

E_T_RSFIELDTXT = lit_meta_data

TABLES

E_DATA = lt_psa_data

EXCEPTIONS

NO_DATA_FOUND = 1

PARAMETER_FAILURE = 2

REQUEST_NOT_AVAILABLE = 3

NO_REQUEST_FOUND = 4

NO_FIELDS_TO_ODS = 5

NO_ODS_FOUND = 6

PACKAGE_LOCKED_BY_LOADING = 7 .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,008

Hi

The parameter is E_T_DATA not E_DATA

Max

4 REPLIES 4
Read only

LucianoBentiveg
Active Contributor
0 Likes
1,008

Try to pass table parameter without "[]" :


CALL FUNCTION 'RSAR_ODS_API_GET'
EXPORTING
I_T_REQUEST = lit_request1
IMPORTING
E_ODSNAME = lc_dtarget_name
E_T_RSFIELDTXT = lit_meta_data
TABLES
E_DATA = lt_psa_data

Read only

0 Likes
1,008

Thanks for the advice Peluka, but I think the function parametr should have de brackets because of the header line, anyway It doesn't work either as you suggested

thanks

Read only

Former Member
0 Likes
1,009

Hi

The parameter is E_T_DATA not E_DATA

Max

Read only

0 Likes
1,008

Hello Bianchi

It' was very kind of yout to make me see this silly mistake (I rewarded 10 points)

thank you