Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

opening excel sheet while program execution

Former Member
0 Likes
2,170

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,503

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,503

Guys,

Please let me know if this possible.

Read only

0 Likes
1,503

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

Read only

0 Likes
1,503

Hi,

Can you please explian in more details.

As i am quite new to the concept of OLE.

Regards,

Aditya

Read only

0 Likes
1,503

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.

Refer :

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

Read only

Former Member
0 Likes
1,503

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

Read only

Former Member
0 Likes
1,504

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

Read only

0 Likes
1,503

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!!

Read only

0 Likes
1,503

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