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 to Itab

Former Member
0 Likes
1,194

Experts,

I have an issue with excel upload. I am uploading excel which has a field of length 70. But the FM ALSM_EXCEL_TO_INTERNAL_TABLE has max field length as 50. So is tehre any other way to do this? please help..

Experts,

I have an issue with excel upload. I am uploading excel which has a field of length 70. But the FM ALSM_EXCEL_TO_INTERNAL_TABLE has max field length as 50. So is tehre any other way to do this? please help..

7 REPLIES 7
Read only

Former Member
0 Likes
1,145

Hi Friend,

I hope the best way to upload the excel file is to save the file to save it in .CSV format and use GUI_UPLOAD function module to upload the file to itab. Here the field seperatos would be " , " .

I hope this will solve your problem.

NOTE: .CSV file can be created by below mentioned steps.

1).open the excel file.

2). Click on save as button in file menu.

3). In the save dialog box opening, save the file as <filename>.csv . In the file format drop down select (all files . )

4). Now use the FM "GUI_UPLOAD" to move the data from the file to itab.

Significance of this is you can use MS-Excel to create the file but need not worry about number of rows you have or the length of each column.

Please let me know for any questions.

Regards,

Praveenkumar T.

Read only

Former Member
0 Likes
1,145

Hi,

check these links and FMs

'GUI_UPLOAD'

TEXT_CONVERT_XLS_TO_SAP

'KCD_EXCEL_OLE_TO_INT_CONVERT'

<link farm removed>

Edited by: Suhas Saha on Feb 20, 2012 1:06 PM

Read only

Former Member
0 Likes
1,145

HI ,

Split the field length ( two having less than 50 ) and try to upload then concatenate these two.

Regards,

Sijin K P.

Read only

Former Member
0 Likes
1,145

Hi,

Check the bellow link as per your requirement.

Regards,

Goutam Kolluru.

Read only

Former Member
0 Likes
1,145

Hi,

Use Function Module TEXT_CONVERT_XLS_TO_SAP to upload data from excel to itab.

See the example code how to dupload data from excel to itab.


DATA: i_bill TYPE TABLE OF t_bill,                    
      i_bill_line TYPE t_bill.
SELECTION-SCREEN: BEGIN OF BLOCK input WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE rlgrap-filename.
SELECTION-SCREEN: END OF BLOCK input.
DATA: i_tab_raw_data TYPE truxs_t_text_data.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file. 
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    CHANGING
      file_name = p_file.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
      i_tab_raw_data       = i_tab_raw_data
      i_filename           = p_file
    TABLES
      i_tab_converted_data = i_bill    
EXCEPTIONS
      conversion_failed    = 1
      OTHERS               = 2.
  IF sy-subrc <> 0.
    MESSAGE 'Error while uploading data from excel file' TYPE 'E'.
  ENDIF.

If any problem revert back.

Regards,

Supriya.

Read only

ThomasZloch
Active Contributor
0 Likes
1,145

What this FM does is quite straightforward, you should be able to copy it into the Z-namespace and adjust it to allow longer field lengths, namely by copying and adjusting structure ALSMEX_TABLINE.

Thomas

Read only

Former Member
0 Likes
1,145

This message was moderated.