10-10-2006 10:24 AM
Hi All,
Hi have created a program that selects data from a particular table and load it a new session of ms excel program. It automatically opens ms excel through ole2_objects and populates the rows one by one.
Yet there is a new requirement. The user should be able to run it both in foreground and background. When run in background, an excel file should be deposited in a particular directory (given by the user). The user can choose to run it in background by just pressing F9.
If the program runs in foreground, nothing should change as that of the old version(opens ms excel etc.). Is there any way I can catch the value of the Key F9? How do I do these?
Please help. I'll appreciate any help.
Kenny
10-10-2006 10:27 AM
u have to pput like this
if SY-BATCH eq 'X'.( program running in background)
logic
else.
logic
endif.
regards
Prabhu
10-10-2006 10:29 AM
Hi,
Thanks so much.
Would you happen to know how to create an excel file directly and dump it to directory?
Thanks.
Kenny
10-10-2006 10:34 AM
hi ,
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'c:Total_Plant Waste.xls'
TABLES
* PIVOT_FIELD_TAB =
DATA_TAB = T_EXCEL1
FIELDNAMES = FLDITAB
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.
clear: T_EXCEL1,FLDITAB.
REFRESH: T_EXCEL1,FLDITAB.
check this.
regards
Prabhu
10-10-2006 3:06 PM
You cannot create a file on the presentation server in the background. You would have to create it on the application server.
Rob
10-10-2006 10:45 PM
As Rob has stated, you cannot download an excel file to the user's system.
Actually, when you schedule a job in background, the files can only be stored in the application server.
It has to be later downloaded again to the user's system from AL11 or by a custom program.