I_oi_document_proxy - open_document_from_table
Hello everybody,
I would like to show an intern table from ABAP in Excel and afetr change save data in table. I try to use the method
i_oi_document_proxy ->open_document_from_table but it not woks correct. The data are not correct in columns and rows assigned. Can anybody give me a tip or a link to tutorial?
Regards
Bogdan
Hi Jonathan,
I have analized the SAPRDEMO_SPREADSHEET_INTERFACE Programm. The transfer of data with use the Interface methode get_ranges_data works fine. But when I try use this method in event handler for close_event it return an error code INTERFACE_NOT_SUPPORTED. I suppose that first the sheet is destroyed und then is event fired (during handlig sheet exist no more).
regards
Bogdan
Similar Messages
-
Opening an Excel document using I_OI_DOCUMENT_PROXY
Hi,
I'm currently opening an Excel document using the OPEN_DOCUMENT method of the I_OI_DOCUMENT_PROXY interface. A macro is then run to populate specified columns in the spreadsheet and then proceeds with printing the document.
Within Excel, we've set Application.ScreenUpdating = False, which hides the document from the user. When launching the document directly from the local drive (not from SAP), it doesn't get displayed.
However, calling it from SAP seems to bring up Excel, and it shows the processing of the macro as well as the automatic printing and only then will Excel close.
My question is, is there anyway we'd be able to run the Excel macro and print the spreadsheet without Excel ever opening at all?
Thanks and regards,
Adeline.Hi,
I'm currently opening an Excel document using the OPEN_DOCUMENT method of the I_OI_DOCUMENT_PROXY interface. A macro is then run to populate specified columns in the spreadsheet and then proceeds with printing the document.
Within Excel, we've set Application.ScreenUpdating = False, which hides the document from the user. When launching the document directly from the local drive (not from SAP), it doesn't get displayed.
However, calling it from SAP seems to bring up Excel, and it shows the processing of the macro as well as the automatic printing and only then will Excel close.
My question is, is there anyway we'd be able to run the Excel macro and print the spreadsheet without Excel ever opening at all?
Thanks and regards,
Adeline. -
I_OI_DOCUMENT_PROXY- EXECUTE_MACRO in excel
Hi,
I want to execute a macro to add a chart into excel. I created the macro 'graphic' in excel then I call it from abap with the metod execute macro but it doesn't work.
DATA: DOCUMENT TYPE REF TO I_OI_DOCUMENT_PROXY.
CALL METHOD DOCUMENT->EXECUTE_MACRO
EXPORTING
MACRO_STRING = 'Modulo1.graphic'
IMPORTING
ERROR = ERRORS
RETCODE = retcode
Also I tried
CALL METHOD DOCUMENT->EXECUTE_MACRO
EXPORTING
MACRO_STRING = 'graphic'
IMPORTING
ERROR = ERRORS
RETCODE = retcode
I would like you give me instructions for make it work. Do I have to do anything else to make it work?.Hi,
Please refere thie demo (Pie Chart) program GFW_PROG_PIE. This will help you.
Need more ifn fo please send me an e-mail.
Cheers.
Message was edited by: Lanka Murthy -
I_OI_DOCUMENT_PROXY and I_OI_SCRIPT_COLLECTION
Afternoon,
Has any one been able to create a macro within an excel document using I_OI_DOCUMENT_PROXY and I_OI_SCRIPT_COLLECTION interfaces? If so how did you go about doing this?
I get a CONTROL_INTERNAL_ERROR from the method gx_script_collection->add_script_from_table and can't seem to get beyond this poing:
MESSAGE_ID SOFFICEINTEGRATION
MESSAGE_NR 118
MESSAGE Script contains errors
Any help would be appreciated,
Regards,Hi John,
I found the error was not actual from EXCEL, but deep in from the Proxy service return error 118.
In the mean time I found the problem :o)
I have by mistake typed in macro wrong !
CALL METHOD lc_document->execute_macro
EXPORTING
* macro_string = 'CopySheet.Module1' -> Wrong call!
macro_string = 'Module1.CopySheet'
* script_name = ''
no_flush = ''
IMPORTING
error = lo_error
retcode = l_retcode.
Thanks for your help my code are working fine now :o)
Jørgen Jensen -
How to open a excel with VBA button using I_OI_DOCUMENT_PROXY
same this image:
http://www.ImageThe.net/show-image.php?id=d367faef6ed7333acc2edd0290481fc8
how to use OPEN_ACTIVEX_DOCUMENT?
CALL METHOD DOCUMENT->OPEN_ACTIVEX_DOCUMENT
EXPORTING
DOCUMENT_URL = ITEM_URL
IMPORTING
ERROR = ERRORS.Look at the below excel, it has macro, like sum. It will help you..
<%@page language="abap"%>
<html>
<head>
</head>
<body>
<object id="msx" style="width:100%;height:300px;margin-top:50px"
classid="clsid:0002E510-0000-0000-C000-000000000046">
<param name="DisplayTitleBar" value="false"/>
<param name="HTMLData" value=""/>
</object>
<script type="text/javascript">
layout_sheet = document.all("msx");
layout_sheet.Cells(1,5) = 'Test mit einzelner Zelle';
msx.range('F1').value = 'F1';
range = layout_sheet.Range(layout_sheet.Cells(1,1),layout_sheet.Cells(1,4));
record = "Jahr;Januar;Februar;März";
range.ParseText(record, ';');
range = layout_sheet.Range(layout_sheet.Cells(2,1),layout_sheet.Cells(2,4));
range.value = [ 2006, '15', '17', '19' ];
msx.range('a3:d3').value = [ 2007, 33, 15, 13 ];
msx.range('a4:d4').value = [ 'Summen', '=SUM(B2:B3)', '=SUM(C2:C3)', '=SUM(D2:D3)' ];
msx.range('b2').NumberFormat = '####.00';
msx.range('b2').Interior.Color = 'red';
msx.range('c1:d1').Font.Name = 'Courier';
msx.range('c1:d1').Font.Color = 'blue';
msx.range('c1:d1').Font.Size = 12;
msx.range('c1:d1').Font.Bold = 1;
layout_sheet.Cells.AutoFitColumns();
</script>
</body>
</html>
*Reward each useful answer
Raja T -
How to read .xls file from FTP server t oInternal table
Hi
am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
but the data i get in LT_TEXT is special characters.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = f_name "ProdDataFromCRM.xls.
* CHARACTER_MODE = 'X'
* IMPORTING
* BLOB_LENGTH =
TABLES
BLOB = lt_text
* TEXT = lt_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
can any one help me out to get the exact data..
Really appreciate your quick response..
Thank YouHi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
CALL METHOD document->open_document_from_table
of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
But, who knows, perhaps you want "And Now For Something Completely Different".
Regards
Clemens -
Where can we find the methods of the classes in OLE Interface
Hi All,
I am developing the code to download the file into multiple sheets of excel file.
got many links and sample codes from this forum.
but my doubt is where can we find the methods in applications.
Example:
add, cells, range etc are the methods in the object excel.application.
I want to find all other methods in this same object.
Please help me.
thanks in adv.
EswarHE,
see this demo program which is in DWDM
*& Report DEMOEXCELINTEGRATION *
INCLUDE rdemoexcelintegrationtop.
DATA: control TYPE REF TO i_oi_ole_container_control.
DATA: container TYPE REF TO cl_gui_custom_container.
DATA: link_server TYPE REF TO i_oi_link_server.
DATA: table_coll TYPE REF TO i_oi_table_collection.
DATA: retcode TYPE t_oi_ret_string,
document_type TYPE soi_document_type
VALUE soi_doctype_excel_chart,
document_format TYPE soi_document_type.
DATA: doc_url TYPE t_url.
DATA: usa_sales TYPE i VALUE 1000,
europe_sales TYPE i VALUE 2000,
japan_sales TYPE i VALUE 1000,
asia_sales TYPE i VALUE 100,
america_sales TYPE i VALUE 100,
africa_sales TYPE i VALUE 100.
DATA: total_sales TYPE i VALUE 0.
DATA: BEGIN OF test_line, region(50), sales TYPE i, END OF test_line.
DATA: test_table LIKE TABLE OF test_line.
DATA: wa_test_table LIKE test_line.
CLASS c_excel_document DEFINITION
CLASS c_excel_document DEFINITION.
PUBLIC SECTION.
DATA: proxy TYPE REF TO i_oi_document_proxy.
DATA: document_type TYPE soi_document_type.
DATA: data_table TYPE sbdst_content,
data_size TYPE i,
doc_url TYPE t_url.
METHODS: constructor
IMPORTING control TYPE REF TO i_oi_ole_container_control
document_type TYPE soi_document_type.
METHODS: on_close_document
FOR EVENT on_close_document OF i_oi_document_proxy
IMPORTING document_proxy has_changed.
METHODS: on_custom_event
FOR EVENT on_custom_event OF i_oi_document_proxy
IMPORTING document_proxy event_name param_count
param1 param2 param3.
METHODS: create_document
IMPORTING open_inplace TYPE c DEFAULT ' '
EXPORTING retcode TYPE t_oi_ret_string.
METHODS: open_document
IMPORTING open_inplace TYPE c DEFAULT ' '
open_readonly TYPE c DEFAULT ' '
EXPORTING retcode TYPE t_oi_ret_string.
METHODS: open_document_url
IMPORTING open_inplace TYPE c DEFAULT ' '
open_readonly TYPE c DEFAULT ' '
doc_url TYPE t_url DEFAULT ' '
EXPORTING retcode TYPE t_oi_ret_string.
METHODS: retrieve_document
IMPORTING documents TYPE document_list
EXPORTING document_format TYPE soi_document_type
doc_url TYPE t_url.
METHODS: close_document
IMPORTING do_save TYPE c DEFAULT ' '
RETURNING value(retcode) TYPE t_oi_ret_string.
PRIVATE SECTION.
DATA: control TYPE REF TO i_oi_ole_container_control.
ENDCLASS.
DATA: l_fcode LIKE fcode.
DATA: document TYPE REF TO c_excel_document.
DATA: bds_instance TYPE REF TO cl_bds_document_set.
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN0100'.
SET TITLEBAR '001'.
retcode = c_oi_errors=>ret_ok.
IF control IS INITIAL.
DATA: b_has_activex.
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = b_has_activex.
IF b_has_activex IS INITIAL. MESSAGE e007. ENDIF.
CALL METHOD c_oi_ole_control_creator=>get_ole_container_control
IMPORTING control = control
retcode = retcode.
CALL METHOD c_oi_errors=>show_message
EXPORTING type = 'E'.
CREATE OBJECT container
EXPORTING container_name = 'CONTAINER'.
CALL METHOD control->init_control
EXPORTING r3_application_name =
'Demo' "#EC NOTEXT
inplace_enabled = 'X'
inplace_scroll_documents = 'X'
parent = container
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message
EXPORTING type = 'E'.
CALL METHOD control->get_link_server
IMPORTING link_server = link_server
retcode = retcode.
CALL METHOD c_oi_errors=>show_message
EXPORTING type = 'E'.
CALL METHOD link_server->start_link_server
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message
EXPORTING type = 'E'.
CALL METHOD control->get_table_collection
IMPORTING table_collection = table_coll
retcode = retcode.
PERFORM refresh_sales.
CREATE OBJECT document
EXPORTING control = control
document_type = document_type.
CALL METHOD table_coll->add_table
EXPORTING table_name = 'SALES_IN'
table_type = table_coll->table_type_input
IMPORTING retcode = retcode
CHANGING data_table = test_table.
ENDIF.
IF bds_instance IS INITIAL.
CREATE OBJECT bds_instance.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
l_fcode = fcode.
CLEAR fcode.
CALL METHOD cl_gui_cfw=>dispatch.
CASE l_fcode.
WHEN 'EXIT'. "Zurück
IF NOT document IS INITIAL.
CALL METHOD document->close_document.
FREE document.
ENDIF.
IF NOT link_server IS INITIAL.
CALL METHOD link_server->stop_link_server
IMPORTING retcode = retcode.
FREE link_server.
ENDIF.
IF NOT table_coll IS INITIAL.
FREE table_coll.
ENDIF.
IF NOT control IS INITIAL.
CALL METHOD control->destroy_control
IMPORTING retcode = retcode.
FREE control.
ENDIF.
IF NOT bds_instance IS INITIAL.
FREE bds_instance.
ENDIF.
LEAVE TO SCREEN 0.
WHEN 'CREATE'.
IF NOT control IS INITIAL.
document->data_size = 0.
CLEAR document->data_table.
CALL METHOD document->create_document.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDIF.
WHEN 'SELECT'.
IF NOT control IS INITIAL.
DATA: documents TYPE document_list.
DATA: descr TYPE document_descr.
CLEAR documents.
descr-document_name = 'Car Sales Chart'(do1).
descr-document_id = 'DEMOEXCELCHART1'.
APPEND descr TO documents.
descr-document_name = 'Car Sales Chart 2'(do3).
descr-document_id = 'DEMOEXCELCHART2'.
APPEND descr TO documents.
descr-document_name = 'Car Sales Sheet'(do2).
descr-document_id = 'DEMOEXCELSHEET1'.
APPEND descr TO documents.
CLEAR doc_url.
CALL METHOD document->retrieve_document
EXPORTING documents = documents
IMPORTING document_format = document_format
doc_url = doc_url.
IF NOT doc_url IS INITIAL.
CALL METHOD document->close_document.
CALL METHOD document->open_document_url
EXPORTING open_inplace = 'X'
doc_url = doc_url
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ELSE.
MESSAGE e010.
ENDIF.
ENDIF.
WHEN 'OPEN'.
IF document->data_size NE 0.
IF NOT control IS INITIAL.
CALL METHOD document->open_document
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDIF.
ELSE.
MESSAGE e005.
ENDIF.
WHEN 'INPLACE'.
IF document->data_size NE 0.
IF NOT control IS INITIAL.
CALL METHOD document->open_document
EXPORTING open_inplace = 'X'
open_readonly = 'X'
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDIF.
ELSE.
MESSAGE e005.
ENDIF.
WHEN 'SAVEAS'.
IF NOT document IS INITIAL AND NOT document->proxy IS INITIAL.
CALL METHOD document->proxy->save_as
EXPORTING prompt_user = 'X'
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ELSE.
MESSAGE e000.
ENDIF.
WHEN 'CLOSE'.
IF NOT document IS INITIAL.
CALL METHOD document->close_document
EXPORTING do_save = 'X'.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ELSE.
MESSAGE e000.
ENDIF.
WHEN 'COPYLINK'.
IF NOT link_server IS INITIAL.
PERFORM refresh_sales.
CALL METHOD link_server->execute_copy_link_dialog
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ELSE.
MESSAGE e004.
ENDIF.
WHEN 'REFRESH'.
IF NOT link_server IS INITIAL.
PERFORM refresh_sales.
ELSE.
MESSAGE e004.
ENDIF.
IF NOT document IS INITIAL AND NOT document->proxy IS INITIAL.
CALL METHOD document->proxy->execute_macro
EXPORTING macro_string = 'R3StartupMacro'
param_count = 1
param1 = 10
IMPORTING retcode = retcode.
CHANGING retvalue = usa_sales.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ELSE.
MESSAGE e000.
ENDIF.
WHEN 'PRINT'.
IF NOT document IS INITIAL AND NOT document->proxy IS INITIAL.
CALL METHOD document->proxy->print_document
EXPORTING prompt_user = 'X'
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ELSE.
MESSAGE e000.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
CLASS c_excel_document IMPLEMENTATION.
CLASS c_excel_document IMPLEMENTATION.
METHOD: constructor.
IMPORTING control TYPE REF TO i_oi_ole_container_control
document_type TYPE soi_document_type
me->control = control.
me->document_type = document_type.
ENDMETHOD.
METHOD create_document.
IMPORTING open_inplace TYPE c DEFAULT ' '
RETURNING value(retcode) TYPE t_oi_ret_string.
IF NOT proxy IS INITIAL.
CALL METHOD me->close_document.
ENDIF.
CALL METHOD control->get_document_proxy
EXPORTING document_type = document_type
IMPORTING document_proxy = proxy
retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
CALL METHOD proxy->create_document
EXPORTING create_view_data = 'X'
open_inplace = open_inplace
IMPORTING retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
SET HANDLER me->on_close_document FOR proxy.
SET HANDLER me->on_custom_event FOR proxy.
ENDMETHOD.
METHOD open_document.
IMPORTING open_inplace TYPE c DEFAULT ' '
open_readonly TYPE c DEFAULT ' '
RETURNING value(retcode) TYPE t_oi_ret_string.
IF NOT proxy IS INITIAL.
CALL METHOD me->close_document.
ENDIF.
CALL METHOD control->get_document_proxy
EXPORTING document_type = document_type
IMPORTING document_proxy = proxy
retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
CALL METHOD proxy->open_document_from_table
EXPORTING document_table = data_table
document_size = data_size
open_inplace = open_inplace
open_readonly = open_readonly
IMPORTING retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
SET HANDLER me->on_close_document FOR proxy.
SET HANDLER me->on_custom_event FOR proxy.
CALL METHOD proxy->update_document_links
EXPORTING update_manual_links = 'X'
IMPORTING retcode = retcode.
ENDMETHOD.
METHOD close_document.
IMPORTING do_save TYPE c DEFAULT ' '
RETURNING value(retcode) TYPE t_oi_ret_string.
DATA: is_closed TYPE i, has_changed TYPE i.
DATA: doc_url(256).
IF NOT proxy IS INITIAL.
CALL METHOD proxy->is_destroyed IMPORTING ret_value = is_closed.
IF is_closed IS INITIAL.
CALL METHOD proxy->close_document
EXPORTING do_save = do_save
IMPORTING has_changed = has_changed
retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
ENDIF.
IF NOT has_changed IS INITIAL.
CALL METHOD proxy->save_document_to_table
IMPORTING retcode = retcode
CHANGING document_table = data_table
document_size = data_size.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
ENDIF.
CALL METHOD proxy->release_document
IMPORTING retcode = retcode.
SET HANDLER me->on_close_document FOR proxy ACTIVATION ' '.
SET HANDLER me->on_custom_event FOR proxy ACTIVATION ' '.
ELSE.
retcode = c_oi_errors=>ret_document_not_open.
ENDIF.
ENDMETHOD.
METHOD open_document_url.
IMPORTING open_inplace TYPE c DEFAULT ' '
open_readonly TYPE c DEFAULT ' '
doc_url TYPE t_url DEFAULT ' '
RETURNING value(retcode) TYPE t_oi_ret_string.
IF NOT proxy IS INITIAL.
CALL METHOD me->close_document.
ENDIF.
CALL METHOD control->get_document_proxy
EXPORTING document_type = document_type
IMPORTING document_proxy = proxy
retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
me->doc_url = doc_url.
CALL METHOD proxy->open_document
EXPORTING document_url = doc_url
open_inplace = open_inplace
open_readonly = open_readonly
IMPORTING retcode = retcode.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
Document shall also be available in ITAB for respective operations:
CALL METHOD proxy->save_document_to_table
IMPORTING retcode = retcode
CHANGING document_table = data_table
document_size = data_size.
IF retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
SET HANDLER me->on_close_document FOR proxy.
SET HANDLER me->on_custom_event FOR proxy.
CALL METHOD proxy->update_document_links
EXPORTING update_manual_links = 'X'
IMPORTING retcode = retcode.
ENDMETHOD.
METHOD retrieve_document.
importing documents type document_list
exporting document_format type soi_document_format
doc_url type t_url.
*----BDS-Data-Structures:--
Tables and WAs:
DATA: doc_signature TYPE sbdst_signature,
wa_doc_signature LIKE LINE OF doc_signature,
doc_components TYPE sbdst_components,
wa_doc_components LIKE LINE OF doc_components,
doc_properties TYPE sbdst_properties,
wa_doc_properties LIKE LINE OF doc_properties,
doc_uris TYPE sbdst_uri,
wa_doc_uris LIKE LINE OF doc_uris.
ID's:
DATA: doc_classname TYPE sbdst_classname VALUE 'SOFFICEINTEGRATION',
doc_classtype TYPE sbdst_classtype VALUE 'OT',
doc_object_key TYPE sbdst_object_key VALUE 'SOFFICEINTEGRATION',
doc_mimetype TYPE bapicompon-mimetype.
DATA: field_desc TYPE TABLE OF rsvbfidesc.
DATA: wa_field_desc TYPE rsvbfidesc.
DATA: l_nr LIKE sy-tabix.
CLEAR: field_desc, wa_field_desc.
wa_field_desc-fieldnum = 1.
wa_field_desc-display = 'X'.
APPEND wa_field_desc TO field_desc.
l_nr = 0.
CALL FUNCTION 'RS_VALUES_BOX'
EXPORTING
left_upper_col = 5
left_upper_row = 5
pagesize = 10
title = 'Select document'(sdc)
IMPORTING
linenumber = l_nr
TABLES
field_desc = field_desc
value_tab = documents
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0 AND l_nr NE 0.
READ TABLE documents INDEX l_nr INTO descr.
IF sy-subrc EQ 0.
CLEAR: wa_doc_signature, wa_doc_components, wa_doc_uris.
CLEAR: doc_signature, doc_components, doc_uris.
wa_doc_signature-prop_name = 'DESCRIPTION'.
wa_doc_signature-prop_value = descr-document_id.
APPEND wa_doc_signature TO doc_signature.
CALL METHOD bds_instance->get_info
EXPORTING classname = doc_classname
classtype = doc_classtype
object_key = doc_object_key
CHANGING components = doc_components
signature = doc_signature
EXCEPTIONS nothing_found = 1
error_kpro = 2
internal_error = 3
parameter_error = 4
not_authorized = 5
not_allowed = 6.
IF sy-subrc NE 0 AND sy-subrc NE 1.
MESSAGE e016.
ENDIF.
IF sy-subrc = 1.
MESSAGE e017.
ENDIF.
CALL METHOD bds_instance->get_with_url
EXPORTING classname = doc_classname
classtype = doc_classtype
object_key = doc_object_key
CHANGING uris = doc_uris
signature = doc_signature
EXCEPTIONS nothing_found = 1
error_kpro = 2
internal_error = 3
parameter_error = 4
not_authorized = 5
not_allowed = 6.
IF sy-subrc NE 0 AND sy-subrc NE 1.
MESSAGE e016.
ENDIF.
IF sy-subrc = 1.
MESSAGE e017.
ENDIF.
READ TABLE doc_components INTO wa_doc_components INDEX 1.
READ TABLE doc_uris INTO wa_doc_uris INDEX 1.
doc_mimetype = wa_doc_components-mimetype.
doc_url = wa_doc_uris-uri.
CASE doc_mimetype.
WHEN 'application/x-rtf' OR 'text/rtf'.
document_format = soi_docformat_rtf.
WHEN 'application/x-oleobject'.
document_format = soi_docformat_compound.
WHEN 'text/plain'.
document_format = soi_docformat_text.
WHEN OTHERS.
document_format = soi_docformat_native.
ENDCASE.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD on_close_document.
FOR EVENT on_close_document OF c_oi_ole_container_control
IMPORTING document_proxy has_changed.
DATA: answer, do_save.
IF has_changed EQ 1.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Office Integration Demo'(oid)
text_question = 'Save Document?'(sav)
display_cancel_button = ' '
IMPORTING
answer = answer.
IF answer EQ '1'.
do_save = 'X'.
ELSE.
do_save = ' '.
ENDIF.
CALL METHOD me->close_document
EXPORTING do_save = do_save.
CALL METHOD c_oi_errors=>show_message
EXPORTING type = 'E'.
ENDIF.
ENDMETHOD.
METHOD on_custom_event.
FOR EVENT on_custom_event OF i_oi_document_proxy
IMPORTING document_proxy event_name param_count
param1 param2 param3.
IF event_name EQ 'ON_SERIES_CHANGE'.
CALL METHOD table_coll->get_table
EXPORTING table_name = 'SALES_IN'
IMPORTING retcode = retcode
CHANGING data_table = test_table.
CALL METHOD c_oi_errors=>show_message
EXPORTING type = 'E'.
CLEAR wa_test_table.
READ TABLE test_table INTO wa_test_table INDEX 1.
usa_sales = wa_test_table-sales.
CLEAR wa_test_table.
READ TABLE test_table INTO wa_test_table INDEX 2.
europe_sales = wa_test_table-sales.
CLEAR wa_test_table.
READ TABLE test_table INTO wa_test_table INDEX 3.
japan_sales = wa_test_table-sales.
CLEAR wa_test_table.
READ TABLE test_table INTO wa_test_table INDEX 4.
asia_sales = wa_test_table-sales.
CLEAR wa_test_table.
READ TABLE test_table INTO wa_test_table INDEX 5.
america_sales = wa_test_table-sales.
CLEAR wa_test_table.
READ TABLE test_table INTO wa_test_table INDEX 6.
africa_sales = wa_test_table-sales.
CLEAR wa_test_table.
ENDIF.
CALL METHOD control->set_focus.
ENDMETHOD.
ENDCLASS.
FORM refresh_sales.
FORM refresh_sales.
DATA: BEGIN OF item_line,
region(60),
sales TYPE i,
date TYPE d,
time TYPE t,
weight TYPE f,
amount TYPE p DECIMALS 3,
id(10) TYPE n,
END OF item_line.
DATA: sales_table LIKE TABLE OF item_line.
DATA: wa_sales_table LIKE item_line.
DATA: fields_table TYPE TABLE OF rfc_fields.
DATA: wa_fields_table TYPE rfc_fields.
DATA: ind TYPE i.
CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'
TABLES
data = sales_table
fields = fields_table.
READ TABLE fields_table INDEX 1 INTO wa_fields_table.
wa_fields_table-fieldname = 'Region'."#EC NOTEXT
MODIFY fields_table FROM wa_fields_table INDEX 1.
CLEAR wa_fields_table.
READ TABLE fields_table INDEX 2 INTO wa_fields_table.
wa_fields_table-fieldname = 'Sales'. "#EC NOTEXT
MODIFY fields_table FROM wa_fields_table INDEX 2.
CLEAR: sales_table, wa_sales_table.
wa_sales_table-region = 'USA'(usa).
wa_sales_table-sales = usa_sales.
APPEND wa_sales_table TO sales_table.
CLEAR wa_sales_table.
wa_sales_table-region = 'Europe'(eur).
wa_sales_table-sales = europe_sales.
APPEND wa_sales_table TO sales_table.
CLEAR wa_sales_table.
wa_sales_table-region = 'Japan'(jap).
wa_sales_table-sales = japan_sales.
APPEND wa_sales_table TO sales_table.
CLEAR wa_sales_table.
wa_sales_table-region = 'Asia'(asi).
wa_sales_table-sales = asia_sales.
APPEND wa_sales_table TO sales_table.
CLEAR wa_sales_table.
wa_sales_table-region = 'America'(ame).
wa_sales_table-sales = america_sales.
APPEND wa_sales_table TO sales_table.
CLEAR wa_sales_table.
wa_sales_table-region = 'Africa'(afr).
wa_sales_table-sales = africa_sales.
APPEND wa_sales_table TO sales_table.
CLEAR wa_sales_table.
LOOP AT sales_table INTO wa_sales_table.
ind = sy-tabix.
wa_sales_table-date = sy-datum + ind.
wa_sales_table-time = sy-uzeit + ind.
wa_sales_table-weight = 100000 * ind.
wa_sales_table-amount = 11111 * ind.
wa_sales_table-id = ind.
MODIFY sales_table FROM wa_sales_table INDEX ind.
ENDLOOP.
CALL METHOD table_coll->add_table
EXPORTING table_name = 'SALES_OUT'
table_type = table_coll->table_type_output
IMPORTING retcode = retcode
CHANGING data_table = sales_table
fields_table = fields_table.
CALL METHOD link_server->add_table_item2
EXPORTING item_name = 'Sales' "#EC NOTEXT
item_title = 'Car Sales Figures'(sal)
IMPORTING retcode = retcode
CHANGING data_table = sales_table
fields_table = fields_table.
CALL METHOD link_server->add_string_item
EXPORTING item_name = 'ChartTitle'
item_title = 'Chart Title'(ti0)
item_value = 'Car Sales by Region'(ti1)
no_flush = 'X'
IMPORTING retcode = retcode.
CALL METHOD link_server->add_string_item
EXPORTING item_name = 'ColumnTitle1'
item_title = 'Column Title 1'(ti2)
item_value = 'Region'(ti3)
no_flush = 'X'
IMPORTING retcode = retcode.
CALL METHOD link_server->add_string_item
EXPORTING item_name = 'ColumnTitle2'
item_title = 'Column Title 2'(ti4)
item_value = 'Sold Cars'(ti5)
no_flush = ' '
IMPORTING retcode = retcode.
ENDFORM. -
SOFFICEINTEGRATION In Background
HI all,
I am implementing Office integration with templates similar to example SAPRDEMO_FORM_INTERFACE.
Everything works ok, but my problem is that I want it to run in background, activated by event CREATED of BOR DOCUMENT.
Event is raised but I have problem with following code because container is not created in backgorund.
CREATE OBJECT CONTAINER
EXPORTING CONTAINER_NAME = 'CONTAINER'.
CALL METHOD CONTROL->INIT_CONTROL
EXPORTING R3_APPLICATION_NAME =
text-BAS
INPLACE_ENABLED = inplace
INPLACE_SCROLL_DOCUMENTS = 'X'
PARENT = CONTAINER
REGISTER_ON_CLOSE_EVENT = 'X'
REGISTER_ON_CUSTOM_EVENT = 'X'
NO_FLUSH = 'X'.
CALL METHOD CONTROL->GET_DOCUMENT_PROXY
EXPORTING DOCUMENT_TYPE = DOCUMENT_TYPE
REGISTER_CONTAINER = 'X'
IMPORTING DOCUMENT_PROXY = DOCUMENT
Any idea about how to create control in batch mode?
Thanks!!
Regards.
Urtzi.I'll try to explain what I am trying to achieve,
As told before, I want to use the SOFFICEINTEGRATION to get some data from a Word document which has form fields. Like in the example report SAPRDEMO_FORM_INTERFACE where it uses the GET_DATA and SET_DATA methods of the I_OI_FORM interface.
When I run the function module in an online dialog, I get all the objects created without a problem.
But when the funcion module is triggered by the BOR Document CHANGED event,
WF_RAISE_EVENT = 'X' in the SCMG_SP_DOCUMENT element type, the function module runs in background by the WF-BATCH user and I can't get to create the control reference to later get the document proxy
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = control.
DATA ex_document TYPE REF TO i_oi_document_proxy
CALL METHOD control->get_document_proxy
EXPORTING
document_type = document_type
register_container = 'X'
IMPORTING
document_proxy = ex_document.
CALL METHOD ex_document->open_document_from_table " here I get an error too
IMPORTING
error = error " CALL_NOT_FLUSHED
retcode = lt_retcode.
I debug the function module adding and infinite loop and accessing from the SM50 Tcode, so that I can see the background process.
I could get the Word document form field data if there was a BADI in the SCASE when the user saves the document, but I think that there is not such a BADI so I have tried to use the BOR Document CHANGED event which triggers the background process.
Thanks in advance.
Urtzi. -
Error reading a Excel sheet in BDS
Hi Team,
I have uploaded an excel sheet in BDS by OAER. Now in my program I want to read the excel file. I am putting the code snippet.
DATA;
l_v_proxy TYPE REF TO i_oi_document_proxy,
l_v_control TYPE REF TO i_oi_container_control,
l_v_container TYPE REF TO cl_gui_custom_container.
CALL METHOD l_v_control->init_control
EXPORTING r3_application_name =
'BDS-DOI'
inplace_enabled = 'X'
inplace_scroll_documents = 'X'
parent = l_v_container
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING retcode = v_retcode.
CALL METHOD c_oi_errors=>raise_message
EXPORTING
type = 'E'.
CALL METHOD l_v_control->get_document_proxy
EXPORTING
document_type = 'Excel.Sheet.8'
document_format = l_v_doc_format "OLE
IMPORTING
document_proxy = l_v_proxy
retcode = v_retcode.
IF v_retcode NE c_oi_errors=>ret_ok.
EXIT.
ENDIF.
CLEAR l_v_error.
CALL METHOD l_v_proxy->has_spreadsheet_interface
IMPORTING
error = l_v_error
is_available = l_v_has
retcode = v_retcode.
IF v_retcode NE 'OK'.
RETURN.
ENDIF.
But in has_spreadsheet_interface it returns error return code like 'DOCUMENT_NOT_OPEN'.
Can you please help me that what would be the possible causes of the error.
Thanks,
MainakHi,
Its clear now.
Merci
MFH -
Need help with Desktop Office Integration (DOI)
Hi all,
i need help to read an Excelsheet into an int. table.
Its the first time, that i use the SAP DOI. I copy different coding into my Report to get connection to an existing Excelsheet.
Here is my Coding:
* first get the SAP DOI i_oi_container_control interface
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING control = gr_control
error = gr_errors.
APPEND gr_errors.
* create a control container as defined in dynpro 100
CREATE OBJECT gr_container
EXPORTING container_name = 'CONTAINER'.
* initialize the SAP DOI Container, tell it to run in the container
* specified above and tell it to run Excel in-place
CALL METHOD gr_control->init_control
EXPORTING
r3_application_name = 'Data'
inplace_enabled = ' '
inplace_scroll_documents = 'X'
parent = gr_container
register_on_close_event = 'X'
register_on_custom_event = 'X'
no_flush = 'X'
IMPORTING
error = gr_errors.
* save error object in collection
APPEND gr_errors.
* ask the SAP DOI container for a i_oi_document_proxy for Excel
CALL METHOD gr_control->get_document_proxy
EXPORTING document_type = 'Excel.Sheet'
* EXPORTING document_type = 'Word.Document'
no_flush = 'X'
* REGISTER_CONTAINER = 'X'
IMPORTING document_proxy = gr_document
error = gr_errors.
APPEND gr_errors.
Then i open the Document from lokal PC.
CALL METHOD gr_document->open_document
EXPORTING
* document_title = ld_filenc
document_url = ld_verzc
* NO_FLUSH = ' '
* OPEN_INPLACE = ' '
* open_readonly = ' '
* PROTECT_DOCUMENT = ' '
* STARTUP_MACRO = ''
* USER_INFO =
* ONSAVE_MACRO =
IMPORTING
error = gr_errors
* RETCODE =
APPEND gr_errors.
Now i start the spreadsheet interface:
*...check if our document proxy can serve a spreadsheet interface data:
DATA: pd_has TYPE i.
CALL METHOD gr_document->has_spreadsheet_interface
EXPORTING no_flush = 'X'
IMPORTING is_available = pd_has
error = gr_errors.
APPEND gr_errors.
CALL METHOD gr_document->get_spreadsheet_interface
EXPORTING no_flush = ' '
IMPORTING
sheet_interface = gr_spreadsheet
error = gr_errors.
APPEND gr_errors.
* now loop through error collection because
* Get_spreadsheet_interface flushed and synchronized
* the automation queue !
LOOP AT gr_errors.
CALL METHOD gr_errors->raise_message
EXPORTING type = 'I'
EXCEPTIONS message_raised = 1
OTHERS = 2.
IF sy-subrc = 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
pd_kz_fehler = 'X'.
EXIT.
ENDIF.
ENDLOOP.
FREE gr_errors.
Ok, now i can open a Excelsheet, and i can mark a range in the sheet
rows is a constant.
CALL METHOD gr_spreadsheet->set_selection
EXPORTING
left = 1
top = 2
rows = rows
columns = 18
* NO_FLUSH = ' '
* UPDATING = -1
IMPORTING
error = gr_errors
* RETCODE =
my first problem: Excel is really open, and the user can see the sheet. I dont want, that excel is visible...is there a way to start excel in no_visible mode?
second problem: The sheet have makro aktiv...at start from excel, there is a popup, which ask 'makros activate' oder not activate... i dont want this popup... is there a way, to say it from abap, that makros always active?
third problem: i see, that the content Table have this components:
TYPES: BEGIN OF SOI_GENERIC_ITEM,
ROW(4) TYPE C,
COLUMN(4) TYPE C,
VALUE(256) TYPE C,
END OF SOI_GENERIC_ITEM.
But my excelsheet have more then 10000 lines....
forth (and biggest) problem: i need the selected data into an int. tabelle. The table have the components:
ROW
COL
VALUE
i dont know, how can i do this...
please help me
Sorry for my bad english.
Greetings
MarkusHi,
May be this link is useful
/people/thomas.jung3/blog/2005/05/11/using-classic-activex-controls-in-the-abap-control-framework
Also Check out report SAPRDEMOEXCELINTEGRATION2.
check the links
http://www.esnips.com/doc/741a848e-f49a-4436-bec4-e21950f6c94c/desktop-office-integration.pdf
http://www.esnips.com/doc/2080a9ec-64f9-49c4-bd03-d9f56bc2437c/MSWord--Excel-with-ABAP.pdf
Regards,
Raj. -
Running Excel macros from ABAP
Hello everyone,
I am trying to execute an Excel macro from an ABAP program. We are currently on a 46C system. While doing some research on help.sap.com I came across the method execute_macro in class i_oi_document_proxy. Ive never used methods in ABAP before and Im not really sure what Im doing. Has anyone got this to work? When I try to run the program it dumps with error OBJECTS_OBJREF_NOT_ASSIGNED.
Thanks,
Becky
Here is the program:
REPORT ztest_program.
INCLUDE ole2incl.
DATA gs_excel TYPE ole2_object .
DATA gs_wbooks TYPE ole2_object .
DATA gs_wbook TYPE ole2_object .
DATA gs_application TYPE ole2_object .
DATA: h_sheet TYPE ole2_object.
DATA: document TYPE REF TO i_oi_document_proxy.
*Name of the macro in Excel
DATA: macro_string(50) TYPE c
VALUE 'FB03process.FromTheBeginning',
no_flush TYPE c,
param_count TYPE i VALUE 0,
script_name TYPE c VALUE 'X',
error TYPE REF TO i_oi_error
OCCURS 0 WITH HEADER LINE,
retcode TYPE soi_ret_string,
error_string(50) TYPE c,
retvalue(30) TYPE c.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text-007
EXCEPTIONS
OTHERS = 1.
CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF gs_excel 'Visible' = 1 .
GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
GET PROPERTY OF gs_wbooks 'Application' = gs_application .
*--Opening the existing document
CALL METHOD OF gs_wbooks 'Open' = gs_wbook
EXPORTING #1 = 'D:\temp\FB03process.xls' .
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
text = text-009
EXCEPTIONS
OTHERS = 1.
GET PROPERTY OF gs_excel 'ACTIVESHEET' = h_sheet.
CALL METHOD document->execute_macro
EXPORTING macro_string = macro_string
param_count = param_count
script_name = script_name
no_flush = no_flush
IMPORTING error = error
retcode = retcode
CHANGING error_string = error_string
retvalue = retvalue.
disconnect from Excel
FREE OBJECT gs_excel.
PERFORM err_hdl.
FORM err_hdl.
IF sy-subrc <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
STOP.
ENDIF.
ENDFORM. " ERR_HDLHi,
Please correct me if I am wrong but it seems that you have not fetched a handle to the document object before issuing the statement CALL METHOD document->execute_macro. Hence the error OBJECTS_OBJREF_NOT_ASSIGNED is being dislayed. If you want to use SAP Desktop Office Integration using ABAP Objects, take a look at this article at http://www.intelligenterp.com/feature/archive/ or http://www.sapinfo.net/public/en/index.php4/article/comvArticle-193333c63b4bd807d2/en/articleStatistic
Hope this helps.
Regards
Message was edited by: Shehryar Khan -
Modify excel sheet from BDN/GOS and add to sales order
Hello,
Iu2019ve import a excel-template in OAOR (BDN) and now i want to modify the excel-sheet with my own data.
After then I want to put it to a Sales Order (BUS2032).
The excel sheet must indicated in the attachment list of VA02 (GOS).
Which method I must use to copy a existing excel sheet from BDN?
How can i modify my excel sheet from BDS and add to a existing sales order?
Can I set the document write protected?
Can anyone help me or have any examplesu2026
Thanks in advance
Edited by: Thomas Druetschel on Dec 2, 2008 3:20 PMHello,
now i can get a template from BDN and modify the excel sheet. But i want to modify the excel spreadsheet in BACKGROUND ==> have anybody a idea?
And i need the correct method to save the modified document to BDS...
Thanks
i use the following code:
TYPE-POOLS: sbdst.
DATA go_control TYPE REF TO i_oi_container_control.
DATA go_docking_container TYPE REF TO cl_gui_docking_container.
DATA go_document_proxy TYPE REF TO i_oi_document_proxy.
DATA go_excel_iface TYPE REF TO i_oi_spreadsheet.
DATA go_error TYPE REF TO i_oi_error.
DATA gc_exceltype TYPE soi_document_type VALUE soi_doctype_excel_sheet.
DATA gv_retcode TYPE soi_ret_string.
DATA gv_sheetname TYPE soi_string.
DATA gv_inplace TYPE c.
DATA: gv_value TYPE string.
START-OF-SELECTION.
PERFORM open_excel_doc_from_bds
USING
'BUS2032'
'BO'
'0010163117'
PERFORM fill_cell
USING
'TEST123'
'1'
'2'.
==>> Now i want to SAVE the modified Excel Spreadshet to another Sales Order...
*& Form init_excel_proxy
text
-->UV_INPLACE text
FORM init_excel_proxy USING uv_inplace TYPE c.
DATA lv_repid TYPE sy-repid.
DATA lv_dynnr TYPE sy-dynnr.
DATA lv_str TYPE soi_string.
lv_repid = sy-repid.
lv_dynnr = sy-dynnr.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = go_control
error = go_error.
CREATE OBJECT go_docking_container
EXPORTING
repid = lv_repid
dynnr = lv_dynnr
side = cl_gui_docking_container=>dock_at_bottom
extension = 0.
I don´t want to modify the document in the front*
CALL METHOD go_control->init_control
EXPORTING
r3_application_name = ' '
inplace_enabled = uv_inplace
parent = go_docking_container
IMPORTING
error = go_error.
CALL METHOD go_control->get_document_proxy
EXPORTING
document_type = gc_exceltype
IMPORTING
document_proxy = go_document_proxy.
ENDFORM. " init_excel_iface
*& Form open_excel_doc_from_bds
text
-->UV_CLASSNAME text
-->UV_CLASSTYPE text
-->UV_OBJECTKEY text
-->UV_INPLACE text
FORM open_excel_doc_from_bds USING uv_classname TYPE sbdst_classname
uv_classtype TYPE sbdst_classtype
uv_objectkey TYPE sbdst_object_key
uv_inplace TYPE c.
DATA lt_doc_uris TYPE sbdst_uri.
DATA ls_doc_uri LIKE LINE OF lt_doc_uris.
DATA lt_doc_signature TYPE sbdst_signature.
DATA lv_doc_url TYPE bapiuri-uri.
DATA lv_repid TYPE sy-repid.
DATA lv_dynnr TYPE sy-dynnr.
IF go_document_proxy IS INITIAL.
PERFORM init_excel_proxy USING uv_inplace.
ENDIF.
CHECK NOT go_document_proxy IS INITIAL.
CALL METHOD cl_bds_document_set=>get_with_url
EXPORTING
classname = uv_classname
classtype = uv_classtype
object_key = uv_objectkey
CHANGING
uris = lt_doc_uris[]
signature = lt_doc_signature[]
EXCEPTIONS
nothing_found = 1
error_kpro = 2
internal_error = 3
parameter_error = 4
not_authorized = 5
not_allowed = 6.
IF sy-subrc NE 0 .
MESSAGE 'cl_bds_document_set=>get_with_url error' TYPE 'I'.
EXIT.
ENDIF.
READ TABLE lt_doc_uris INTO ls_doc_uri INDEX 1.
lv_doc_url = ls_doc_uri-uri.
CALL METHOD go_document_proxy->open_document
EXPORTING
document_url = lv_doc_url
open_inplace = uv_inplace
open_readonly = ''
IMPORTING
error = go_error.
IF NOT go_excel_iface IS INITIAL.
FREE go_excel_iface.
ENDIF.
CALL METHOD go_document_proxy->get_spreadsheet_interface
EXPORTING
no_flush = 'X'
IMPORTING
sheet_interface = go_excel_iface
error = go_error.
ENDFORM. "open_excel_doc_from_bds
*& Form fill_cell
text
-->UV_VALUE text
-->UV_COLUMN text
-->UV_ROW text
FORM fill_cell USING uv_value TYPE string
uv_column TYPE i
uv_row TYPE i.
CHECK NOT go_document_proxy IS INITIAL.
CHECK NOT go_excel_iface IS INITIAL.
DATA: lt_ranges TYPE soi_range_list,
lt_contents TYPE soi_generic_table,
ls_contents LIKE LINE OF lt_contents[],
lt_rangesdef TYPE soi_dimension_table,
ls_rangesdef LIKE LINE OF lt_rangesdef.
ls_rangesdef-row = uv_row.
ls_rangesdef-column = uv_column.
ls_rangesdef-rows = 1.
ls_rangesdef-columns = 1.
APPEND ls_rangesdef TO lt_rangesdef.
ls_contents-row = 1.
ls_contents-column = 1.
ls_contents-value = uv_value.
APPEND ls_contents TO lt_contents.
CALL METHOD go_excel_iface->set_ranges_data
EXPORTING
ranges = lt_ranges[]
contents = lt_contents[]
rangesdef = lt_rangesdef[]
no_flush = 'X'
IMPORTING
error = go_error.
ENDFORM. "fill_cell
*& Form get_cell
text
-->UV_COLUMN text
-->UV_ROW text
-->CV_VALUE text
FORM get_cell USING uv_column TYPE i
uv_row TYPE i
CHANGING cv_value.
DATA: lt_ranges TYPE soi_range_list,
lt_contents TYPE soi_generic_table,
ls_contents LIKE LINE OF lt_contents[],
lt_rangesdef TYPE soi_dimension_table,
ls_rangesdef LIKE LINE OF lt_rangesdef.
ls_rangesdef-row = uv_row.
ls_rangesdef-column = uv_column .
ls_rangesdef-rows = 1.
ls_rangesdef-columns = 1.
APPEND ls_rangesdef TO lt_rangesdef.
CALL METHOD go_excel_iface->get_ranges_data
EXPORTING
rangesdef = lt_rangesdef[]
IMPORTING
contents = lt_contents[]
error = go_error
CHANGING
ranges = lt_ranges[].
cv_value = space.
READ TABLE lt_contents INTO ls_contents INDEX 1.
IF sy-subrc = 0.
cv_value = ls_contents-value.
ENDIF.
ENDFORM. "get_cell
*& Form insert_table
text
-->COLUMN text
-->ROW text
-->CT_DATA text
-->ANY text
FORM insert_table USING column TYPE i
row TYPE i
CHANGING ct_data TYPE table any.
CHECK NOT go_document_proxy IS INITIAL.
CHECK NOT go_excel_iface IS INITIAL.
CALL METHOD go_excel_iface->insert_range_dim
EXPORTING
name = 'Table'
top = row
left = column
rows = 1
columns = 1
no_flush = 'X'
IMPORTING
error = go_error.
DATA: lt_fields_table TYPE soi_fields_table.
CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'
TABLES
data = ct_data[]
fields = lt_fields_table.
go_excel_iface->insert_one_table(
EXPORTING
data_table = ct_data[]
fields_table = lt_fields_table[]
rangename = 'Table'
no_flush = 'X'
wholetable = 'X'
IMPORTING
error = go_error
ENDFORM. "insert_table= -
Integration of SAP with MS Office & Adobe Acrobat Reader using OLE
Hi Friends,
I have to integrate MS Office 2003 and ADOBE Acrobat reader with SAP very much like that demonstrated in SAPRDEMODOCUMENTCONTAINER program given in the control examples by SAP. But the problem is, the code I am developing and even in the one given by SAP has some problems in them. They are:
(1) When a MS Word or any application is opened, many of its attributes are
disabled like CTRL+ N for opening new document and CTRL+ O for opening
an existing file and many others.
(2) When I try to open an existing file using the recently used list, it is opening in
a new window but my requirement is to open it in the same window in which
the application frame is displayed over SAP screen.
(3) I am following the same procedure that is used in the above said example and
unable to understand the way methods of the inner most interface are implem-
ented like method CONTAINER_CONTROL->CREATE_DOCUMENT that is
called from within I_OI_DOCUMENT_PROXY~CREATE_DOCUMENT method. I
am clueless how it is working.
Please guide me how to solve the problem along with some good reference material that you can suggest me to study.
Thanks & Regards
Aditya P. SrivastavaHi Adiya,
You need to pass the parameter 'open in place' to word file in same window.
CALL METHOD DOCUMENT->OPEN_DOCUMENT
EXPORTING OPEN_INPLACE = 'X'
Regards,
karthik. -
Convert Smartform in WORD Document
Hi Gurus
How can i convert a smartform Output in a word document ??? and download into PC..
Regards
GregoryThere is no standard possibility to do Word outputs in SAP.
Anyway you can develop connection of Mail-merge technology of Microsoft and SAP ABAP class i_oi_document_proxy.
http://help.sap.com/saphelp_sm32/helpdata/EN/e9/0be980408e11d1893b0000e8323c4f/content.htm
with interface get_mail_merge_interface:
http://help.sap.com/saphelp_sm32/helpdata/en/6e/8fc2e3dd0d11d2bdba080009b4534c/content.htm
Simple example I found here:
http://www.sap2word.de/abap.html
Hope, it helps
Edited by: Dimy IT dev on Sep 7, 2009 2:58 PM -
Produce smartform output in word doc
I want to get my smartform output in a word doc instead of PDF. I've gone thorough the previous threads for the same thing but couldn't find any exact solution. can anyone tell me how this is to be done?
<promise removed by moderator>
Moderator message: please do more research before asking.
Edited by: Thomas Zloch on Apr 13, 2011 3:26 PMHi yogesh.,
There is no standard possibility to do Word outputs in SAP.
you can do manually..
After the print preview, Select the menu Goto->List Display.
Now select the menu System->List->Save->Local File.
Now you can select the radio buttion Rich Text Format.
Now you save the document as a .doc file (say test.doc)
That is it!!!!!
Anyway you can develop connection of Mail-merge technology of Microsoft and SAP ABAP class i_oi_document_proxy.
http://help.sap.com/saphelp_sm32/helpdata/EN/e9/0be980408e11d1893b0000e8323c4f/content.htm
with interface get_mail_merge_interface:
http://help.sap.com/saphelp_sm32/helpdata/en/6e/8fc2e3dd0d11d2bdba080009b4534c/content.htm
Refer this use ful link for word output
http://www.sap2word.de/abap.html
hope this helps.,
Thanks & Regards
Kiran
Moderator message: copy/pasted from several sources, please do not repeat if you want to keep your user ID!
http://www.google.com/search?q=%22Aftertheprintpreview%2CSelectthemenu+Goto%22&hl=en&source=hp&lr=&aq=f&aqi=&aql=&oq=
http://www.google.com/search?hl=en&source=hp&q=%22AnywayyoucandevelopconnectionofMail-merge%22&meta=lr%3D&aq=f&aqi=&aql=&oq=
Edited by: Thomas Zloch on Apr 13, 2011 3:35 PM
Maybe you are looking for
-
Is there a way to change the font in iMovie
I had a particular style I created for intro to a movie and I was trying to recreate it with the new update but can't seem to find the option. And what I do find isn't highlighted to be accessible. Am I missing/ overlooking something?
-
Can I use an Iphone5 in HongKong?
I'm using Iphone5. but i have planned to go HongKong tommorow. can i use Iphone5 in HongKong without any unlock? or Do i need anything??
-
How to recover log , sms , deleted contacts from n...
hi i'am mohamed from egypt i want to recover log from 10/7/2010 to 20/7/2010 recover the sms in this date too or deleted contacts from this date pleas help me soory my english dosent good
-
I am creating a training course in Captivate. I need to include a tracking and reporting of student results and be able to have them print a certificate of completion. Can anyone help me with these items?
-
Transport takes a long time with 'file already in use' message in tp log
Hello, We are implementing SAP ECC 6.0 on IBM iSeries, i5/OS V5R4. I am encountering the following problem when conducting an import on TQA system from a transport request done from DEV : The import takes a very long time without being implemented, w