Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Excel into Table

Former Member
0 Likes
514

Hi Guys!..

Thanks for all your support till now and now i am again in need of all ur help!..

My issue : I have a Excel file which is not of a defined structure . I displayed it on the container directly using



   call method c_oi_container_control_creator=>get_container_control
     importing
       control = gc_control
       error   = gc_error.

   call method gc_control->init_control
     exporting
       r3_application_name = 'EXCEL CONTAINER'
       inplace_enabled     = 'X'
       parent              = gc_cont230
     importing
       error               = gc_error.


   call method gc_control->get_document_proxy
     exporting
       document_type  = soi_doctype_excel_sheet
     importing
       document_proxy = gc_document
       error          = gc_error.

   call method gc_document->open_document
     exporting
       document_title = gs_mccext-zdesc
       document_url   = gs_mccext-path
       open_inplace   = 'X'
     importing
       error          = gc_error.

   call method gc_document->get_spreadsheet_interface
     exporting
       no_flush        = ' '
     importing
       error           = gc_error
       sheet_interface = gc_spreadsheet.

   call method gc_spreadsheet->get_sheets
     exporting
       no_flush = ' '
     importing
       sheets   = gt_sheets
       error    = gc_error.

Till here its fine .. however when ever i am displaying it it pops up a window that the format ~SAP{ }.tmp is in a different format than specified by the file extension... and gives a option YES or NO .. once i go for YES .. the excel file is displayed..

HOW CAN I REMOVE THIS POP-UP ?

The other senario is ...

That i should not display the excel in container ,...however i need to read the values in the excel ...i could able to achieve this tooo however the pop-up is giving me the problem ...

Could you all please help me in resolving this issue...

Thanks and Regards

Chandu Reddy Sunkari

Edited by: chandu reddy sunkari on Sep 1, 2009 1:29 PM

Edited by: chandu reddy sunkari on Sep 1, 2009 2:09 PM

2 REPLIES 2
Read only

Former Member
0 Likes
470

Hi,

Check out the below FM:

ALSM_EXCEL_TO_INTERNAL_TABLE

FAA_FILE_UPLOAD_EXCEL

They will upload the data into internal table with the separator specified. Hence you can later split the string at the separator(into an internal table) and process in your report.

Regards

Shiva

Read only

Former Member
0 Likes
470

Hi,

Refer to the given code:

DATA: lv_filetype(10) TYPE c,

lv_gui_sep TYPE c,

lv_file_name TYPE string.

lv_filetype = 'ASC'.

lv_gui_sep = 'X'.

lv_file_name = pa_dfile.

  • FM call to upload file

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = lv_file_name

filetype = lv_filetype

has_field_separator = lv_gui_sep

TABLES

data_tab = gi_zhralcon_file.

and then use data assignment in internal table like:

LOOP AT gi_zhralcon_file INTO wa_zhralcon_file.

wa_zhralcon-zallco = wa_zhralcon_file-zallco.

CONCATENATE wa_zhralcon_file-aedtm+6(4)

wa_zhralcon_file-aedtm+3(2)

wa_zhralcon_file-aedtm(2)

INTO wa_zhralcon-aedtm.

wa_zhralcon-pernr = wa_zhralcon_file-pernr.

wa_zhralcon-zprjcd = wa_zhralcon_file-zprjcd.

wa_zhralcon-zact = wa_zhralcon_file-zact.

CONCATENATE wa_zhralcon_file-begda+6(4)

wa_zhralcon_file-begda+3(2)

wa_zhralcon_file-begda(2)

INTO wa_zhralcon-begda.

CONCATENATE wa_zhralcon_file-endda+6(4)

wa_zhralcon_file-endda+3(2)

wa_zhralcon_file-endda(2)

INTO wa_zhralcon-endda.

wa_zhralcon-zperc = wa_zhralcon_file-zperc.

wa_zhralcon-zrepto = wa_zhralcon_file-zrepto.

wa_zhralcon-zpost = wa_zhralcon_file-zpost.

wa_zhralcon-zrolcd = wa_zhralcon_file-zrolcd.

wa_zhralcon-zallfr = wa_zhralcon_file-zallfr.

wa_zhralcon-zrefno = wa_zhralcon_file-zrefno.

APPEND wa_zhralcon TO gi_zhralcon.

CLEAR wa_zhralcon.

ENDLOOP.

Hope it helps.

Regards,

Rajesh Kumar