‎2009 May 08 6:26 AM
Hi abapers,
I want to implement a requirment wherein i will be doing a validation for various fields of a excel sheet.
Right now i am showing a POP up with all the error log found in the excel sheet.
Is it possible to open the uploaded excel sheet after the POP so that user can correct the various fields and save the excel sheet while the program is executing.
regards,
Aditya
‎2009 May 08 6:58 AM
Hi ,
As because the WS_EXECUTE is a obsolete FM , you can use the method
EXECUTE of class cl_gui_frontend_services as follows.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
DOCUMENT = 'C:\EXCEL\TEST.XLS' " Full file path with type
* APPLICATION =
* PARAMETER =
* DEFAULT_DIRECTORY =
* MAXIMIZED =
* MINIMIZED =
* SYNCHRONOUS =
* OPERATION = 'OPEN'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
SYNCHRONOUS_FAILED = 8
NOT_SUPPORTED_BY_GUI = 9
others = 10
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Regards
Pinaki
‎2009 May 08 6:35 AM
‎2009 May 08 6:58 AM
hi aditya
u can use OLE for this..
Upload the excel in a itab .
carry out ur validation and dump all the errorenous records in another itab2 .
then display the itab2 in the form of a Xcel using OLE with one extra column .. displaying all the error message for the particular record .
Regards
Renu
‎2009 May 08 7:06 AM
Hi,
Can you please explian in more details.
As i am quite new to the concept of OLE.
Regards,
Aditya
‎2009 May 08 7:31 AM
Hi Aditya ,
let me once more clarify with ur requirements .
User is uploading an excel sheet.
U doing validations on the records and getting the error in records.
Displaying the uploaded excel sheet to user to rectify the errors.
and then update the databse with the correct records.
So for the above
use WS_upload ,GUI_Upload FM for uploading the excel sheet in itab.
using this itab ,Dynamically add one more column for the errors.
Display records in an editable ALV grid.
BCALV_EDIT_01
BCALV_EDIT_02
BCALV_EDIT_03
BCALV_EDIT_04
BCALV_FULLSCREEN_GRID_EDIT
BCALV_GRID_EDIT
BCALV_TEST_GRID_EDIT_01
BCALV_TEST_GRID_EDITABLE
Also see this
http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm
then update the database
Regards
Renu
Edited by: Renu Gusain on May 8, 2009 8:40 AM
‎2009 May 08 6:49 AM
Hi Aditya ,
check the Function Module WS_EXECUTE to open the .XLS file .
In the interface parameter Program specify the full file path (of the .XLS file)
and execute it to open the specified file.
Regards
Pinaki
‎2009 May 08 6:58 AM
Hi ,
As because the WS_EXECUTE is a obsolete FM , you can use the method
EXECUTE of class cl_gui_frontend_services as follows.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
DOCUMENT = 'C:\EXCEL\TEST.XLS' " Full file path with type
* APPLICATION =
* PARAMETER =
* DEFAULT_DIRECTORY =
* MAXIMIZED =
* MINIMIZED =
* SYNCHRONOUS =
* OPERATION = 'OPEN'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
SYNCHRONOUS_FAILED = 8
NOT_SUPPORTED_BY_GUI = 9
others = 10
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Regards
Pinaki
‎2009 May 08 7:04 AM
hI,
Is it possible to know whether user has saved any changes in the excel .
So that i can re-execute my function of uploading the changed data in an internal table again.
Thanks for your earlier reply!!
‎2009 May 08 7:13 AM
Hi,
I thick you can not track whether the file has been changed or not.
So after closing the file again you need to check whether the file have error or not
by re-execute your function module.
Regards
Pinaki