TYPES:
  BEGIN OF ty_data,
    fld1 TYPE char20,
    fld2 TYPE char20,
    fld3 TYPE char20,
  END   OF ty_data.
DATA: lt_data TYPE STANDARD TABLE OF ty_data.
FIELD-SYMBOLS: <lfs_data>  LIKE LINE OF lt_data.
 
START-OF-SELECTION.
 
  DO 10 TIMES.
    APPEND INITIAL LINE TO lt_data ASSIGNING <lfs_data>.
    <lfs_data>-fld1 = sy-abcde+0(10).
    <lfs_data>-fld2 = sy-index.
    CONDENSE <lfs_data>-fld2.
    CONCATENATE '_123_' <lfs_data>-fld2 INTO <lfs_data>-fld3.
  ENDDO.
*
* TO hold buffer to put in clipboard
  TYPES:
    BEGIN OF ty_clipdata,
      data TYPE c LENGTH 500,
    END   OF ty_clipdata.
  DATA: lt_clipdata TYPE STANDARD TABLE OF ty_clipdata.
  DATA: ls_clipdata LIKE LINE OF lt_clipdata.
  CONSTANTS: c_tab  TYPE c VALUE cl_bcs_convert=>gc_tab.
  DATA: lv_rc TYPE i.
*
* Add horizontal tab to add paste data in Excel
  LOOP AT lt_data ASSIGNING <lfs_data>.
    CONCATENATE <lfs_data>-fld1
                <lfs_data>-fld2
                <lfs_data>-fld3
      INTO ls_clipdata-data
      SEPARATED BY c_tab.
    APPEND ls_clipdata TO lt_clipdata.
  ENDLOOP.
*
* Put into clipboard
  cl_gui_frontend_services=>clipboard_export(
    IMPORTING
      data                 = lt_clipdata
    CHANGING
      rc                   = lv_rc
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      no_authority         = 4
      OTHERS               = 5 )
          .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
 
 
 
 
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com