How to upload an excel file into SAP internal tables

Excel file   Selection-Screen   Parameter to get excel file destination.   Result:     Codes:   ** Job: Upload from excel into internal table.. report  zfile_upload_from_excel. type-pools truxs. parameter p_excel type rlgrap–filename                default ‘C:EXCEL_EXAMPLE.xls’             obligatory. * Excel Structure types: begin of itab,        val1 type string,        val2 type string,        val3 type string,        end of itab. data : lt_itab type standard table of itab,        ls_itab type itab,        it_type type truxs_t_text_data. * Getting Excel File Destination at selection-screen     on value-request for p_excel. call function ‘F4_FILENAME’  exporting   field_name    = ‘P_EXCEL’  importing   file_name     = p_excel. start-of-selection. * Converting Excel File call function ‘TEXT_CONVERT_XLS_TO_SAP’  exporting   i_tab_raw_data       = it_type   i_filename           = p_excel  tables   i_tab_converted_data = lt_itab[]. end-of-selection. loop at lt_itab into ls_itab.   write:/ ls_itab–val1.   write space.   write ls_itab–val2.   write space.   write ls_itab–val3.… Continue reading How to upload an excel file into SAP internal tables

Uploading file under AL11 directory

Import Parameters:   Codes:   *&———————————————————————* *& Report  ZANIL *& *&———————————————————————* *& *& *&———————————————————————* report  zanil. * Job: uploading files(pdf, xlsx, txt, docx, png) *      from local pc to under AL11 directory.. * 1. Data data  p_upload     type rlgrap–filename. data  ld_file      type char255. data  filename     type authb–filename . data  activity(20) value ‘WRITE’. data  lv_extension type char10. data  lv_val1      type string. data  lv_val2      type string. data  length       like sy–tabix. data  lengthn      like sy–tabix. data  gui_xstring  type xstring. data: begin of itab occurs 0,       field(256),       end of itab. data lt_itab like table of itab. data ls_itab like line of  itab. * 2. Parameters parameters: p_fname type string                     obligatory. parameters: p_fnamc type authb–filename             default ‘e:usrsapdata’             obligatory. start–of–selection. * 3. Getting file source destination… call function ‘/SAPDMC/LSM_F4_FRONTEND_FILE’   changing     pathfile         = p_upload   exceptions     canceled_by_user = 1     system_error     = 2     others           = 3. ld_file = p_upload. if ld_file is initial.    message ‘No file selected!’ type ‘W’.    exit. endif. * 4. Getting file extension… call function ‘TRINT_FILE_GET_EXTENSION’  exporting    filename        = ld_file… Continue reading Uploading file under AL11 directory