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

Interactive list - export to excel

Former Member
0 Likes
926

i'm using the FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT' for export to excel.

how to make excel treat the numeric values as text values?

there is alignment problem for different numbers and text field values.

eg. numbers in excel are aligned to the right, text in excel aligned to the left.

i'm thinking of adding ' (apostrophe) to number...

but problem again..

eg. for the matnr field... it may contain fields like "00000123", "0023", "54".."abc".."abc00"...

how to get rid of the zeros?

Cheers,

Charles

abap newbie

9 REPLIES 9
Read only

Former Member
0 Likes
885

Hi,

to get rid of the leading zeros you may map from internal (= database) to external (= presentation) format by using fm CONVERSION_EXIT_ALPHA_OUTPUT before you add apostrophes.

Regards

Read only

Former Member
0 Likes
885

hi,

I guess there is a command PACK which would remove the leading zeros. try using that.

santhosh

Read only

Former Member
0 Likes
885

Hi Charles,

I dont think formatting in excel is possible from the Function Module. I think the best solution here is to create your final internal table with only character variables. Move all the data into this table where the numeric values should be trimmed off with leading zeros using the function module(CONVERSION_EXIT_ALPHA_OUTPUT).Finally pass this final internal table to the function module which will download in the excel format.

Please let me know for any clarifications required.

Regards,

Swaroop

Read only

Former Member
0 Likes
885

how do i output the single quote '

?

eg... DATA: addchar VALUE '"'.

double quote no problem...but what about single quote?

what's the special character?

Thanks,

Charles

abap newbie

Read only

0 Likes
885

ohhh...found out about the single quote...

using double single quotes..

solved

Thanks,

Charles

abap newbie

Read only

Former Member
0 Likes
885

Managed to insert the ' doesnt seem to solve the problem...

the output in exel will display the ' until the user manually click and enter the field in excel to be recognised as numeric..

For ALV export to excel output, everything seems ok.

So, is there a better export to excel function to solve this alignment and formatting issue when I use list instead of ALV?

Thanks,

Charles

abap newbie

Read only

roy_deng
Discoverer
0 Likes
885

If possible ,you can try like as this : FIELDCAT-edit_mask = '''__________' .

Read only

Former Member
0 Likes
885

care to share what u meant by that?

Thanks,

Charles

abap newbie

Read only

Former Member
0 Likes
885

So, is there a better export to excel function to solve this alignment and formatting issue when I use list instead of ALV?

Thanks,

Charles

abap newbie