DATA:
lt_fields TYPE TABLE OF rfc_db_fld,
lt_options TYPE TABLE OF rfc_db_opt,
ls_option TYPE rfc_db_opt,
lt_data TYPE TABLE OF tab512,
lv_table_name TYPE dd02l-tabname VALUE 'ZPP_TABLE.
TYPES:BEGIN OF ty_delv_info,
vbeln TYPE vbeln_va,
posnr TYPE posnr_va,
END OF ty_delv_info.
DATA:lt_delv_info TYPE TABLE OF ty_delv_info.
DATA(lv_ecc_rfcdest) = zcl_ca_tools=>get_rfcdest( ).
CHECK lv_ecc_rfcdest IS NOT INITIAL.
DATA(gt_out_tmp) = gt_out[].
SORT gt_out_tmp BY vbeln delps.
DELETE ADJACENT DUPLICATES FROM gt_out_tmp COMPARING vbeln delps.
REFRESH lt_options.
CLEAR lt_options.
LOOP AT gt_out_tmp INTO DATA(ls_out_tmp) WHERE vbeln <> ''.
IF lt_options[] IS INITIAL.
CONCATENATE ' VBELN = ' ''''ls_out_tmp-vbeln'''' INTO ls_option.
ELSE.
CONCATENATE ' OR VBELN = ' ''''ls_out_tmp-vbeln'''' INTO ls_option.
ENDIF.
APPEND ls_option TO lt_options .
ENDLOOP.
APPEND VALUE #( fieldname = 'VBELN') TO lt_fields.
APPEND VALUE #( fieldname = 'POSNR') TO lt_fields.
CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION lv_ecc_rfcdest
EXPORTING
query_table = lv_table_name
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
OTHERS = 7.
CHECK sy-subrc = 0.
LOOP AT lt_data ASSIGNING FIELD-SYMBOL(<fs_data>).
APPEND VALUE #(
vbeln_apo = <fs_data>+0(10)
posnr_apo = <fs_data>+10(6)
) TO lt_delv_info.
ENDLOOP.
SORT lt_delv_info BY vbeln_apo posnr_apo.
RFC_READ_TABLE
最新推荐文章于 2023-09-07 11:07:53 发布