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

cell separation in excel attachment

Former Member
0 Likes
1,078

Hi,

i am writing email application which sends mail to the distribution list as xls attachment.

i have got more than 255 row length so made my line chunks of 255 and then passing to so_api1 fm.

i am able to get the output with row length more than 255. but merging two cells here. i mean in my code text-010 and text-011 are coming in single cell.

How to overcome this?

FORM build_xls_data_table .

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.

CLEAR it_attach.

CONCATENATE text-006 text-018 text-007 text-008 text-009 text-010

into it_attach

SEPARATED BY con_tab.

CONCATENATE con_cret it_attach INTO it_attach.

APPEND it_attach.

CONCATENATE text-011 text-012 text-013 text-014 text-015 text-016

into it_attach

SEPARATED By con_tab.

APPEND it_attach.

the expected output is <b>text-006 text-018 text-007 text-008 text-009 text-010 text-011 text-012 text-013 text-014 text-015 text-016</b>

but my output is coming like this

text-006 text-018 text-007 text-008 text-009 text-010text-011 text-012 text-013 text-014 text-015 text-016

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
881

Hi Nihi

Please try by passing the TAB character wherever you need to split into a different cell.

data: tab(1) type c value cl_abap_char_utilities=>horizontal_tab.

Regards

Eswar

3 REPLIES 3
Read only

Former Member
0 Likes
881

Try like this ..

CONCATENATE text-006 text-018 text-007 text-008 text-009 text-010

into it_attach

SEPARATED BY con_tab.

CONCATENATE it_attach con_cret INTO it_attach. <----


Change this line ...

APPEND it_attach.

CONCATENATE text-011 text-012 text-013 text-014 text-015 text-016

into it_attach

SEPARATED By con_tab.

APPEND it_attach.

Read only

Former Member
0 Likes
882

Hi Nihi

Please try by passing the TAB character wherever you need to split into a different cell.

data: tab(1) type c value cl_abap_char_utilities=>horizontal_tab.

Regards

Eswar

Read only

0 Likes
881

HI Eshwar,

i solved it. i have seen lot of posts on more than 255 characters in excel attachment here and there in the forum.

a simple and precise solution lies in building xls table. no need to worry of anything else. logic is very simple but to get to know that the logic is simple i took one weeks time.

make chunks of 255 characters and and pass that appended table to SO_*API1.

in the following way we can attach more than 255 row length and no hassles in declaring string and converting to to binary and things like those..

<b>FORM build_xls_data_table .

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.

CLEAR it_attach.

CONCATENATE text-006 text-018 text-007 text-008 text-009 text-010

text-011 text-012 text-013 text-020 text-014 text-015

INTO it_attach

SEPARATED BY con_tab.

CONCATENATE con_cret it_attach INTO it_attach.

APPEND it_attach.

CLEAR it_attach.

CONCATENATE text-016 text-017 text-019 text-021 text-022 text-023

text-024

INTO it_attach

SEPARATED BY con_tab.

CONCATENATE con_tab it_attach INTO it_attach.

APPEND it_attach.

CLEAR it_attach.

CONCATENATE text-025 text-026

INTO it_attach

SEPARATED BY con_tab.

CONCATENATE con_tab it_attach INTO it_attach.

APPEND it_attach.</b>