report zsapdoi_001.
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.
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'
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->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
댓글 2
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
311 | Sub DOI_EXCEL_MACRO() | sapjoy | 2008.12.26 | 3312 |
310 | Sub DOI_MACRO() | sapjoy | 2008.12.26 | 2845 |
309 | DOI_002.doc [3] | sapjoy | 2008.12.26 | 2234 |
308 | doi_create [1] | sapjoy | 2008.12.26 | 3049 |
» | REPORT zsapdoi_001. [2] | sapjoy | 2008.12.20 | 3137 |
306 | REPORT Z07_026 [3] | sapjoy | 2006.12.09 | 2632 |
305 | Include ZXQEVU10 | sapjoy | 2008.12.17 | 2158 |
304 | Include ZXCSAU05 | sapjoy | 2008.12.17 | 2166 |
303 | FIELD_EXIT_STCD2_0 | sapjoy | 2008.12.16 | 2797 |
302 | FIELD_EXIT_GSBER_I | sapjoy | 2008.12.16 | 2625 |
301 | Include ZXCSAU05 | sapjoy | 2008.12.16 | 2587 |
300 | INCLUDE ZXF04U01 | sapjoy | 2008.12.16 | 3698 |
299 | INLUCDE ZXAISU02 | sapjoy | 2008.12.16 | 2962 |
298 | REPORT z_userexit_01 | sapjoy | 2008.12.15 | 2656 |
297 | REPORT ZSMARTFORMS_01. | sapjoy | 2008.11.26 | 2677 |
296 | report zunicode_035. | sapjoy | 2008.11.22 | 2541 |
295 | report zunicode_034. [1] | sapjoy | 2008.11.22 | 2737 |
294 | report zunicode_032. | sapjoy | 2008.11.22 | 2634 |
293 | report zunicode_031. | sapjoy | 2008.11.22 | 2684 |
292 | report zunicode_030. | sapjoy | 2008.11.22 | 2416 |
"데이타 제공자 오브젝트에서 데이타 설정중 오류발생"
교재내용대로 돌렸는데 이런 에러가 생기네요..
어떤 문제인가요?