ALV捕捉回车键.docx
- 文档编号:6863509
- 上传时间:2023-01-11
- 格式:DOCX
- 页数:13
- 大小:18.14KB
ALV捕捉回车键.docx
《ALV捕捉回车键.docx》由会员分享,可在线阅读,更多相关《ALV捕捉回车键.docx(13页珍藏版)》请在冰豆网上搜索。
ALV捕捉回车键
*&---------------------------------------------------------------------*
*&包括 ZINCL0016
*&---------------------------------------------------------------------*
INCLUDE
INCLUDEole2incl.
TYPE-POOLS:
slis.
TYPES:
BEGINOFt_bsbbno,
zbsnoTYPEzhrebsno,
zyemnTYPEzhrtbsbb-zyemn,
zbblxTYPEzhrtbsbb-zbblx,
werksTYPEzhrtbsbb-werks,
ENDOFt_bsbbno.
DATA:
doc_table LIKEw3mimeOCCURS0,
doc_size TYPEi,
doc_type TYPEchar100,
doc_format TYPEchar100,
gc_templatenameTYPEchar100,
gc_filename TYPEstring,
gc_status TYPEi,
gc_alvtitle TYPElvc_title,
gt_exclude TYPETABLEOFchar20WITHHEADERLINE,
savefile TYPEstring,
gt_excel TYPETABLEOFalsmex_tabline.
DATA:
excel TYPEole2_object,
application TYPEole2_object,
workbook TYPEole2_object,
sheet TYPEole2_object,
cells TYPEole2_object,
exrows TYPEole2_object,
excolumns TYPEole2_object,
borders TYPEole2_object,
linestyle TYPEole2_object,
ranges TYPEole2_object,
interior TYPEole2_object,
pagebreak TYPEole2_object.
*ALVUsed
DATA:
it_fieldcat TYPEslis_t_fieldcat_alv,
it_sort TYPEslis_t_sortinfo_alv,
it_events TYPEslis_t_event,
wa_fieldcat TYPEslis_fieldcat_alv,
wa_sort TYPEslis_sortinfo_alv,
wa_events LIKELINEOFit_events,
ls_layout TYPEslis_layout_alv,
lc_glay TYPElvc_s_glay.
DATAtem_grid TYPEREFTOcl_gui_alv_grid.
*----------------------------------------------------------------------*
* CLASSLCL_EVENT_RECEIVERDEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASSlcl_event_receiverDEFINITION.
PUBLICSECTION.
METHODShandle_modify
FOREVENTdata_changed_finishedOFcl_gui_alv_grid
IMPORTINGe_modifiedet_good_cells.
ENDCLASS. "LCL_EVENT_RECEIVERDEFINITION
*----------------------------------------------------------------------*
* CLASSLCL_EVENT_RECEIVERIMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASSlcl_event_receiverIMPLEMENTATION.
METHODhandle_modify.
PERFORMrefresh.
DATAstblTYPElvc_s_stbl.
* 稳定刷新
stbl-row='X'."基于行的稳定刷新
stbl-col='X'."基于列稳定刷新
CALLMETHODtem_grid->refresh_table_display
EXPORTING
is_stable=stbl.
ENDMETHOD. "HANDLE_MODIFY
ENDCLASS. "LCL_EVENT_RECEIVERIMPLEMENTATION
DATAgt_event_receiverTYPEREFTOlcl_event_receiver.
*&---------------------------------------------------------------------*
*& Formdownloadtemplate
*&---------------------------------------------------------------------*
* DownloadExcelTemplateFromSAPAndSaveToLocal
*----------------------------------------------------------------------*
* -->PTEMPLATENAMETemplateFileName
* -->PSAVEFILENAMEExcelFileName
*----------------------------------------------------------------------*
FORMdownloadtemplateUSINGptemplatenameTYPEchar100
psavefilename.
DATA:
path TYPEstring,
filenameTYPEstring,
title TYPEstringVALUE'请选择保存的路径及文件名',
filter TYPEstring.
CONCATENATEcl_gui_frontend_services=>filetype_excel
cl_gui_frontend_services=>filetype_all
INTOfilter.
CALLMETHODcl_gui_frontend_services=>file_save_dialog
EXPORTING
default_file_name=psavefilename
window_title =title
file_filter =filter
CHANGING
filename =filename
path =path
fullpath =savefile.
CHECKsavefileISNOTINITIAL.
CALLFUNCTION'SAP_OI_LOAD_MIME_DATA'
EXPORTING
object_id =ptemplatename
IMPORTING
data_size =doc_size
document_format=doc_format
document_type =doc_type
TABLES
data_table =doc_table.
CHECKdoc_tableISNOTINITIAL.
CALLFUNCTION'GUI_DOWNLOAD'
EXPORTING
bin_filesize =doc_size
filename =savefile
filetype ='BIN'
TABLES
data_tab =doc_table
EXCEPTIONS
file_write_error =1
no_batch =2
gui_refuse_filetransfer=3
invalid_type =4
no_authority =5
unknown_error =6
header_not_allowed =7
separator_not_allowed =8
filesize_not_allowed =9
header_too_long =10
dp_error_create =11
dp_error_send =12
dp_error_write =13
unknown_dp_error =14
access_denied =15
dp_out_of_memory =16
disk_full =17
dp_timeout =18
file_not_found =19
dataprovider_exception=20
control_flush_error =21
OTHERS =22.
IFsy-subrc=0.
* PERFORMmain_process.
PERFORMwriteexcel.
MESSAGEs032WITHsavefile.
ELSE.
MESSAGEIDsy-msgidTYPEsy-msgtyNUMBERsy-msgno
WITHsy-msgv1sy-msgv2sy-msgv3sy-msgv4.
ENDIF.
*DATA:
ls_wwwdatatabTYPEwwwdatatab,
* ls_savefile TYPErlgrap-filename,
* ls_filename TYPEw3file-name,
* rc TYPEsy-subrc.
*
*ls_wwwdatatab-relid='MI'.
*ls_wwwdatatab-objid=ptemplatename.
*ls_filename=psavefilename.
**ls_savefile=psavefilename.
*
*CALLFUNCTION'DOWNLOAD_WEB_OBJECT'
* EXPORTING
* key =ls_wwwdatatab
* destination=ls_savefile
* IMPORTING
* rc =rc
* CHANGING
* temp =ls_filename.
*IFrc=0.
* MESSAGEls_filenameTYPE'S'.
** savefile=ls_filename.
* PERFORMopenexcelfileUSING1ls_filename.
* PERFORMmain_process.
*ENDIF.
ENDFORM. "downloadtemplate
*&---------------------------------------------------------------------*
*& Formoutputalv
*&---------------------------------------------------------------------*
* OutputALV
*----------------------------------------------------------------------*
* -->IT_ALVDATAInternalTableOfALVData
*----------------------------------------------------------------------*
FORMoutputalvTABLESit_alvdataTYPESTANDARDTABLE.
wa_events-name='CALLER_EXIT'.
wa_events-form='FM_BUTTON'.
APPENDwa_eventsTOit_events.
lc_glay-edt_cll_cb='X'.
CALLFUNCTION'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK =''
* I_BYPASSING_BUFFER =''
* I_BUFFER_ACTIVE =''
i_callback_program =sy-repid
i_callback_pf_status_set ='SET_STATUS'
i_callback_user_command ='USER_COMMAND'
i_callback_top_of_page =''
i_callback_html_top_of_page =''
i_callback_html_end_of_list =''
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID =''
i_grid_title =gc_alvtitle
i_grid_settings =lc_glay
is_layout =ls_layout
it_fieldcat =it_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort =it_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT ='X'
i_save ='X'
* IS_VARIANT =
it_events =it_events
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN =0
* I_SCREEN_START_LINE =0
* I_SCREEN_END_COLUMN =0
* I_SCREEN_END_LINE =0
* I_HTML_HEIGHT_TOP =0
* I_HTML_HEIGHT_END =0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
*IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab =it_alvdata
EXCEPTIONS
program_error =1
OTHERS =2.
IFsy-subrc<>0.
MESSAGEIDsy-msgidTYPEsy-msgtyNUMBERsy-msgno
WITHsy-msgv1sy-msgv2sy-msgv3sy-msgv4.
ENDIF.
ENDFORM. "outputalv
*&---------------------------------------------------------------------*
*& Formuser_command
*&---------------------------------------------------------------------*
* ALVUserCommandCallBackFunction
*----------------------------------------------------------------------*
* -->P_UCOMM OKCode
* -->P_SELFIELDSelectedALVField
*----------------------------------------------------------------------*
FORMuser_commandUSINGp_ucomm LIKEsy-ucomm
p_selfieldTYPEslis_selfield.
CASEp_ucomm.
WHEN'&XLS'.
PERFORMdownloadtemplateUSINGgc_templatenamegc_filename.
WHEN'&UPL'.
* PERFORMeditexcel.
PERFORMuploadexcel.
P
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ALV 捕捉 回车键