Said SAP in the Excel operation is probably upload, download, show ...
Download: (document is uploaded via SMW0) Note: If you need to populate Excel values when downloading, ... Please refer to another document, OLE
Pager METHODCl_gui_frontend_services=>File_save_dialogExportingdefault_extension='xlsx'Default_file_name=Lc_filenamechangingFILENAME=lc_filename PATH=Lc_path FULLPATH=Lc_fullpathEXCEPTIONSCntl_error=1Error_no_gui=2Not_supported_by_gui=3OTHERS=4. IFLc_fullpath ="'. MESSAGE 'cannot open Excel' TYPE 'E'. ENDIF. IFSY-SUBRC =0. P_dest=Lc_fullpath.*concatenate P_objid '. XLS ' into Ls_objnam. CondenseLs_objnam no-gaps. SELECT SingleRelid OBJID fromWwwdata into corresponding Fields ofLo_objdataWHERESRTF2 =0 andRelid ='MI' andOBJID =P_objid. IFSy-subrcNE 0 ORLo_objdata-objidEQSPACE. concatenate 'template file'Ls_objnam'does not exist' intoLs_errtxt. MESSAGELs_errtxtTYPE 'I'. ENDIF. Ls_destination=P_dest. Pager FUNCTION 'Download_web_object' ExportingKEY=Lo_objdataDESTINATION=ls_destinationImportingRC=LI_RC. IFLi_rcNE 0. concatenate 'template file:'Ls_objnam'Download Failed' intoLs_errtxt. MESSAGELs_errtxtTYPE 'E'. ENDIF. ENDIF.
Upload:
Select a file path selection on the screen:
selection-screen:BEGINofBLOCKwithTEXT-001. PARAMETERS like rlgrap-FILENAME. Selection-screen END of BLOCK BLK01.
Help for file Search:
at Selection-screen on value-request for p_file. PERFORM Frm_get_filepath.
FORMFrm_get_filepath. Pager FUNCTION 'Ws_filename_get' ExportingMASK=', Excel (*.xls), *. xls,*. XLSX,'TITLE='Select File'( -) ImportingFILENAME=P_fileEXCEPTIONSInv_winsys=1No_batch=2Selection_cancel=3Selection_error=4OTHERS=5. IFSY-SUBRC <>0. MESSAGEE100 (Zdev) with 'Error Selecting File! '(007). ENDIF.EndForm.
And then maybe the Excel content
Pager FUNCTION 'alsm_excel_to_internal_table' ExportingFILENAME=p_file I_begin_col='1'I_begin_row='2'I_end_col=' -'I_end_row='50000' TABLESINTERN= gt_excel_t.
This time gets the Excel row, column, value
Data processing
LOOP atgt_excel_t intogs_excel_t. at NEWROW. CLEAR: Gw_excel. ENDAT. Casegs_excel_t-COL. when1. Gw_excel-LIFNR = gs_excel_t-VALUE. Pager FUNCTION 'Conversion_exit_alpha_input' ExportingINPUT= gw_excel-LIFNRImporting OUTPUT= gw_excel-Lifnr. when2. Gw_excel-MATNR = gs_excel_t-VALUE. Pager FUNCTION 'Conversion_exit_alpha_input' ExportingINPUT= gw_excel-MatnrImporting OUTPUT= gw_excel-Matnr. when3. Gw_excel-ekorg = gs_excel_t-VALUE. when4. Gw_excel-werks = gs_excel_t-VALUE. when5. Gw_excel-NETPR = gs_excel_t-VALUE. when6. Gw_excel-kpein = gs_excel_t-VALUE. when7. Gw_excel-lifab = gs_excel_t-VALUE. when8.*GW_EXCEL-NORBM = gs_excel_t-value.GW_EXCEL-LIFBI = gs_excel_t-VALUE. when9. Gw_excel-mwskz = gs_excel_t-VALUE. When OTHERS. Endcase. at END ofROW. APPENDGw_excel toGt_excel. ENDAT. Endloop.
This piece can be optimized, according to the actual situation to
Download the Magic Board, upload Excel