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
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
670 | <b>easy abap 소스 전체 파일 입니다. [188] | sapjoy | 2008.05.01 | 10126 |
669 | REPORT z18_033 [47] | sapjoy | 2008.10.13 | 9031 |
668 | REPORT Z15_003 [49] | sapjoy | 2008.04.15 | 7498 |
667 | report zunicode_027. [4] | sapjoy | 2008.11.21 | 6262 |
666 | REPORT Z20_01. | sapjoy | 2012.08.01 | 5062 |
665 | REPORT z18_03. | sapjoy | 2012.08.01 | 4558 |
664 | Z01_012 [9] | sapjoy | 2006.12.02 | 4546 |
663 | Z_EXPORT_GRAPHIC_FROM_SE78 [1] | sapjoy | 2011.03.28 | 4443 |
» | report zsapdoi_002. | sapjoy | 2008.12.26 | 4405 |
661 | REPORT zsmw0010 | sapjoy | 2010.10.11 | 4313 |
660 | REPORT z18_028 | sapjoy | 2007.04.09 | 4278 |
659 | report zsalv_045 . | sapjoy | 2010.08.20 | 4262 |
658 | Dynamic Table Maintenance [1] | sapjoy | 2006.12.04 | 4094 |
657 | REPORT ZTABLE_UTIL | sapjoy | 2010.10.09 | 4010 |
656 | REPORT Z19_02. | sapjoy | 2012.08.01 | 3926 |
655 | report zsaptip_009 [1] | sapjoy | 2010.12.10 | 3852 |
654 | INCLUDE ZXF04U01 | sapjoy | 2008.12.15 | 3695 |
653 | REPORT ZTEST_ABAPTPDF | sapjoy | 2010.10.09 | 3691 |
652 | REPORT Z_3DGRAPH. [1] | sapjoy | 2010.10.17 | 3659 |
651 | REPORT zfalv_011. | sapjoy | 2011.02.16 | 3624 |