‎2006 Jan 17 3:43 PM
Greetings, The requirement needs an excel file to be populated with data and then be presented to the user for simulation of an installment plan, I am doing this using OLE and then calling the FM SAP_STARTS_EXCEL to present the information. However, all changes made to the file while open inside the GUI are ignored and when the file is re-opened for data retrieval the correct data is not there.
Does anyone know how can I implement this kind of interaction for data presentation and retrieval using Excel.
‎2006 Jan 17 3:44 PM
‎2006 Jan 17 3:58 PM
Thanks Rich for the prompt reply, however I don't see the changes reflected in the original file after saving it, is there anything else I should do to see the changes reflected?
‎2006 Jan 17 4:00 PM
‎2006 Jan 17 4:36 PM
Here it is:
* Initialize
DATA:
EXCELAPP TYPE OLE2_OBJECT, "Aplicación Excel
EXCELWBK TYPE OLE2_OBJECT. "Hoja de trabajo
CREATE OBJECT EXCELAPP 'EXCEL.Application'.
SET PROPERTY OF EXCELAPP 'Visible' = 0.
CALL METHOD OF EXCELAPP 'Workbooks' = EXCELWBK.
CALL METHOD OF EXCELWBK 'Open'
EXPORTING
#1 = FNAME.
CALL METHOD OF EXCELAPP 'Run'
EXPORTING
#1 = 'SelectWBK'
#2 = 'Parametros'.
CALL METHOD OF EXCELAPP 'Run'
EXPORTING
#1 = 'EscribirCelda'
#2 = 'C5'
#3 = PARTNERDATA-CONT_ACCT.
.....
* This call saves the file
CALL METHOD OF EXCELAPP 'Run'
EXPORTING
#1 = 'SaveWBK'
#2 = ''.
* Everything OK so far
CALL METHOD OF EXCELAPP 'Quit'.
FREE OBJECT EXCELWBK.
FREE OBJECT EXCELAPP.
* Present file in the dynpro
CALL FUNCTION 'SAP_STARTS_EXCEL'
EXPORTING
I_FILENAME = FNAME
EXCEPTIONS
EXCECUTION_FAILED = 1
OTHERS = 2.
* retrieve data
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = FNAME
I_BEGIN_COL = 1
I_BEGIN_ROW = 14
I_END_COL = 11
I_END_ROW = 74
TABLES
INTERN = DATA_TAB
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.