Application Development and Automation 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: 
Read only

Problem in ECC 6.0 while using the data type 'X' in ALV report.

Former Member
0 Likes
881

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
814

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 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

5 REPLIES 5
Read only

Former Member
0 Likes
815

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.

Read only

Former Member
0 Likes
814

Hi,

Try this code. It should work.


constants: c_cret type c value cl_abap_char_utilities=>cr_lf

Regards,

GN

Read only

former_member376453
Contributor
0 Likes
814

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
814

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_cret

Hope this helps.

BR,

Suhas

Read only

Former Member
0 Likes
814

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