FORM get_small_table_content
USING p_table
CHANGING pt_result TYPE STANDARD TABLE.
DATA: lt_return TYPE TABLE OF ddshretval.
DATA: lt_data TYPE TABLE OF tab512,
lt_fields TYPE TABLE OF rfc_db_fld.
DATA(lv_dest) = zcl_ca_tools=>get_rfcdest( ).
CHECK lv_dest IS NOT INITIAL.
DATA: l_tab TYPE dd02l-tabname.
l_tab = p_table.
CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION lv_dest
EXPORTING
query_table = p_table
TABLES
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
OTHERS = 7.
CHECK sy-subrc = 0.
DELETE lt_fields WHERE fieldname = 'MANDT'.
LOOP AT lt_data INTO DATA(ls_data).
APPEND INITIAL LINE TO pt_result ASSIGNING FIELD-SYMBOL(<fs_result>).
LOOP AT lt_fields INTO DATA(ls_field).
ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE <fs_result> TO FIELD-SYMBOL(<fs_any>).
CHECK sy-subrc = 0.
<fs_any> = ls_data+ls_field-offset(ls_field-length).
ENDLOOP.
ENDLOOP.
ENDFORM.
RFC_READ_TABLE
最新推荐文章于 2024-02-29 08:32:14 发布