Skip to Content

how to add carr return and tab in email attchm ?

Hi Guys iam

sending an email using SO_DOCUMENT_SEND_API1

I am converting my attchm in the foll way

CALL FUNCTION 'SO_RAW_TO_RTF'

TABLES

objcont_old = text_content

objcont_new = text_content

EXCEPTIONS

others = 0.

The problem is my text file attachmnt is coming in the email as

field1field2field3val1val2val3....

I would like to add a crg return 0D0A at the end of field3 and each val3, and a tab 09 in between all the value, the problem is that when I try to do that i get an error.

Can some one give me an example or a clarification?

rgds

sameer

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Nov 21, 2007 at 03:42 AM
    DATA: CON_TAB(1) TYPE C,
    CON_CRET(2) TYPE C.
    con_tab = cl_abap_char_utilities=>HORIZONTAL_TAB.
    con_cret = cl_abap_char_utilities=>CR_LF.
    
    LOOP AT ITAB .
    CONCATENATE ITAB-MATNR ITAB-RATE ITAB-UOM1 ITAB-UOM2
    INTO L_LINE SEPARATED BY CON_TAB.
    CONCATENATE L_LINE CON_CRET  INTO L_LINE. "CON_CRET should be at last
    APPEND L_LINE TO text_content.
    ENDLOOP.
    
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 20, 2007 at 09:43 PM

    If you are on Non unicode system than

    CONSTANTS: con_cret TYPE x VALUE '0D', "Carr retrun
    con_tab TYPE x VALUE '09'. " tab

    If you have Unicode check active in program attributes thnen you will

    need to declare constants as follows

    class cl_abap_char_utilities definition load. 
    constants: 
     con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB, 
     con_cret type c value cl_abap_char_utilities=>CR_LF.

    Than concatenate all the fields of the text_content into other table say it_attach.

    LOOP AT ITAB. 
    CONCATENATE itab-deb itab-debnaam itab-bestnr itab-artnr 
    itab-ikstatus itab-minlev itab-afrd itab-vprs 
    itab-vprseenh 
    INTO it_attach SEPARATED BY con_tab. 
    CONCATENATE con_cret it_attach INTO it_attach. 
    APPEND it_attach. 
    ENDLOOP.

    Pass the IT_ATTACH to FM SO_DOCUMENT_SEND_API1.

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

    • You need to concatenate CON_CRET at the last position.

      DATA: CON_TAB(1) TYPE C,
      CON_CRET(2) TYPE C.
      con_tab = cl_abap_char_utilities=>HORIZONTAL_TAB.
      con_cret = cl_abap_char_utilities=>CR_LF.
      
      LOOP AT ITAB .
      CONCATENATE ITAB-MATNR ITAB-RATE ITAB-UOM1 ITAB-UOM2
      INTO L_LINE SEPARATED BY CON_TAB.
      *CONCATENATE CON_CRET L_LINE INTO L_LINE.
      CONCATENATE L_LINE CON_CRET INTO L_LINE.   "<<
      APPEND L_LINE TO text_content.
      ENDLOOP.

      Regards,

      Naimesh Patel

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.