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

Facing Problem in Importing USR02 using RFC_Read_Table

Former Member
0 Likes
4,646

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.

12 REPLIES 12
Read only

FredericGirod
Active Contributor
0 Likes
3,166

Hi,

are you sure it's not an authorization problem ?

Fred

Read only

0 Likes
3,166

Hi..No its not.Runtime Exception "Table not available" was encountered.

Read only

0 Likes
3,166

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

Read only

former_member183045
Contributor
0 Likes
3,166

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

Read only

0 Likes
3,166

Any screenshot or template u have to go ahead with it?

Read only

0 Likes
3,166

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

Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,166

Just a question, why did you use RFC_READ_TABLE for this data, when they are some available BAPI (*) Always RFC enabled.

Regards,

Raymond

(*) e.g. BAPI_USER_GETLIST , BAPI_USER_GET_DETAIL and BAPI_USER_WP_PERS_DATA_READ.

Read only

0 Likes
3,166

I am lil new to ABAP. Doesn't have much idea about BAPI...Ill explore this too.

Read only

0 Likes
3,166

My main objective is to just fetch USR02 of destination child sytem ,and display it in  the Parent CUA sytem.

Read only

0 Likes
3,166

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.

Read only

0 Likes
3,166

Could you :

  • Call RFC_READ_TABLE with only the required fields, to insure problem doesn't come from table width,
  • Call RFC_READ_TABLE for any not-system restricted table (e.g. MARA) to insure no RFC authorization failure
  • Ask also basis (or check yourself) for some authorization check (hidden by the system due to security notes) using same user id than in the RFC call, try VIEW_AUTHORITY_CHECK or check authorization objects as S_TABU_NAM, S_TABU_DIS, S_TABU_CLI, or S_TABU_LIN.


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

Read only

0 Likes
3,166

Got it...Raymond...Thanx.....I resolved it..