Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to add carr return and tab in email attchm ?

former_member184551
Contributor
0 Kudos
106

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

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos
60

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.

4 REPLIES 4

naimesh_patel
Active Contributor
0 Kudos
60

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

0 Kudos
60

Hi Naimesh

Thanks for your reply,

My tab is finally working but the carriager return is still not working,

I have used it the following way

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.

APPEND L_LINE TO text_content.

ENDLOOP.

Any suggestions?

Rgds

Sameer

0 Kudos
60

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

former_member223537
Active Contributor
0 Kudos
61

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.