2009 Mar 26 4:05 PM
Hi Friends,
As per the requirement, I need to send a text file vaya mail to Lotus notes.
1. I done code for this in version 4.6c,it is working fine and getting mail with the text file attachment. But in text file, i am getting space in between two rows. User doesn't want the sapce inbetween the two rows. See below example for the same.
let us asume, i have 3 rows in my text file(notepad). Now i am getting the result like below.
testtesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttest
But user wants the data like below.
testtesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttest.
2. I have copied the same code to ECC 6.0 version and trying to activate it. But is is throwing an error. Error is "C_CRET" must be a character-like data object (data type C, N, D, T, or STRING)"
I have diclared the constant C_CRET like below.(As it is in 4.6c version)
constants: c_cret type x VALUE ' 0D'.(Diclaration, it is allowing)
I am using the constant c_cret like below.
if sy-tabix ne '1'.
CONCATENATE c_cret i_attach INTO i_attach. (i_attach is header of the internal table)
endif.
Here it is not allowing me to use like this. Showing the error here as "C_CRET" must be a character-like data object (data type C, N, D, T, or STRING)"
Could you please help me on this?
Thanks in advance.
Kumar
Edited by: kumar_sarayu on Mar 26, 2009 5:06 PM
2009 Mar 26 4:19 PM
Hi,
Pass the attachment data in CONTENTS_HEX instead of CONTENTS_BIN in Fm SO_NEW_DOCUMENT_ATT_SEND_API1.
To convert from CONTENTS_BIN to CONTENTS_HEX Use the below logic..this will solve the problem
DATA :
contents_hex LIKE solix OCCURS 0 WITH HEADER LINE,
conv TYPE REF TO cl_abap_conv_out_ce,
l_buffer TYPE xstring,
l_hexa(510) type x.
call function 'SO_RAW_TO_RTF'
TABLES
objcont_old = contents_raw
objcont_new = contents_bin.
LOOP AT contents_bin.
conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' endian = 'B').
CALL METHOD conv->write( data = contents_bin-line ).
l_buffer = conv->get_buffer( ).
move l_buffer to l_hexa.
move l_hexa to contents_hex-line.
APPEND contents_hex.
ENDLOOP.
Hi,
Try this code. It should work.
constants: c_cret type c value cl_abap_char_utilities=>cr_lf
Regards,
GN
2009 Mar 26 4:19 PM
Hi,
Pass the attachment data in CONTENTS_HEX instead of CONTENTS_BIN in Fm SO_NEW_DOCUMENT_ATT_SEND_API1.
To convert from CONTENTS_BIN to CONTENTS_HEX Use the below logic..this will solve the problem
DATA :
contents_hex LIKE solix OCCURS 0 WITH HEADER LINE,
conv TYPE REF TO cl_abap_conv_out_ce,
l_buffer TYPE xstring,
l_hexa(510) type x.
call function 'SO_RAW_TO_RTF'
TABLES
objcont_old = contents_raw
objcont_new = contents_bin.
LOOP AT contents_bin.
conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' endian = 'B').
CALL METHOD conv->write( data = contents_bin-line ).
l_buffer = conv->get_buffer( ).
move l_buffer to l_hexa.
move l_hexa to contents_hex-line.
APPEND contents_hex.
ENDLOOP.
2009 Mar 26 4:21 PM
Hi,
Try this code. It should work.
constants: c_cret type c value cl_abap_char_utilities=>cr_lf
Regards,
GN
2009 Mar 26 4:21 PM
For concatenating value you need to define either of the data type as described, other wise it will not let you allow to concatenate the value.
Kuntal
2009 Mar 26 4:31 PM
Hello Kumar,
CONSTANTS: c_cret type x VALUE ' 0D'.0D in hex translates to CR(carriage return) in ASCII.
May be you can try to replace the code as.
DATA:
v_cret TYPE char1,
v_crlf TYPE char2.
v_crlf = cl_abap_char_utilities=>cr_lf.
v_cret = v_crlf+0(1). "You can use v_cret instead of c_cretHope this helps.
BR,
Suhas
2009 Mar 29 1:18 PM
Hi Friends,
Thanks for the response.
these all are not working for me. 4.6c version, every thing fine. I have to do this in ECC 6.0 version. There, i am getting this problem.
Data in text file not displaying correctly. Second line of the internal table is displaying in same line in text file. It needs be displayed in new line.
I am getting the data like below in text file.
9 N A Y Y A R | N a y y a r | R o h i t | 0 0 0 | 2 0 0 9 0 2 0 6 0 D A A N D R O S | A n d r o s c h | A g o s t o n | 0 6 4 | 2 0 0 8 0 6 0 9 0 D A A Z C O N A V | A z c o n a V a z q u e z | A l e j a n d r o | 0 0 0 | 2 0 0 8 1 1 1 3
Correct fórmate is
9 N A Y Y A R | N a y y a r | R o h i t | 0 0 0 | 2 0 0 9 0 2 0 6
0 D A A N D R O S | A n d r o s c h | A g o s t o n | 0 6 4 | 2 0 0 8 0 6 0 9
0 D A A Z C O N A V | A z c o n a V a z q u e z | A l e j a n d r o | 0 0 0 | 2 0 0 8 1 1 1 3
Please do the needful.
Thanks
Kumar
Edited by: kumar_sarayu on Mar 29, 2009 2:18 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |