03-16-2009 11:08 AM
experts,
i created one hiraical alv report when we upload for year data into xl sheet and calculatin the sum of all vallues is not taly with the std sum which is shown on alv. the records are up to 1500 recordsmy cn any one know wht happening when exporting to xl sheet.
thanq,
rajesh.k
03-16-2009 3:13 PM
Hi nacl,
Check out first all entries were exported/ not.if exported , check out the number format in excel sheet.
03-17-2009 4:24 AM
hey to check all entries they r almost 25 thousand record its not possible to check all
thanq from rajesh.k
03-17-2009 5:59 AM
hey i checked each record one record is not uploaded to xl sheet.
i re executed the same report agin by give selection criteria which will show that particular record.
when i try to upload to xl no data found in xl only headers went to xl sheet.
why only perticular record was failing to upload.
when i see in deburging mode i found that asc_file is having record but gui_download function module doesnt down loaded it.
thanq,
rajesh.k
03-17-2009 11:39 AM
Hi nacl,
Try using SAP_CONVERT_TO_XLS_FORMAT function module.
Try out like this....
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
I_FIELD_SEPERATOR = seper
I_LINE_HEADER = 'X'
I_FILENAME = P_FILE
tables
I_TAB_SAP_DATA = itab
exceptions
CONVERSION_FAILED = 1.
Let me know if it worked.
Gowri
03-17-2009 12:45 PM
Hi.
Plz check the following things.
When u got the final internal table, set the break point after it.
click on itab which have ur final data in debugger mood.
Click here the button which is having tool tip Services Of the Tool which is in front of table.
It will show a window. In it click on Save to local file. give the file name file.xls and save it.
Now check does this file is containing all records which u want , if yes then it means ur processing is correct and there is mistake while downloading the itab to excel.
if this itab does not contain all records then the logic u have implemented will be restricting that record to come in itab.
have u checked it that final itab is getting all ur required data.
Below is some sample code which will help u to load itab data into excel file.
Just copy paste and execute it. then see how it is working.
TYPES: BEGIN OF ty_emp_excel,
f1(13),
f2(15),
f3(15),
END OF ty_emp_excel.
DATA: it_emp_excel TYPE STANDARD TABLE OF ty_emp_excel WITH HEADER LINE.
DATA: BEGIN OF itab OCCURS 0,
f1,
f2,
f3,
END OF itab.
DATA: wa_itab LIKE itab.
itab-f1 = 'A'.
itab-f2 = '@'.
itab-f3 = '1'.
APPEND itab.
itab-f1 = 'B'.
itab-f2 = '@'.
itab-f3 = '3'.
APPEND itab.
MOVE:
'Field1' TO it_emp_excel-f1,
'Field2' TO it_emp_excel-f2,
'Field3' TO it_emp_excel-f3.
APPEND it_emp_excel.
LOOP AT itab INTO wa_itab.
MOVE-CORRESPONDING wa_itab TO it_emp_excel.
APPEND it_emp_excel.
ENDLOOP.
PERFORM dnld_in_excel.
*&---------------------------------------------------------------------*
*& Form dnld_in_excel
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM dnld_in_excel.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = 'C:\ZFIEOBID'
TABLES
data_tab = it_emp_excel.
ENDFORM. "dnld_in_excel
03-18-2009 9:36 AM