2016 Jan 14 4:41 AM
I am trying to import USR02 table of child system from the parent system.But getting Error as Table Not available in my main program.Kindly help.
Code :
data :
lv_table type DD02L-TABNAME,
lv_rfcdest type RFCDEST,
lt_options type STANDARD TABLE of rfc_db_opt,
lt_fields type STANDARD TABLE of rfc_db_fld,
lt_data type STANDARD TABLE of tab512.
lv_rfcdest = 'SR4CLNT800'.
WRITE : /.
lv_table = 'USR02'.
CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION lv_rfcdest
IMPORTING
QUERY_TABLE = lv_table
ex_usr02 = lv_table
TABLES
OPTIONS = lt_options
FIELDS = lt_fields
DATA = lt_data.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
exit.
2016 Jan 14 9:24 AM
2016 Jan 14 1:28 PM
Hi..No its not.Runtime Exception "Table not available" was encountered.
2016 Jan 14 1:46 PM
Yes but TABLE_NOT_AVAILABLE is the generic "other error" of the FM, so check following in destination system?
call function 'VIEW_AUTHORITY_CHECK'
exporting
view_action = 'S'
view_name = query_table
exceptions
no_authority = 2
no_clientindependent_authority = 2
no_linedependent_authority = 2
others = 1. " <- here
if sy-subrc = 2.
raise not_authorized.
elseif sy-subrc = 1.
raise table_not_available.
endif.
Regards,
Raymond
2016 Jan 14 4:35 PM
RFC_READ_TABLE has problems with tables with a lot of fields.
At a call inside SAP (with all rights) an BUFFER_EXCEED exception is thrown as the table USR02 has too much columns for this function call.
To get rid of this error you can can set the additional FIELDS parameter with 1 ... n values.
Regards, Andreas
2016 Jan 18 4:17 AM
2016 Jan 18 8:22 AM
The easiest way to check if it is working is transaction SE37.
function module: RFC_READ_TABLE:
If you only insert the query_table (in your cas USR02) you will get a DATA_BUFFER_EXCEEDED exception. If you add a field (or some fields to the Field table you will get the desired results.
When calling the function module in the code you have to set the table parameter FIELDS with the values.
Hope it helps, Andreas
2016 Jan 18 8:33 AM
2016 Jan 18 8:41 AM
I am lil new to ABAP. Doesn't have much idea about BAPI...Ill explore this too.
2016 Jan 18 8:46 AM
My main objective is to just fetch USR02 of destination child sytem ,and display it in the Parent CUA sytem.
2016 Jan 18 9:38 AM
The reason for fetching usr02 from child system,I want all the users from CUA child systems who did not logged on for 90 days.The final report I want in Parent system.
2016 Jan 20 7:24 AM
Could you :
Hint: In recent systems basis guy may be able to audit the call of generic table access tools in target system - 2041892 - Logging of call of generic table accesses
Also you didn't post the whole statement in your post, did you check each and every exception of FM and the RFC special exception?
CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION lv_rfcdest
IMPORTING
query_table = lv_table
ex_usr02 = lv_table
TABLES
OPTIONS = lt_options
fields = lt_fields
data = lt_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
system_failure = 7 MESSAGE text
communication_failure = 8 MESSAGE text
OTHERS = 9.
Are there any dump/message in target system (ST22, SM21)
Regards,
Raymond
2016 Jan 20 8:47 AM