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

data in Excel sheet

Former Member
0 Likes
591

hi abapers,

I have extracted data into excel sheet,in which i have field MARD-LGORT. its having values for storage location like 0001,0002 etc.but in excel sheet i get values like 1,2 etc.it truncates leading zeros.but i want zeros in excel sheet also.

i want this values without setting of excel sheet.

plz help me.will reward points.

thanks,

Twinkal.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
558

Hi Friend ,

1) if u r getting the values 0001 in the report and 1 in excel sheet ,

then no problem with the field value ,

the problem is with ur Excel sheet settings , change the excel sheet settings it will work , I guess no other alternate for this .

2) If it is value 1 in excel sheet and ur downloading the value from excel sheet to the report , then the problem arises , when processing tht particular value MARD-LGORT it is char 4 , the system will check it for '0001' , but ur passing only ' 1 ' , here if we use conversion routine , the problem will b solved ...

Thanks..

4 REPLIES 4
Read only

Former Member
0 Likes
559

Hi Friend ,

1) if u r getting the values 0001 in the report and 1 in excel sheet ,

then no problem with the field value ,

the problem is with ur Excel sheet settings , change the excel sheet settings it will work , I guess no other alternate for this .

2) If it is value 1 in excel sheet and ur downloading the value from excel sheet to the report , then the problem arises , when processing tht particular value MARD-LGORT it is char 4 , the system will check it for '0001' , but ur passing only ' 1 ' , here if we use conversion routine , the problem will b solved ...

Thanks..

Read only

Former Member
0 Likes
558

Hi,

You cant download the data in required format i.e. with leading zeroes into the excel sheeet without settings. Instead you can download the contents to the tab delimited file and then can save the same to excel sheet.

Thanks & regards,

Prakash Ghantasala

Read only

Former Member
0 Likes
558

Add " ' " at the begining of the the value before downloading it to excel.

Excel identifies any value with a single quote at the begining as a character value or else it treats it as a numeric value.

Ex:

Data: Lv_lgort(5) type c.

Concatenate '''' MARD-LGORT into lv_lgort.

Read only

Former Member
0 Likes
558

Twinkal,

Hi

in that FM there is parameter called 'FILE TYPE'

pass the value for it as 'DBF'

it will work.

data : begin of it_heading occurs 0,
line(30) type c,
end of it_heading.
 
it_heading-line = 'ABC'.
append it_headING.
it_headING-line = 'XYZ'.
append it_headING.
 
call function 'WS_DOWNLOAD'
exporting
* BIN_FILESIZE = ' '
* CODEPAGE = ' '
filename = p_file
<b>filetype = 'DBF'</b>
mode = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = it_data
fieldnames = it_heading
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10
.
if sy-subrc eq 0.
 
 
endif.

Change all the fields not to be truncated, into character type in the internal table and then download it.

Also use Function Module: CONVERSION_EXIT_ALPHA_INPUT

Amit.