report zsapdoi_002.
type-pools soi.
class: c_oi_errors definition load.
data : control type ref to i_oi_container_control.
data : document type ref to i_oi_document_proxy.
data : errors type ref to i_oi_error occurs 0 with header line.
data : retcode type soi_ret_string.
data : spreadsheet type ref to i_oi_spreadsheet.
data : g_initial type c.
tables: sflight.
data: ok_code like sy-ucomm,
save_ok like ok_code.
data: g_col type i,
g_row type i.
select-options: s_carrid for sflight-carrid
no intervals no-extension,
s_connid for sflight-connid
no intervals no-extension.
data: gt_sflight like sflight occurs 0 .
start-of-selection.
select *
from sflight
into corresponding fields of table gt_sflight
where carrid in s_carrid
and connid in s_connid.
describe table gt_sflight lines g_row.
data : fields_table type table of rfc_fields.
call function 'DP_GET_FIELDS_FROM_TABLE'
exporting
tabname = 'SFLIGHT'
tables
data = gt_sflight
fields = fields_table.
describe table fields_table lines g_col.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.
set pf-status 'STATUS01'.
set titlebar 'GUITEXT01'.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module DOI_CREATE OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module doi_create output.
data: item_url(256).
data: bds_instance type ref to cl_bds_document_set.
data: doc_signature type sbdst_signature,
wa_doc_signature like line of doc_signature,
doc_components type sbdst_components,
doc_uris type sbdst_uri,
wa_doc_uris like line of doc_uris.
data: doc_classname type sbdst_classname value 'SOFFICEINTEGRATION',
doc_classtype type sbdst_classtype value 'OT',
doc_object_key type sbdst_object_key value 'TEST'.
wa_doc_signature-prop_name = 'DESCRIPTION'.
wa_doc_signature-prop_value = 'SAPDOI_001'.
append wa_doc_signature to doc_signature.
create object bds_instance.
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.
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.
free bds_instance.
read table doc_uris into wa_doc_uris index 1.
item_url = wa_doc_uris-uri.
if g_initial ne 'X'.
call method c_oi_container_control_creator=>get_container_control
importing
control = control
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
data: container type ref to cl_gui_custom_container.
create object container
exporting
container_name = 'CONTAINER'.
call method control->init_control
exporting
r3_application_name = 'SAP DOI Test'
inplace_enabled = 'X'
parent = container
importing
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
call method control->get_document_proxy
exporting
document_type = 'Excel.Sheet'
document_format = 'OLE'
importing
document_proxy = document
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
call method document->open_document
exporting
* document_url = 'FILE://C:DOI_001.xls' "기존 로컬PC URL (주석처리)
document_url = item_url "bds 문서의 url
open_inplace = 'X'
open_readonly = ' '
importing
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
data: has type i.
call method document->has_spreadsheet_interface
importing
is_available = has.
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
if not has is initial.
call method document->get_spreadsheet_interface
importing
sheet_interface = spreadsheet.
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
endif.
g_initial = 'X'.
endif.
call method spreadsheet->insert_range_dim
exporting
name = 'sflight'
top = 1
left = 1
rows = g_row
columns = g_col
importing
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
call method spreadsheet->set_selection
exporting
left = 1
top = 1
rows = g_row
columns = g_col
importing
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
call method spreadsheet->set_color
exporting
rangename = 'sflight'
back = '10'
front = '2'
no_flush = 'X'
importing
error = errors.
call method spreadsheet->insert_one_table
exporting
rangename = 'sflight'
data_table = gt_sflight
fields_table = fields_table
wholetable = 'X'
importing
retcode = retcode.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
endmodule. " DOI_CREATE OUTPUT
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module exit input.
case ok_code.
when 'EXIT'.
leave to screen 0.
if not document is initial.
call method document->close_document.
free document.
endif.
if not control is initial.
call method control->destroy_control.
free control.
endif.
endcase.
endmodule. " EXIT INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
save_ok = ok_code.
clear: ok_code.
case save_ok.
when 'SAVE'.
perform save_excel_to_sap.
when 'INSERT'.
g_row = g_row + 1.
when 'DELETE'.
g_row = g_row - 1.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form SAVE_EXCEL_2_SAP
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form save_excel_to_sap .
data : lt_sflight like sflight occurs 0 with header line.
data : ranges type soi_range_list,
range_item type soi_range_item.
data : contents type soi_generic_table,
generic_item type soi_generic_item.
refresh: contents, ranges.
range_item-name = 'sflight'.
append range_item to ranges.
data : table type soi_cell_table.
call method spreadsheet->get_ranges_data
exporting
all = ' '
no_flush = 'X'
importing
contents = contents
changing
ranges = ranges.
call method c_oi_errors=>raise_message
exporting
type = 'E'.
loop at contents into generic_item.
if generic_item-column is initial.
continue.
endif.
case generic_item-column .
when '1'.
lt_sflight-mandt = generic_item-value.
when '2'.
lt_sflight-carrid = generic_item-value.
when '3'.
lt_sflight-connid = generic_item-value.
when '4'.
lt_sflight-fldate = generic_item-value.
when '5'.
lt_sflight-price = generic_item-value.
when '6'.
lt_sflight-currency = generic_item-value.
when '7'.
lt_sflight-planetype = generic_item-value.
when '8'.
lt_sflight-seatsmax = generic_item-value.
when '9'.
lt_sflight-seatsocc = generic_item-value.
when '10'.
lt_sflight-paymentsum = generic_item-value.
when '11'.
lt_sflight-seatsmax_b = generic_item-value.
when '12'.
lt_sflight-seatsocc_b = generic_item-value.
when '13'.
lt_sflight-seatsmax_f = generic_item-value.
when '14'.
lt_sflight-seatsocc_f = generic_item-value.
endcase.
at end of row .
append lt_sflight. clear lt_sflight.
endat.
endloop.
refresh contents.
endform. " SAVE_EXCEL_TO_SAP
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
331 | REPORT zsapgos_002. | sapjoy | 2009.02.12 | 2458 |
330 | REPORT ZSAPGOS_001. | sapjoy | 2009.02.12 | 2477 |
329 | FUNCTION Z_BAPIALE_SEND. | sapjoy | 2009.02.10 | 2420 |
328 | REPORT zale_001 . | sapjoy | 2009.02.10 | 2471 |
327 | REPORT ZBAPI_002. | sapjoy | 2009.02.10 | 2590 |
326 | FUNCTION Z_BAPI_REQ_FUNCLOC. | sapjoy | 2009.02.05 | 2421 |
325 | REPORT ZBAPI_ALE | sapjoy | 2009.02.05 | 2334 |
324 | zbapi_java | sapjoy | 2009.02.02 | 2699 |
323 | FUNCTION Z_BAPI_ASSETNAME_SEARCH | sapjoy | 2009.01.31 | 2898 |
322 | REPORT z18_003 | sapjoy | 2007.03.06 | 3281 |
321 | REPORT ZSMARTFORMS_07. | sapjoy | 2009.01.22 | 2389 |
320 | REPORT zBADI_FIND | sapjoy | 2009.01.16 | 2732 |
319 | REPORT ZBADI_003. | sapjoy | 2009.01.15 | 2403 |
318 | REPORT zbadi_002. | sapjoy | 2009.01.10 | 2545 |
317 | REPORT zbadi_001 | sapjoy | 2009.01.07 | 2527 |
316 | doi_excel.xls | sapjoy | 2008.12.26 | 2177 |
315 | report zsapdoi_005. | sapjoy | 2008.12.26 | 2978 |
314 | report zsapdoi_004. | sapjoy | 2008.12.26 | 2932 |
313 | report zsapdoi_003. | sapjoy | 2008.12.26 | 2570 |
» | report zsapdoi_002. | sapjoy | 2008.12.26 | 4405 |