09-24-2008 1:27 PM
Hi,
I am uploading data from my excel sheet to an internal table. For this purpose i have used ALSM_EXCEL_TO_INTERNAL_TABLE.
The problem with this FM is that it does not consider the blank spaces.
for e.g if there is an Excel sheet with the following data
Name Age
ABC 10
DEF 15
blank blank
XYZ 20
The internal table stores it as
row-001 col-001 value - ABC ; row-001 col-001 value - 10
row-002 col-001 value - DEF ; row-002 col-001 value - 15
row-004 col-001 value - XYZ ; row-004 col-001 value - 20
But i need the blank values as well i.e. values in row3.
Is there a work around for this?
Thank You
Vipin Rajan
09-24-2008 1:29 PM
09-24-2008 1:29 PM
09-24-2008 2:18 PM
Hi Milind,
thanks for your answer but the FM TEXT_CONVERT_XLS_TO_SAP considers only those fields that have the attribute text and not numeric values.
Thanks
Vipin
09-26-2008 9:59 AM
Please refer to the following code:
TYPE-POOLS : truxs.
TYPES : BEGIN OF ty_data,
numeric TYPE i,
char(10) TYPE c,
END OF ty_data.
data : var TYPE TRUXS_T_TEXT_DATA.
Data : itab TYPE TABLE OF ty_data,
file TYPE RLGRAP-FILENAME VALUE 'C:\Documents and Settings\Tec\Desktop\data.xls'.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
i_tab_raw_data = var
i_filename = file
tables
i_tab_converted_data = itab
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
.
09-24-2008 1:32 PM
Hi
If the total row is empty, I think it will skip it... So, give some dummy values for the present and later you can replace them.
Instead even if you give anything in the last column of the row also it will pick that row.
But empty row I am not sure.
Regards,
Vishwa.
09-24-2008 1:36 PM
Hi Vipin,
Use 'GUI_UPLOAD' Function module.
The Input Parameter READ_BY_LINE should be 'X'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = Filename
FILETYPE = 'ASC'
HEADER_LENGTH = 0
READ_BY_LINE = 'X' " Important
REPLACEMENT = '#'
TABLES
DATA_TAB = data_tab.
Cheers,
Kothand
09-24-2008 2:08 PM
Hi,
But I am using the FM F4_filename to get the excel file.
Would this would not be compatible with GUI_UPLOAD.
Thanks
09-24-2008 2:12 PM
Hi,
Make the columns which can have null values 'TEXT' in the excel sheet.
Else you can try FM 'GUI_UPLOAD'.
Regards,
Rajat
09-24-2008 4:13 PM
use dummy values like '#' or whatever and fill the null fields with it. later u can replace them
09-29-2008 11:12 AM
I thank you all for your answers.
I used a combination of GUI_UPLOAD and TEXT_CONVERT_XL_TO_SAP.
Thank you again.
Vipin