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 with Quantity while downloading into Excel sheet.

Former Member
0 Likes
426

Hi guru's.

In Excel sheet Quantity values (Decimal points) negative are displaying in 9.00- but it should be display -9.00 please suggest that how to resolve this problem.

I am using following code in program for downloading data into excel sheet.

*************************

*Download the data in Excel sheet if Output data is not initial.

if not object_tab[] is initial.

sort i_fileds2 by col_pos.

LOOP AT i_fileds2 INTO wa_fileds2 where no_out = ''.

xfc-FIELDNAME = wa_fileds2-FIELDNAME.

xfc-DATATYPE = wa_fileds2-DATATYPE.

xfc-INTTYPE = wa_fileds2-INTTYPE.

xfc-INTLEN = wa_fileds2-INTLEN.

if wa_fileds2-DATATYPE = 'QUAN'.

xfc-DATATYPE = 'CHAR'.

endif.

append xfc to ifc.

endloop.

  • Assign Layout Fields Headings

sort i_fileds2 by col_pos.

LOOP AT i_fileds2 INTO wa_fileds2.

it_fields-fields = wa_fileds2-seltext_l.

append it_fields.

endloop.

  • Create the new Dynamic Table

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = ifc

IMPORTING

ep_table = new_table.

  • Create a new Line with the same structure of the Dynamic table.

ASSIGN new_table->* TO <l_table>.

CREATE DATA new_line LIKE LINE OF <l_table>.

ASSIGN new_line->* TO <l_line>.

CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

EXPORTING

FILE_NAME = P_FILE1

CREATE_PIVOT = 0

DATA_SHEET_NAME = ''

  • PIVOT_SHEET_NAME = ' '

  • PASSWORD = ' '

  • PASSWORD_OPTION = 0

TABLES

  • PIVOT_FIELD_TAB =

DATA_TAB = <l_table>

FIELDNAMES = it_fields

EXCEPTIONS

FILE_NOT_EXIST = 1

FILENAME_EXPECTED = 2

COMMUNICATION_ERROR = 3

OLE_OBJECT_METHOD_ERROR = 4

OLE_OBJECT_PROPERTY_ERROR = 5

INVALID_FILENAME = 6

INVALID_PIVOT_FIELDS = 7

DOWNLOAD_PROBLEM = 8

OTHERS = 9

.

************************

Thanks and Regards,

Pavan.

1 REPLY 1
Read only

naimesh_patel
Active Contributor
0 Likes
339

You can do it in Excel only

Like:

In excel ...

Select the quantity column .. Data > Text to column

Select Delimited... Press Next...Press Next.. Press Finish..

This will change the '-' from back to front of the number.

Regards,

Naimesh Patel