‎2008 Mar 11 5:13 AM
Hi Friends..
If I run the program it want to store the data into excel sheet(first few lines) , if i run the program again I want to store the next result in the same excel sheet after that data(first time data).
is it any solution available to store the data in the same excel sheet again again in different row of that excel sheet.
Thanks
Gowrishankar
‎2008 Mar 11 5:45 AM
Hi,
I am not sure which FM u r using for downloading. The FM GUI_DOWNLOAD will work for your requirement. Set the parameter Append to value 'A'. Every time it will append the data to ur file.
Check below code.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = l_file
FILETYPE = 'ASC'
APPEND = 'A'
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = i_tab
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Vinod.
‎2008 Mar 11 6:01 AM
Hi Gowrishankar,
First, let me know where do you want to place the excel file( Presentation or Application servers).
If you want to update the file on presentation server with your data every time, you can
use the FM 'GUI_DOWNLOAD' and set the parameter 'APPEND' so that it appends the
data to the same file instead of overwriting it.
For a demo prog, you can refer to the FM documentation.
If you need any more help, get back to me.
Regards,
Jallu
‎2008 Mar 24 3:49 AM
Hi Jalendar Thanks For your reply..
It works fine.. i have one more requirment.
the data from internal tables are updated into excel sheet
perfectly.
before that i need to give the headings for that columns in excel sheet.if i enter the headings manually the datas are not updated in excel sheet.
so how can i give the heading for that columns..
Thanks
Gowrishankar
‎2008 Mar 24 4:14 AM
Hi Gowrishankar,
Append the column headings to the internal table before u append the data so that column headings will also be downloaded in to the excell. So ur internal table first row will be column headings and subsequent rows will be actual data.
Thanks,
Vinod.
‎2008 Mar 24 4:47 AM
ok vinod thanks for your reply..
I think u mis undersatnd my requirment..
datas are in integer formet.
headings are c format.
and every time I run this program it appends in the excel sheet
i append 1 row in the excel sheet at every time execution of the program.
Every periodic time I run this program it appends one row in the excel sheet.
but heading should displayed only once..
Thanks
Gowrishankar
‎2008 Mar 24 6:16 AM
Hi Gowrishankar,
Got one idea. First upload the file using GUI_UPLOAD or KCD_EXCELL_OLE_TO_INT_CONVERT FMs. and read the first record. If it doenot has headers then download the headers(Only) to the file using GUI_DOWNLOAD. Later download the actual data. This logic will work even if the user gives different file name which does not exist in the system(New file name).
Thanks,
Vinod.
Edited by: Vinod Kumar Vemuru on Mar 24, 2008 11:48 AM
‎2008 Mar 24 5:08 AM
Hi Gowrishankar,
I guess, you are making use of the tables parameter 'FIELDNAMES' for writing
column headings in the excel. If yes, refresh this table before calling the FM for other than
initial time execution of the program.
If you have any ztable to store the constants, then maintain one entry in that table for this program
when this program is executed for the first time.
If you need any more help, get back to me.
Regards,
Jallu
‎2008 Mar 24 6:31 AM
Hi Jalendar..
Thanks for reply..
what i did is.. simply stored the headings in internal table and call it from gui_download.
I wrote separate gui_download for data.
I want to execute the first gui_download once in a day,I want to execute the second gui_download in every hour.
its my exact requirment..
if any solution available inform to me..
Thanks
Gowrishankar
‎2008 Mar 24 6:39 AM
You can use set & get parameters.
First check the value in SAP memory using GET, if the value is same as today's date then execute second gui_download.
If the value is different then store the todays date in to SAP memory using SET, And execute both gui_download.
If u don't want to use Memory concept, then create one z table, with one field type date. And check the value of the field with today's date.