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: 

Reg: Excel alignment problem

Former Member
0 Kudos

Hi Friends,

i have created a program to send a mail with Excel Sheet attachment.

After receiving the mail, While i am opening the Excel Sheet,all the line item details are in a single line instead of one by one.

I cant get the correct alignment in the attachment as like my final internal table .How can i align/format the attachment datas while sending the mail?

Thanks & Regards,

Sakthivel.VT

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

For making internal table properly aligned you can fill your final table like:



DATA: BEGIN OF st,
      f1(2) TYPE c,
      f2(2) TYPE n,
      END OF st.

DATA: itab1 LIKE TABLE OF st WITH HEADER LINE,
      objbin1 LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
      c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.

  LOOP AT itab1.
    CONCATENATE itab1-f1 itab1-f2 INTO objbin1 separated BY c_tab.
    CONCATENATE c_ret objbin1 INTO objbin1.
    APPEND objbin1.
  ENDLOOP.

Hope it helps

Regards

Mansi

2 REPLIES 2

Former Member
0 Kudos

Hi Sakthivel,

Please check your internal table data, There is any special characters or not (Ex: ! @ # $ % ^ & * " : ? > etc.). If there is some special characters plz avoid those things in your internal table. Then only you will get correct alignment data in excel.

Thanks & Regards

Muralidhar.

Former Member
0 Kudos

Hi,

For making internal table properly aligned you can fill your final table like:



DATA: BEGIN OF st,
      f1(2) TYPE c,
      f2(2) TYPE n,
      END OF st.

DATA: itab1 LIKE TABLE OF st WITH HEADER LINE,
      objbin1 LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
      c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.

  LOOP AT itab1.
    CONCATENATE itab1-f1 itab1-f2 INTO objbin1 separated BY c_tab.
    CONCATENATE c_ret objbin1 INTO objbin1.
    APPEND objbin1.
  ENDLOOP.

Hope it helps

Regards

Mansi