ABAP 销售范围
*&---------------------------------------------------------------------*
*& Report ZSDR008
*&
*&---------------------------------------------------------------------*
REPORT zsdr008.
TABLES: tvbvk ,cskt ,ztsd007.
*自建表ztsd007:销售办公室-销售组-成本中心
TYPES:ty_xs LIKE v_tvbur.
DATA:gt_xs LIKE TABLE OF v_tvbur.
DATA:wa_xs TYPE v_tvbur.
DATA:edit(1) VALUE ''."ALV是否处于可编辑状态
FIELD-SYMBOLS: <f1>, <f2>, <f3>.
TYPES:BEGIN OF ty_zz,
vkbur TYPE tvkbt-vkbur,
vkburtext TYPE tvkbt-bezei,
vkgrp TYPE tvkgr-vkgrp,
vkgrptext TYPE tvgrt-bezei,
kostl TYPE csks-kostl,
ltext TYPE cskt-ltext.
TYPES:END OF ty_zz.
DATA :gt_zz TYPE STANDARD TABLE OF ztsd007 .
DATA:wa_zz TYPE ztsd007.
DATA: excel TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
cell TYPE ole2_object,
row TYPE ole2_object.
FORM get_data.
* CALL FUNCTION 'VIEW_GET_DATA'
* EXPORTING
* view_name = 'V_TVBUR'
* TABLES
* data = gt_xs.
SELECT *
FROM ztsd007
INTO CORRESPONDING FIELDS OF TABLE gt_zz.
LOOP AT gt_xs INTO wa_xs.
wa_zz-vkbur = wa_xs-vkbur.
wa_zz-vkburtext = wa_xs-bezei.
APPEND wa_zz TO gt_zz.
ENDLOOP.
* SELECT *
* FROM cskt
* INTO CORRESPONDING FIELDS OF TABLE gt_zz.
ENDFORM.
DATA: gs_fcat TYPE lvc_s_fcat,
gt_fcat TYPE lvc_t_fcat,
gs_layo TYPE lvc_s_layo,
gs_grid TYPE lvc_s_glay.
DATA: gt_event TYPE slis_t_event WITH HEADER LINE,
gt_event_exit TYPE slis_t_event_exit WITH HEADER LINE.
DATA: ref_grid TYPE REF TO cl_gui_alv_grid .
"parameters: p_ds type c as checkbox.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
PARAMETERS: r1 RADIOBUTTON GROUP gr1 DEFAULT 'X' USER-COMMAND radio.
PARAMETERS: r2 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN END OF BLOCK blk2.
DATA: filepath LIKE rlgrap-filename .
DATA: file LIKE rlgrap-filename.
START-OF-SELECTION.
IF r1 EQ 'X'.
PERFORM get_data.
PERFORM show_data_to_alv.
ELSEIF r2 EQ 'X'.
PERFORM frm_path_selected CHANGING filepath.
CONCATENATE filepath '\销售范围维护模板.XLS' INTO file.
PERFORM frm_download_template USING file.
ENDIF.
*START-OF-SELECTION.
* PERFORM get_data.
* PERFORM show_data_to_alv.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_modify
FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells.
METHODS data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_modify.
* PERFORM refresh.
DATA stbl TYPE lvc_s_stbl.
stbl-row = 'X'." 基于行的稳定刷新
stbl-col = 'X'." 基于列稳定刷新
CALL METHOD ref_grid->refresh_table_display
EXPORTING
is_stable = stbl.
ENDMETHOD.
METHOD data_changed.
DATA: ls_mod_cells TYPE lvc_s_modi,
tvalue TYPE string.
DATA: ls_stable TYPE lvc_s_stbl.
DATA: l_message TYPE string.
*
DATA :wa_tvbkt TYPE tvkbt,
tab_tvbkt TYPE TABLE OF tvkbt.
DATA:wa_tvgrt TYPE tvgrt,
tab_tvgrt TYPE TABLE OF tvgrt.
DATA:wa_cskt TYPE cskt,
tab_cskt TYPE TABLE OF cskt.
DATA:row_no TYPE i.
CHECK er_data_changed->mt_inserted_rows[] IS INITIAL.
LOOP AT er_data_changed->mt_good_cells INTO ls_mod_cells.
CLEAR tvalue.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = ls_mod_cells-fieldname
IMPORTING
e_value = tvalue.
SELECT *
FROM tvkbt
INTO CORRESPONDING FIELDS OF TABLE tab_tvbkt.
SELECT *
FROM tvgrt
INTO CORRESPONDING FIELDS OF TABLE tab_tvgrt.
SELECT *
FROM cskt
INTO CORRESPONDING FIELDS OF TABLE tab_cskt.
IF ls_mod_cells-fieldname EQ 'VKBUR'.
LOOP AT tab_tvbkt INTO wa_tvbkt .
IF wa_tvbkt-vkbur EQ tvalue.
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'VKBURTEXT'
i_value = wa_tvbkt-bezei.
EXIT.
ENDIF.
CLEAR wa_tvbkt.
ENDLOOP.
ENDIF.
IF ls_mod_cells-fieldname EQ 'VKGRP'.
DATA:blank_zz TYPE ztsd007.
LOOP AT tab_tvgrt INTO wa_tvgrt .
IF wa_tvgrt-vkgrp EQ tvalue.
CLEAR wa_zz.
LOOP AT gt_zz INTO wa_zz.
IF wa_zz-vkgrp EQ tvalue AND tvalue NE ''.
MESSAGE i001(00) WITH '已有相同的销售组!'.
"MODIFY gt_zz INDEX ls_mod_cells-row_id FROM blank_zz .
CLEAR wa_tvgrt.
"如果有重复的销售组,那么将输入的销售组清空
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'VKGRP'
i_value = ''.
ENDIF.
CONTINUE.
ENDLOOP.
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'VKGRPTEXT'
i_value = wa_tvgrt-bezei.
ENDIF.
CLEAR wa_tvgrt.
ENDLOOP.
ENDIF.
IF ls_mod_cells-fieldname EQ 'KOSTL'.
LOOP AT tab_cskt INTO wa_cskt .
IF wa_cskt-kostl EQ tvalue.
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'LTEXT'
i_value = wa_cskt-ltext.
EXIT.
ENDIF.
CLEAR wa_cskt.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDMETHOD. "HANDLE_MODIFY
ENDCLASS. "LCL_EVENT_RECEIVER IMPLEMENTATION
DATA gt_event_receiver TYPE REF TO lcl_event_receiver .
FORM show_data_to_alv.
PERFORM set_fcat USING edit.
PERFORM set_layout.
PERFORM show_alv TABLES gt_fcat gt_zz[]
USING gs_layo.
ENDFORM.
FORM frm_edit_alv." TABLES GT.
*DATA: ls_row TYPE lvc_s_cell,
* lt_rows TYPE lvc_t_cell.
* "CLEAR GT_HEADER.
* "CLEAR GT_ITEMS.
* CALL METHOD ref_grid->GET_SELECTED_CELLS
* IMPORTING
* et_index_cells = lt_rows
ENDFORM.
FORM show_changed_alv.
CLEAR gt_fcat[].
* IF edit EQ '' .
* edit = 'X'.
* ELSE.
* edit = ''.
* ENDIF.
PERFORM set_fcat USING edit.
PERFORM set_layout.
PERFORM show_alv TABLES gt_fcat gt_zz[]
USING gs_layo.
PERFORM frm_edit_alv.
ENDFORM.
FORM set_fcat USING edit.
PERFORM csalv_set_fcat USING :
" 'Field' 'Text' 'Edit' 'Zero' 'Type' 'Qfieldname' 'Key' 'Hostspot' 'Emphasize' 'Checkbox'
'VKBUR' '销售部门' edit '' '' '' '' '' '' '' '' '' '' 'X' 'ZTSD007' 'VKBUR',
"'NAME1' '客户' EDIT '' '' '' '' '' '' '' '' '' '',
'VKBURTEXT' '销售部门描述' '' '' '' '' '' '' '' '' '' '' '' '' '' '',
'VKGRP' '销售组' edit '' '' '' '' '' '' '' '' '' '' 'X' 'ZTSD007' 'VKGRP',
'VKGRPTEXT' '销售组描述' '' '' '' '' '' '' '' '' '' '' '' '' '' '',
'KOSTL' '成本中心' edit '' '' '' '' '' '' '' '' '' '' 'X' 'CSKS' 'KOSTL' ,
'LTEXT' '成本中心描述' '' '' '' '' '' '' '' '' '' '' '' '' '' '' .
ENDFORM. " SET_FCAT
FORM set_layout .
gs_layo
-zebra = 'X'.
* gs_layout-stylefname = 'FIELD_STYLE'.
gs_layo
-cwidth_opt = 'X'.
ENDFORM. " SET_LAYOUT
*&---------------------------------------------------------------------*
FORM csalv_set_fcat USING
p_name
p_text
p_edit
p_zero
p_type
p_qfieldname
p_key
p_hotspot
p_emphasize
p_checkbox
p_do_sum
p_decimals_out
p_no_out
p_f4availabl
p_ref_table
p_ref_field
.
gs_fcat
-fieldname = p_name.
* gs_fcat-reptext_l =
* gs_fcat-selddictxt =
gs_fcat
-reptext = p_text.
gs_fcat
-edit = p_edit.
gs_fcat
-no_zero = p_zero.
gs_fcat
-datatype = p_type.
gs_fcat
-qfieldname = p_qfieldname.
gs_fcat
-key = p_key.
gs_fcat
-hotspot = p_hotspot.
gs_fcat
-emphasize = p_emphasize.
gs_fcat
-checkbox = p_checkbox.
gs_fcat
-do_sum = p_do_sum.
gs_fcat
-decimals_o = p_decimals_out.
gs_fcat
-no_out = p_no_out.
gs_fcat
-f4availabl = p_f4availabl.
gs_fcat
-ref_table = p_ref_table.
gs_fcat
-ref_field = p_ref_field.
APPEND gs_fcat TO gt_fcat.
ENDFORM. "csalv_set_fcat
FORM show_alv TABLES pt_fcat
pt_tab
USING ps_layout.
gs_grid
-edt_cll_cb = 'X'."当屏幕失去焦点时,自动刷新
gt_event
-name = 'CALLER_EXIT'. "slis_ev_caller_exit_at_start事件
gt_event
-form = 'FM_BUTTON'.
APPEND gt_event .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program
= sy-repid
i_callback_user_command
= 'USER_COMMAND'
i_grid_settings
= gs_grid
i_callback_pf_status_set
= 'SET_PF_STATUS'
is_layout_lvc
= ps_layout
it_fieldcat_lvc
= pt_fcat[]
it_events
= gt_event[]
* it_event_exit = gt_event_exit[]
TABLES
t_outtab
= pt_tab
EXCEPTIONS
program_error
= 1
OTHERS = 2.
ENDFORM. "csalv_set_fcat
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield
TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'.
WHEN '&CHANGE'.
IF edit EQ '' .
edit = 'X'.
ELSE.
edit = ''.
ENDIF.
PERFORM show_changed_alv.
WHEN '&BACK'.
LEAVE PROGRAM.
WHEN '&ADD_ROW'.
* CLEAR wa_zz.
* DATA:end TYPE i.
* DESCRIBE TABLE gt_zz LINES end.
*
* READ TABLE gt_zz INDEX end INTO wa_zz.
* IF wa_zz-vkbur IS INITIAL AND gt_zz is NOT INITIAL .
* MESSAGE i001(00) WITH '不能继续添加行!'.
* exit.
* ENDIF.
"edit = ''.
CLEAR wa_zz.
IF edit EQ 'X'.
APPEND wa_zz TO gt_zz.
PERFORM show_changed_alv.
ENDIF.
WHEN '&SAVE_DATA'.
CLEAR wa_zz.
DELETE FROM ztsd007 .
IF gt_zz IS NOT INITIAL.
LOOP AT gt_zz INTO wa_zz.
INSERT INTO ztsd007 VALUES wa_zz.
ENDLOOP.
ENDIF.
IF sy-subrc EQ 0.
MESSAGE i001(00) WITH '保存成功!'.
ELSE.
MESSAGE i001(00) WITH '保存失败!'.
ENDIF.
WHEN '&DELE_ROW'.
DATA:ls_row TYPE lvc_s_row,
lt_rows
TYPE lvc_t_row.
DATA:del_rows TYPE STANDARD TABLE OF ztsd007.
CALL METHOD ref_grid->get_selected_rows
IMPORTING
et_index_rows
= lt_rows
* et_row_no =
.
CLEAR wa_zz.
LOOP AT lt_rows INTO ls_row.
READ TABLE gt_zz INTO wa_zz INDEX ls_row-index.
"delete gt_zz INDEX ls_row-index.
"DELETE ztsd007 FROM wa_zz.
APPEND wa_zz TO del_rows.
ENDLOOP.
LOOP AT del_rows INTO wa_zz.
DELETE TABLE gt_zz FROM wa_zz.
ENDLOOP.
CLEAR del_rows.
CLEAR ls_row.
CLEAR lt_rows.
PERFORM show_changed_alv.
WHEN '&IN'.
DATA: filepath LIKE rlgrap-filename.
PERFORM set_file_path CHANGING filepath.
PERFORM frm_upload_from_excel USING filepath.
PERFORM show_changed_alv.
ENDCASE.
ENDFORM.
FORM set_pf_status USING rt_extab TYPE slis_t_extab..
SET PF-STATUS 'STANDARD'.
ENDFORM. "SET_PF_STATUS
FORM fm_button USING e_grid TYPE slis_data_caller_exit.
DATA: lt_f4 TYPE lvc_t_f4,
ls_f4
TYPE lvc_s_f4.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
* EXPORTING
* IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
* ET_EXCLUDING =
* E_REPID =
* E_CALLBACK_PROGRAM =
* E_CALLBACK_ROUTINE =
e_grid
= ref_grid
* ET_FIELDCAT_LVC =
* ER_TRACE =
* E_FLG_NO_HTML =
* ES_LAYOUT_KKBLO =
* ES_SEL_HIDE =
* ET_EVENT_EXIT =
* ER_FORM_TOL =
* ER_FORM_EOL =
.
* CALL METHOD ref_grid->check_changed_data.
* 设置enter事件
CALL METHOD ref_grid->register_edit_event
EXPORTING
i_event_id
= cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error
= 1
OTHERS = 2.
CREATE OBJECT gt_event_receiver.
SET HANDLER gt_event_receiver->handle_modify FOR ref_grid.
SET HANDLER gt_event_receiver->data_changed FOR ref_grid.
ENDFORM. "FM_BUTTON
FORM frm_upload_from_excel USING p_pa_fname LIKE rlgrap-filename.
* TYPES: BEGIN OF ty_tmp,
* lifnr LIKE ztmm002-lifnr,
* lifnr_name LIKE lfa1-name1,
* werks LIKE ztmm002-werks,
* werks_name LIKE t001w-name1,
* menge LIKE ztmm002-menge,
* meins LIKE ztmm002-meins,
* END OF ty_tmp.
DATA:vkbur_tmp LIKE tvkbt-vkbur,
vkgrp_tmp
LIKE tvkgr-vkgrp.
DATA: git_xls TYPE TABLE OF ty_zz WITH HEADER LINE,
gwa_xls
TYPE ty_zz.
**数据从EXCEL导入程序
DATA: l_exception TYPE REF TO cx_root.
DATA: lit_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE,
l_index
TYPE i,
l_no
TYPE i.
DATA: ls_style TYPE lvc_s_styl.
FIELD-SYMBOLS: <f>.
CHECK p_pa_fname IS NOT INITIAL.
REFRESH: git_xls.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename
= p_pa_fname
i_begin_col
= 1
i_begin_row
= 2
i_end_col
= 6
i_end_row
= 30000
TABLES
intern
= lit_intern
EXCEPTIONS
inconsistent_parameters
= 1
upload_ole
= 2
OTHERS = 3.
IF sy-subrc = 0.
l_no
= 0.
LOOP AT lit_intern.
MOVE lit_intern-col TO l_index.
ASSIGN COMPONENT l_index OF STRUCTURE gwa_xls TO <f>.
TRY.
MOVE lit_intern-value TO <f>.
CATCH cx_root INTO l_exception.
* gwa_xls-err_info = l_exception->get_text( ).
* gwa_xls-status = icon_led_red.
ENDTRY.
AT END OF row.
ADD 1 TO l_no.
"gwa_xls-no = l_no.
APPEND gwa_xls TO git_xls.
CLEAR gwa_xls.
ENDAT.
ENDLOOP.
ENDIF.
LOOP AT git_xls INTO gwa_xls.
MOVE-CORRESPONDING gwa_xls TO wa_zz.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_zz-vkbur
IMPORTING
output = wa_zz-vkbur.
SELECT SINGLE bezei INTO wa_zz-vkburtext
FROM tvkbt WHERE vkbur EQ wa_zz-vkbur.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_zz-vkgrp
IMPORTING
output = wa_zz-vkgrp.
SELECT SINGLE bezei INTO wa_zz-vkgrptext
FROM tvgrt WHERE vkgrp EQ wa_zz-vkgrp.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_zz-kostl
IMPORTING
output = wa_zz-kostl.
SELECT SINGLE ltext INTO wa_zz-ltext
FROM cskt WHERE kostl EQ wa_zz-kostl.
DATA: gt_v_tvbvk LIKE TABLE OF v_tvbvk_assign,
wa_v_tvbvk
LIKE v_tvbvk_assign.
CALL FUNCTION 'VIEW_GET_DATA'
EXPORTING
view_name
= 'V_TVBVK_ASSIGN'
TABLES
data = gt_v_tvbvk.
READ TABLE gt_v_tvbvk INTO wa_v_tvbvk WITH KEY vkbur = wa_zz-vkbur
vkgrp
= wa_zz-vkgrp.
* SELECT SINGLE vkbur INTO vkbur_tmp FROM v_tvbvk_assign
* WHERE vkbur EQ wa_zz-vkbur.
* SELECT SINGLE vkgrp INTO vkgrp_tmp FROM v_tvbvk_assign
* WHERE vkgrp EQ wa_zz-vkgrp.
IF ( wa_v_tvbvk-vkbur IS NOT INITIAL ) AND ( wa_v_tvbvk-vkgrp IS NOT INITIAL ) .
APPEND wa_zz TO gt_zz.
ELSE.
MESSAGE e001(00) WITH '销售办公室:' && wa_zz-vkbur && '与销售组:' &&
wa_zz
-vkgrp && '的组合不存在!'.
EXIT.
ENDIF.
CLEAR wa_zz.
ENDLOOP.
ENDFORM.
FORM set_file_path CHANGING filepath LIKE rlgrap-filename.
FIELD-SYMBOLS: <f> TYPE file_table .
DATA: gd_path TYPE string.
DATA: it_tab TYPE filetable,
gd_subrc
TYPE i.
DATA: ld_filename TYPE string,
ld_path
TYPE string,
ld_fullpath
TYPE string,
ld_result
TYPE i,
gd_file
TYPE c.
DATA:"filepath LIKE rlgrap-filename,
openfile
LIKE rlgrap-filename.
* CALL METHOD cl_gui_frontend_services=>directory_browse
* EXPORTING
* window_title = '文件路径选择'
* initial_folder = 'C:'
* CHANGING
* selected_folder = gd_path.
* CALL METHOD cl_gui_cfw=>flush.
* CONCATENATE gd_path '' INTO filepath.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title
= 'Select File'
default_filename
= '销售范围维护模板.XLS'
multiselection
= 'X'
CHANGING
file_table
= it_tab
rc
= gd_subrc.
CALL METHOD cl_gui_cfw=>flush.
READ TABLE it_tab ASSIGNING <f> INDEX 1.
IF sy-subrc EQ 0.
filepath
= <f>-filename.
ENDIF.
*CALL METHOD cl_gui_frontend_services=>file_save_dialog
* EXPORTING
* default_extension = 'XLS'
* default_file_name = '产品出库单'
* initial_directory = 'c:/temp/'
* CHANGING
* filename = ld_filename
* path = filepath
* fullpath = ld_fullpath
* user_action = ld_result.
ENDFORM.
FORM frm_path_selected CHANGING filepath LIKE rlgrap-filename.
DATA: gd_path TYPE string.
DATA: it_tab TYPE filetable,
gd_subrc
TYPE i.
DATA: ld_filename TYPE string,
ld_path
TYPE string,
ld_fullpath
TYPE string,
ld_result
TYPE i,
gd_file
TYPE c.
DATA:"filepath LIKE rlgrap-filename,
openfile
LIKE rlgrap-filename.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title
= '文件路径选择'
initial_folder
= 'C:'
CHANGING
selected_folder
= gd_path.
CALL METHOD cl_gui_cfw=>flush.
CONCATENATE gd_path '' INTO filepath.
ENDFORM.
FORM frm_download_template USING c_path .
DATA: lv_objdata LIKE wwwdatatab,
lv_obj_name
LIKE wwwdatatab-objid,
lv_destination
LIKE rlgrap-filename,
lv_objid
LIKE sy-repid,
lv_subrc
LIKE sy-subrc.
DATA:l_ret TYPE abap_bool, lv_answer
.
DATA:lv_file TYPE string.
MOVE c_path TO lv_file.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file
= lv_file
RECEIVING
result
= l_ret
EXCEPTIONS
cntl_error
= 1
error_no_gui
= 2
wrong_parameter
= 3
not_supported_by_gui
= 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
IF l_ret EQ 'X'.
* 模版已存在,是否覆盖
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question
= '模版已存在,是否覆盖?'
text_button_1
= '是'(001)
text_button_2
= '否'(002)
IMPORTING
answer
= lv_answer
EXCEPTIONS
text_not_found
= 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
IF lv_answer EQ 'A'. "取消
EXIT.
ELSEIF lv_answer NE '1'. "否
"p_filepath = c_path.
ENDIF.
ELSE.
lv_answer
= '1'.
ENDIF.
CREATE OBJECT excel 'EXCEL.APPLICATION'.
GET PROPERTY OF excel 'Workbooks' = workbook .
CALL METHOD OF workbook
'Close'.
IF lv_answer EQ '1'.
MOVE 'ZSD_XLS_002' TO lv_obj_name."引用传入到服务器中xls模板
SELECT relid objid
FROM wwwdata
INTO CORRESPONDING FIELDS OF lv_objdata
UP TO 1 ROWS
WHERE srtf2 = 0 AND relid = 'MI'
AND objid = lv_obj_name.
ENDSELECT.
CALL FUNCTION 'DOWNLOAD_WEB_OBJECT'
EXPORTING
key = lv_objdata
destination
= c_path
IMPORTING
rc
= lv_subrc.
* IF lv_subrc = 0.
* p_filepath = c_path.
* ENDIF.
ENDIF.
* CALL METHOD OF
* g_workbook
* 'open'
*
* EXPORTING
* #1 = c_path.
*
* CALL METHOD OF
* g_excel
* 'worksheets' = g_sheet
* EXPORTING
* #1 = 1.
* CALL METHOD OF
* g_sheet
* 'activate'.
"SET PROPERTY OF g_excel 'visible' = 0.
FREE OBJECT sheet.
"FREE OBJECT g_applica.
FREE OBJECT workbook.
FREE OBJECT excel.
ENDFORM. "frm_download_template
ABAP 销售范围的更多相关文章
- ABAP技术总结
SAP ——ABAP/4 技术总结 V3.0 2014-10-14 --江正军 1. 1.1. 1.1.1. 1.2. 1.3. 1.4. 1.5. 1.6. 1.7. 1.7.1. 1.7.2. ...
- ABAP单元测试最佳实践
本文包含了我在开发项目中经历过的实用的ABAP单元测试指导方针.我把它们安排成为问答的风格,欢迎任何人添加更多的Q&A's,以完成这个列表. 在我的项目中,只使用传统的ABAP report. ...
- ABAP实现屏幕自己刷新和跳转功能
ABAP开发工程中,有时候需要让跳转出的屏幕自动实现跳转和刷新的功能,该功能的实现需要在屏幕PBO 里面调用相应的事件执行. 关键代码为: SET TITLEBAR ' 屏幕自动程序'. IF g_c ...
- 一步步实现ABAP后台导入EXCEL到数据库【3】
在一步步实现ABAP后台导入EXCEL到数据库[2]里,我们已经实现计划后台作业将数据导入数据库的功能.但是,这只是针对一个简单的自定义结构的导入程序.在实践应用中,面对不同的表.不同的导入文件,我们 ...
- 一步步实现ABAP后台导入EXCEL到数据库【2】
前文:http://www.cnblogs.com/hhelibeb/p/5912330.html 既然后台作业只能在应用服务器运行,那么,我们可以先将要上传的数据保存在应用服务器中,之后再以后台作业 ...
- 让ABAP开发者愈加轻松的若干快捷键
引言 ABAP是一种和当代编程语言在许多方面有着相当不同的编程语言.ABAP的某些方面可能会让我们奇怪,为什么它会如此复杂?而它的某些方面又是那么杰出,给予了ABAP开发者们比其它任何语言更多的便利. ...
- ABAP游标的使用
在Oracle,SQLServer中游标的使用是经常的,所以在ABAP不懂是不行的...... 1.声明游标 OPEN CURSOR [WITH HOLD] <c> FOR SEL ...
- 一步步实现ABAP后台导入EXCEL到数据库【1】
在SAP的应用当中,导入.导出EXCEL文件的情况是一个常见的需求,有时候用户需要将大量数据定期导入到SAP的数据库中.这种情况下,使用导入程序在前台导入可能要花费不少的时间,如果能安排导入程序为后台 ...
- ABAP关键字SUBMIT的简单例子和学习小记
网上有关SUBMIT实现程序调用的例子稍显复杂,而相关的参考和解释则不是很完善.本文给出一个SUBMIT的小示例程序(代码见文末),实现了最简单的程序间调用及返回值,以及SAP官方文档中相关内容的翻译 ...
随机推荐
- ApacheServer-----关于443端口被占用的解决方法
最经公司项目需要经过Apache服务器转发,自己也下载了ApacheServer,但是在启动的过程中,遇到443端口被占用,网上看了一些解决方法,都不对,没有解决问题. 执行启动命令httpd -k ...
- 几个Web server的HA架构资料
提高Web性能, 最关键还是要看瓶颈在哪里. 手段不外乎下面几个. 实现从易到难一般为: 优化Big SQL -> 引入CDN -> 引入Memcache等缓存 -> Web负载平衡 ...
- ASP.NET 5与MVC 6中的新特性
差点忘了提一句,MVC 6中默认的渲染引擎Razor也将得到更新,以支持C# 6中的新语法.而Razor中的新特性还不只这一点. 在某些情况下,直接在Web页面中嵌入某些JSON数据的方式可能比向服务 ...
- 【CISP笔记】操作系统安全
账号安全设置 默认管理账号Administrator更名,设置密码(字母.数字.大小写字母.特殊字符,长度在8位以上). 本地安全策略 打开方式 win+R 输入ecpol.msc 账号锁定策略 用户 ...
- 密码学初级教程(六)数字签名 Digital Signature
密码学家工具箱中的6个重要的工具: 对称密码 公钥密码 单向散列函数 消息认证码 数字签名 伪随机数生成器 提问: 有了消息认证码为什么还要有数字签名? 因为消息认证码无法防止否认.消息认证码可以识别 ...
- [译]Mongoose指南 - 验证
开始前记住下面几点 Validation定义在SchemaType中 Validation是一个内部的中间件 当document要save前会发生验证 验证不会发生在空值上 除非对应的字段加上了 re ...
- Tomcat 服务器性能优化
简介 考虑一下这种场景,你开发了一个应用,它有十分优秀的布局设计,最新的特性以及其它的优秀特点.但是在性能这方面欠缺,不管这个应用如何都会遭到客户拒绝.客户总是期望它们的应用应该有更好的性能.如果你在 ...
- PHPStorm Xdebug配置
下载PHSTORM https://download.jetbrains.com/webide/PhpStorm-2016.1.2.exe http://idea.lanyus.com/查找授权服务器 ...
- Sql中的并(UNION)、交(INTERSECT)、差(minus)、除去(EXCEPT)详解
UNION 查询选修了180101号或180102号课程或二者都选修了的学生学号.课程号和成绩. (SELECT 学号, 课程号, 成绩 FROM 学习 WHERE 课程号='180101' ...
- CSS使用自定义光标样式-遁地龙卷风
测试环境是chrome浏览器 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357. ...