01-06-2011 12:44 AM
We get an ABAP runtime error when uploading an excel file with a custom tcode using WebGUI. It works ok with WinGUI. Any ideas what could be causing that error?
Runtime Errors RAISE_EXCEPTION
Date and Time 01/05/2011 17:27:16
Short text
Exception condition "JAVABEANNOTSUPPORTED" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
A RAISE statement in the program "C_OI_CONTAINER_CONTROL_CREATORCP" raised the
exception
condition "JAVABEANNOTSUPPORTED".
Since the exception was not intercepted by a superior
program, processing was terminated.
01-06-2011 1:48 AM
You can use the below code. One more thing while running make sure there is no unsaved excel sheet open in your system.
FORM sub_create_container .
Create Instance control for container
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = iref_control
error = iref_error.
IF iref_error->has_failed = c_check.
CALL METHOD iref_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
Create generic container linked to container in screen 100
CREATE OBJECT oref_container
EXPORTING
container_name = 'CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Error while creating container'(012).
ENDIF.
Establish connection to GUI Control
CALL METHOD iref_control->init_control
EXPORTING
inplace_enabled = c_check
r3_application_name = 'EXCEL CONTAINER'
parent = oref_container
IMPORTING
error = iref_error
EXCEPTIONS
javabeannotsupported = 1
OTHERS = 2.
IF iref_error->has_failed = c_check.
CALL METHOD iref_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
Create Document Proxy
CALL METHOD iref_control->get_document_proxy
EXPORTING
document_type = soi_doctype_excel_sheet
IMPORTING
document_proxy = iref_document
error = iref_error.
IF iref_error->has_failed = c_check.
CALL METHOD iref_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
ENDFORM. " SUB_CREATE_CONTAINER
FORM sub_create_document USING p_sheet TYPE i.
DATA: l_title TYPE char40,
l_char TYPE char2,
l_time TYPE i,
l_sheet TYPE char12.
Calculate the number of sheets to be created
l_time = p_sheet - 1.
CONCATENATE 'Assembly Table'(015) v_char INTO l_title
SEPARATED BY space.
Create document
CALL METHOD iref_document->create_document " Open use Open_document method
EXPORTING
open_inplace = c_check
document_title = l_title
no_flush = c_check
IMPORTING
error = iref_error.
Open Spreadsheet interface
CALL METHOD iref_document->get_spreadsheet_interface
EXPORTING
no_flush = c_check
IMPORTING
sheet_interface = iref_spreadsheet
error = iref_error.
Get number of sheets
CALL METHOD iref_spreadsheet->get_sheets
EXPORTING
no_flush = c_check
IMPORTING
sheets = i_sheets
error = iref_error.
Reaname he sheet
READ TABLE i_sheets INTO wa_sheets INDEX 1.
l_char = p_sheet.
CONCATENATE 'Sheet' l_char INTO l_sheet.
CALL METHOD iref_spreadsheet->set_sheet_name
EXPORTING
newname = l_sheet
oldname = wa_sheets-sheet_name
no_flush = c_check
IMPORTING
error = iref_error.
REFRESH i_sheets.
CLEAR: l_char,
l_sheet.
Add sheets
DO l_time TIMES.
l_char = sy-index.
l_char = p_sheet - l_char.
CONCATENATE 'Sheet' l_char INTO l_sheet.
CALL METHOD iref_spreadsheet->add_sheet
EXPORTING
name = l_sheet
no_flush = c_check
IMPORTING
error = iref_error.
ENDDO.
Get number of sheets
CALL METHOD iref_spreadsheet->get_sheets
EXPORTING
no_flush = c_check
IMPORTING
sheets = i_sheets
error = iref_error.
SORT i_sheets BY sheet_name DESCENDING.
ENDFORM. " SUB_CREATE_DOCUMENT
FORM sub_save_document .
DATA: l_changed TYPE int4.
Save the document
CALL METHOD iref_document->save_as
EXPORTING
file_name = p_file
no_flush = c_check
IMPORTING
error = iref_error.
Close the document
CALL METHOD iref_document->close_document
EXPORTING
do_save = c_check
no_flush = ''
IMPORTING
has_changed = l_changed
error = iref_error.
ENDFORM. " SUB_SAVE_DOCUMENT
Thanks
Subhankar
01-06-2011 1:48 AM
You can use the below code. One more thing while running make sure there is no unsaved excel sheet open in your system.
FORM sub_create_container .
Create Instance control for container
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = iref_control
error = iref_error.
IF iref_error->has_failed = c_check.
CALL METHOD iref_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
Create generic container linked to container in screen 100
CREATE OBJECT oref_container
EXPORTING
container_name = 'CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Error while creating container'(012).
ENDIF.
Establish connection to GUI Control
CALL METHOD iref_control->init_control
EXPORTING
inplace_enabled = c_check
r3_application_name = 'EXCEL CONTAINER'
parent = oref_container
IMPORTING
error = iref_error
EXCEPTIONS
javabeannotsupported = 1
OTHERS = 2.
IF iref_error->has_failed = c_check.
CALL METHOD iref_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
Create Document Proxy
CALL METHOD iref_control->get_document_proxy
EXPORTING
document_type = soi_doctype_excel_sheet
IMPORTING
document_proxy = iref_document
error = iref_error.
IF iref_error->has_failed = c_check.
CALL METHOD iref_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
ENDFORM. " SUB_CREATE_CONTAINER
FORM sub_create_document USING p_sheet TYPE i.
DATA: l_title TYPE char40,
l_char TYPE char2,
l_time TYPE i,
l_sheet TYPE char12.
Calculate the number of sheets to be created
l_time = p_sheet - 1.
CONCATENATE 'Assembly Table'(015) v_char INTO l_title
SEPARATED BY space.
Create document
CALL METHOD iref_document->create_document " Open use Open_document method
EXPORTING
open_inplace = c_check
document_title = l_title
no_flush = c_check
IMPORTING
error = iref_error.
Open Spreadsheet interface
CALL METHOD iref_document->get_spreadsheet_interface
EXPORTING
no_flush = c_check
IMPORTING
sheet_interface = iref_spreadsheet
error = iref_error.
Get number of sheets
CALL METHOD iref_spreadsheet->get_sheets
EXPORTING
no_flush = c_check
IMPORTING
sheets = i_sheets
error = iref_error.
Reaname he sheet
READ TABLE i_sheets INTO wa_sheets INDEX 1.
l_char = p_sheet.
CONCATENATE 'Sheet' l_char INTO l_sheet.
CALL METHOD iref_spreadsheet->set_sheet_name
EXPORTING
newname = l_sheet
oldname = wa_sheets-sheet_name
no_flush = c_check
IMPORTING
error = iref_error.
REFRESH i_sheets.
CLEAR: l_char,
l_sheet.
Add sheets
DO l_time TIMES.
l_char = sy-index.
l_char = p_sheet - l_char.
CONCATENATE 'Sheet' l_char INTO l_sheet.
CALL METHOD iref_spreadsheet->add_sheet
EXPORTING
name = l_sheet
no_flush = c_check
IMPORTING
error = iref_error.
ENDDO.
Get number of sheets
CALL METHOD iref_spreadsheet->get_sheets
EXPORTING
no_flush = c_check
IMPORTING
sheets = i_sheets
error = iref_error.
SORT i_sheets BY sheet_name DESCENDING.
ENDFORM. " SUB_CREATE_DOCUMENT
FORM sub_save_document .
DATA: l_changed TYPE int4.
Save the document
CALL METHOD iref_document->save_as
EXPORTING
file_name = p_file
no_flush = c_check
IMPORTING
error = iref_error.
Close the document
CALL METHOD iref_document->close_document
EXPORTING
do_save = c_check
no_flush = ''
IMPORTING
has_changed = l_changed
error = iref_error.
ENDFORM. " SUB_SAVE_DOCUMENT
Thanks
Subhankar
01-18-2011 3:40 PM
Hi Garani,
We tried this code and it didn't work unfortunately. We opened a customer message with SAP and they said this type of Office integration is not supported per SAP note #'s 314568 and 512068.
06-16-2012 10:51 AM
See Note 822867 Desktop Office Integration: No support for ITS & Java GUI
This is only meant to stop you getting the dump
JAVABEANNOTSUPPORTED
VERY IMPORTANT
It will not allow you to have the same functionality that you have via
the SAPGUI via the WEBGUI.
See also note:
512068 Office integration and SAP GUI for HTML
____________________________________________________________________
You can use text file to upload the data. but you can use the excel file as Desktop Office Integration is not available for SAP ITS based applications and SAP GUI for Java
02-07-2023 1:55 PM
Hi Subhankar Garani,
Can you please guide us on where to put this code?
Thanks & Regards,
Dinesh Saini