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

Excel Attachment Issue

Former Member
0 Likes
1,475

Hi ,

I use the FM : SO_NEW_DOCUMENT_ATT_SEND_API1 for triggering an email with the excel attachment. Email triggering with an attachment happens without any issues. But in the attachment , I am facing the following issue.

One of the fields in the excel is numeric. Excel displays that field in the exponential format. Say for example, if the content is 38883001593305 ,excel displays it as 3.8883E+13. I need to display the numeric as it is without any conversion. Please kindly suggest how to achieve this.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,373

Hi friend,

As others said its correct if you just stretch the field it will show the correct output.

If you are processing the excel directly for some other purpose just use the field as a char field so that you will get the output as required directly.

Just pass those fields to a char field and then populate your output table or create the output table with all char fields and then do the updation it will work.

If no issues means please follow your old method itself. Any queries please revert back to me will help you.

Thanks,

Sri Hari.

Edited by: srihari.kumar on Jan 4, 2012 6:43 PM

12 REPLIES 12
Read only

Harsh_Bansal
Contributor
0 Likes
1,373

Hi Selva,

It is getting populated properly in the excel, just displayed like this.

Just stretch the field/column in the excel sheet and you will see the full value.

Regards,

Harsh Bansal

Read only

Former Member
0 Likes
1,373

Hi,

Double click on the column head which is having that type of value . Now it shows the numeric number and save it.

Regards,

G.Aditya

Read only

Former Member
0 Likes
1,373

Thanks for your suggestions. Eventhough I have streched it out, it looks like in the same form.

Yes,If I change the formatting as Text instead of numeric , it works. But how to achieve thie functionlity automatically through ABAP?.

Read only

Former Member
0 Likes
1,374

Hi friend,

As others said its correct if you just stretch the field it will show the correct output.

If you are processing the excel directly for some other purpose just use the field as a char field so that you will get the output as required directly.

Just pass those fields to a char field and then populate your output table or create the output table with all char fields and then do the updation it will work.

If no issues means please follow your old method itself. Any queries please revert back to me will help you.

Thanks,

Sri Hari.

Edited by: srihari.kumar on Jan 4, 2012 6:43 PM

Read only

0 Likes
1,373

Thanks Hari. I have already tried this. But it does not work it out. Actually I am passing all the numeric fields to string and then concatenating it into another string and then appending it to the internal table of type SOLIX. It does not work it out.

Read only

0 Likes
1,373

Hi friend,

Instead of concatenating into a single field just try move and move into different different CHAR fields and see whether it works friend.

Because this may happen when the value is large also so move a single field into a char field of save type and check the output.

If still the problem exists please revert back to me will help you.

Thanks,

Sri Hari

Read only

0 Likes
1,373

Selva,

When I implemented the same functionality, I used the attachment table of type solisti1, in it the field is of type CHAR255.

But in SOLIX, the field is of type RAW255. I don't know if it will make any difference or not, but in my case if i stretch the column, then i get to see the full value.

Regards,

Harsh Bansal

Read only

0 Likes
1,373

Hari, I have tried this too . It does not work it out.

Read only

0 Likes
1,373

Even if I try with SOLISTI1 also, it does not work it out for me..

Read only

0 Likes
1,373

Resolved the issue by myself . Thanks for everyone's suggestions.

Read only

0 Likes
1,373

Please update how you resolved it.

Regards,

Harsh Bansal

Read only

Former Member
0 Likes
1,373

Hi friend,

follow the below code

{ lv_message = 'Mail For Cancelled Invoices.'.

append lv_message to it_message.

concatenate 'OPERATING UNIT NAME'

'INVOICE BATCH NAME'

'SUPPLIER NAME'

'SUPPLIER GSL'

'SUPPLIER PAY SITE CODE'

'SUPPLIER PAY SITE ADDRESS'

'SUPPLIER PAY SITE CITY'

'SUPPLIER PAY SITE STATE'

'SUPPLIER PAY SITE COUNTRY'

'INVOICE NUMBER'

'VOUCHER NUMBER'

'PO NUMBER'

'PO LINE NUMBER'

'PO BUYER NAME'

'INVOICE DATE'

'CANCELLED DATE'

'INVOICE ENTERED DATE'

'INVOICE AMOUNT'

'INVOICE CREATED BY'

into it_attachment separated by

cl_abap_char_utilities=>horizontal_tab.

concatenate cl_abap_char_utilities=>cr_lf it_attachment into it_attachment.

append it_attachment.

loop at t_output into wa_output.

concatenate wa_output-bukrs

wa_output-belnr

wa_output-name1

wa_output-gsl

wa_output-lifnr

wa_output-stras

wa_output-ort01

wa_output-regio

wa_output-land1

wa_output-xblnr

wa_output-belnr

wa_output-ebeln

wa_output-ebelp

wa_output-name2

wa_output-budat

wa_output-cpudt

wa_output-bldat

wa_output-dmbtr

wa_output-usnam

into it_attachment separated by

cl_abap_char_utilities=>horizontal_tab.

concatenate cl_abap_char_utilities=>cr_lf it_attachment into it_attachment.

append it_attachment.

endloop.

  • Selecting the mail id's

select intid

email

from ztbidl

into table t_ztbidl

where intid = 'RICEF125' and

obj_name = 'EPIQ'.

loop at t_ztbidl into wa_ztbidl.

it_receivers-receiver = wa_ztbidl-email.

it_receivers-rec_type = 'U'.

it_receivers-com_type = 'INT'.

it_receivers-notif_del = 'X'.

it_receivers-notif_ndel = 'X'.

it_receivers-express = 'X'.

append it_receivers.

endloop.

*File Type

ld_format = 'XLS'.

**File Name

  • ld_attfilename = 'File1'.

concatenate 'PIC_' sy-datum into ld_attfilename.

  • Fill the document data.

gd_doc_data-doc_size = 1.

  • Populate the subject/generic message attributes

gd_doc_data-obj_langu = sy-langu.

gd_doc_data-obj_name = 'SAPRPT'.

gd_doc_data-obj_descr = psubject .

gd_doc_data-sensitivty = 'F'.

  • Fill the document data and get size of attachment

clear gd_doc_data.

  • Populate the subject/generic message attributes

gd_doc_data-obj_langu = sy-langu.

read table it_attachment index w_cnt.

gd_doc_data-doc_size = ( w_cnt - 1 ) * 255 + strlen( it_attachment ).

gd_doc_data-obj_name = 'SAPRPT'.

gd_doc_data-obj_descr = psubject.

gd_doc_data-sensitivty = 'F'.

  • Describe the body of the message

clear it_packing_list.

refresh it_packing_list.

it_packing_list-transf_bin = space.

it_packing_list-head_start = 1.

it_packing_list-head_num = 0.

it_packing_list-body_start = 1.

describe table it_message lines it_packing_list-body_num.

it_packing_list-doc_type = 'RAW'.

append it_packing_list.

**Describe the attachment info

it_packing_list-transf_bin = 'X'.

it_packing_list-head_start = 1.

it_packing_list-head_num = 1.

it_packing_list-body_start = 1.

describe table it_attachment lines it_packing_list-body_num.

it_packing_list-doc_type = ld_format.

it_packing_list-obj_name = ld_attfilename.

it_packing_list-obj_descr = ld_attfilename.

it_packing_list-doc_size = it_packing_list-body_num * 255.

append it_packing_list.

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

exporting

document_data = gd_doc_data

put_in_outbox = 'X'

commit_work = 'X'

tables

packing_list = it_packing_list

contents_bin = it_attachment

contents_txt = it_message

receivers = it_receivers

exceptions

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

others = 8.

)