12-02-2008 11:13 AM
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 PM
12-02-2008 2:39 PM
Welcome to SDN.
please check class CL_BDS_DOCUMENT_SET and its well explained documentation,
and also for uploading documents to GOS you can probably check fm
SO_OBJECT_INSERT
BINARY_RELATION_CREATE_COMMIT.
and also please go thru class CL_GOS*
PS : I don't think you can modify the file after getting from BDS. due to you will get the file in binary format.
a®
12-02-2008 2:39 PM
Welcome to SDN.
please check class CL_BDS_DOCUMENT_SET and its well explained documentation,
and also for uploading documents to GOS you can probably check fm
SO_OBJECT_INSERT
BINARY_RELATION_CREATE_COMMIT.
and also please go thru class CL_GOS*
PS : I don't think you can modify the file after getting from BDS. due to you will get the file in binary format.
a®
12-02-2008 2:47 PM
If I understood your quesiton correctly, you wnat to attach and excel file to GOS through Business Document, than:
Run the OAOR with the
Class Name: BUS2032
Class Type BO
There will be one more popup asking to enter the key.
Here enter your sales order number and enter.
In the Lower Left tabs, select Create tab
Expand the "Standard Doc types" Node
Double click on the Table tamplate
It will File Select dialog
Select your file and it will attach that file.
As soon as it attached the file, it will be avaliable to in that perticular GOS toolbar option under the attchment list.
Regards,
Naimesh Patel
12-02-2008 3:15 PM
Hi,
i know OAOR, but i want to copy an existing document from OAOR in BACKGROUND not in dialog
and modify the document.
With wich method can i modify the excel sheet from BDN and add to a sales order.
Thanks
12-09-2008 6:18 AM
Hello,
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=