10-26-2007 3:46 PM
Hi,
Is there any bapi/FM which will select data from any database table, based on a selection criteria we provide as import parameter and display any table entries satisfying the criteria?
i know RFC_GET_TABLE_ENTIRES but here we cant give a selection criteria.. is there any other FM/BAPI to do this task?
10-26-2007 3:48 PM
10-26-2007 3:50 PM
Hello Sreejith,
you can use the FM RFC_READ_TABLE where you can pass the where conditions in the options.
See this sample code:
DATA: BEGIN OF rfc_options OCCURS 0.
INCLUDE STRUCTURE rfc_db_opt.
DATA: END OF rfc_options.
DATA: BEGIN OF rfc_fields OCCURS 0.
INCLUDE STRUCTURE rfc_db_fld.
DATA: END OF rfc_fields.
DATA: BEGIN OF rfc_data OCCURS 0.
INCLUDE STRUCTURE tab512.
DATA: END OF rfc_data.
* read inbound partner-agreements
tab_name = 'EDP13'.
REFRESH rfc_options.
REFRESH rfc_fields.
REFRESH rfc_data.
REFRESH rfc_options.
REFRESH rfc_fields.
REFRESH rfc_data.
rfc_options = 'RCVPRN = P_RCVPRN'.
append rfc_options.
rfc_fields-fieldname = 'MANDT'.
rfc_fields-offset = 0.
rfc_fields-length = 3.
rfc_fields-type = 'C'.
APPEND rfc_fields.
rfc_fields-fieldname = 'RCVPRN'.
rfc_fields-offset = 3.
rfc_fields-length = 10.
rfc_fields-type = 'C'.
APPEND rfc_fields.
rfc_fields-fieldname = 'RCVPRT'.
rfc_fields-offset = 13.
rfc_fields-length = 2.
rfc_fields-type = 'C'.
APPEND rfc_fields.
rfc_fields-fieldname = 'RCVPFC'.
rfc_fields-offset = 15.
rfc_fields-length = 2.
rfc_fields-type = 'C'.
APPEND rfc_fields.
CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION g_rfcdest
EXPORTING
query_table = tab_name
TABLES
options = rfc_options
fields = rfc_fields
data = rfc_data
EXCEPTIONS
table_not_available = 1
table_without_data = 2
option_not_valid = 3
field_not_valid = 4
not_authorized = 5
data_buffer_exceeded = 6
OTHERS = 7.
Regards,
Naimesh Patel
10-26-2007 3:54 PM
Hi,
This does not meet my requirement as we cant give a selection criteria as input to this FM
10-26-2007 3:55 PM
You can give as many where conditions in the OPTIONS table.
Regards,
Naimesh
10-26-2007 4:01 PM
I want a fm which i can directly execute and see the table entries in Simulation clients. I cant do any coding .