Skip to Content

How to insert Newline in text file thr CL_ABAP_CHAR_UTILITIES

Hi,

I need to send a mail with TEXT file attachment which has many records in it. It is working fine. But the only problem is, all records are displayed in the 1st line itself. So i need to separate the records by inserting new line.

constants: c_new type c value CL_ABAP_CHAR_UTILITIES=>NEWLINE.

LOOP AT it_final INTO wa_final.

lv_menge = wa_final-menge.
CONCATENATE  wa_final-ebeln
           wa_final-bukrs
           wa_final-lifnr
           wa_final-ebelp
           wa_final-matnr
           wa_final-werks
           lv_menge
           c_new    " Newline
           INTO lv_txt SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB. 
APPEND lv_txt to text.
CLEAR: lv_txt, lv_menge.

ENDLOOP.

For this code, i'm not getting the new line for each record.

Plz help me out for the same.

Thanks,

Ramesh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2011 at 12:26 PM

    just add one more line of code.... put a CRLF on the end of your tex string, like:

    concatenate lv_text <and the CR_LF already mentioned> into lv_text.

    append lv_text to....

    etc.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 06, 2011 at 07:09 AM
    SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB

    Do i need to say more?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2011 at 07:11 AM

    Hi,

    Declare c_new as below

    constants: c_new type ABAP_CR_LF value CL_ABAP_CHAR_UTILITIES=>CR_LF.

    Regards,

    Smart

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.