Skip to Content
avatar image
Former Member

How to download texts into excel with line breaks (in same cell) URGENT

Hi,

I am downloading data in to excel but the data is coming in single cell and in continuation.

I need to put line breaks in the cell so that each line is displayed seperately in the cell.

I tried using :

DATA: line_br(4) TYPE c VALUE '0Aew'.

CONCATENATE wa_out2-text i_text-tdline space INTO

wa_out2-text SEPARATED BY line_br.

also I used line_br = '0D0A'.

but of no use.

I tried using CL_ABAP_CHAR_UTILITIES==>NEWLINE etc but it also didn't helped.

Can some one please let me know how to do it!

Thanks

Regards

Ab

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 05, 2008 at 11:00 AM

    Hi Abhishek ,

    Try this

    Concatenate 'TEXT1' 'TEXT2' CL_ABAP_CHAR_UTILITIES=>NEWLINE

    into l_string separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

    This should give you a excel file.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Shiva,

      I tried using CL_ABAP_CHAR_UTILITIES (in different ways)

      but each time the ouput was getting distorted.

      Now I have found a workaround:-

      Each row in the cell (in excel) is of 255 charecters. I calculated the string length that I am putting then took the difference of strlen and 255 and concatenated that many blank spaces.

      By this way each row is coming seperately.

      Anyways thanks for your answer.

      Regards

      Abhishek

  • avatar image
    Former Member
    Jun 05, 2008 at 11:45 AM

    Hi,

    Use this function module:

    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

    EXPORTING

    • I_FIELD_SEPERATOR =

    • I_LINE_HEADER =

    i_filename = p_file

    • I_APPL_KEEP = ' '

    TABLES

    i_tab_sap_data = i_outputexc.

    • CHANGING

    • I_TAB_CONVERTED_DATA =

    • EXCEPTIONS

    • CONVERSION_FAILED = 1

    • OTHERS = 2

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    Bye

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Netaji for your answer,

      I had found a workaround:- Explained the same in my reply to Shiva.

      Regards

      Abhishek