title: Multiple lines in same excel cell using OLE
body: <p>I have some SAP OLE code that takes an internal table and pastes it into excel. However one field requires two lines within the same cell. </p>
  
  <p>I've tried using CL_ABAP_CHAR_UTILITIES-NEWLINE and CL_ABAP_CHAR_UTILITIES-VERTICAL TAB and 'CR_LF' character as carriage return characters and these work fine when setting the value of the cell individually but using the paste method the start a new line (not a new line in the same cell). Unfortunately setting cell values manually is too performance intensive to be helpful. </p>
  
  <p>I've also tried recording a macro of the alt + return key which shows me that excel reads that as ="line1" &amp; char(10) &amp; "line2" but I can't get this to parse properly either using OLE.</p>
  
  <p>Is there any way I can make the paste method parse carriage return characters properly?</p>
  
  <p>My current approach is below. Thanks for any help.</p>
  
  <pre><code>CONCATENATE line1 line2 INTO mult_lines SEPARATED BY cl_abap_char_utilities=&gt;newline.
  </code></pre>
  
  <p>Then I add mult_lines to internal table and concatenate each line of the internal table into gt_data[] which is of type: LIKE Table OF gv_data(4096) TYPE c.</p>
  
  <pre><code>CALL METHOD cl_gui_frontend_services=&gt;clipboard_export
  IMPORTING
    data                 = gt_data[]
  CHANGING
    rc                   = gv_rc
  EXCEPTIONS
    cntl_error           = 1
    error_no_gui         = 2
    not_supported_by_gui = 3
    OTHERS               = 4.
  
  CALL METHOD OF gv_appl 'Cells' = gv_cell
  EXPORTING
  #1 = lv_row1
  #2 = lv_col1.
  
  CALL METHOD OF gv_appl 'Range' = gv_range
  EXPORTING
  #1 = gv_cell
  #2 = gv_cell.
  
  CALL METHOD OF gv_range 'Select'.
  CALL METHOD OF gv_sheet 'Paste'.
  </code></pre>