Application Development 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: 

ALSM_EXCEL_TO_INTERNAL_TABLE not taking null values

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

milusai
Participant
0 Kudos

Try for FM TEXT_CONVERT_XLS_TO_SAP

9 REPLIES 9

milusai
Participant
0 Kudos

Try for FM TEXT_CONVERT_XLS_TO_SAP

Former Member
0 Kudos

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

0 Kudos

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

.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

Hi,

But I am using the FM F4_filename to get the excel file.

Would this would not be compatible with GUI_UPLOAD.

Thanks

Former Member
0 Kudos

Hi,

Make the columns which can have null values 'TEXT' in the excel sheet.

Else you can try FM 'GUI_UPLOAD'.

Regards,

Rajat

Former Member
0 Kudos

use dummy values like '#' or whatever and fill the null fields with it. later u can replace them

Former Member
0 Kudos

I thank you all for your answers.

I used a combination of GUI_UPLOAD and TEXT_CONVERT_XL_TO_SAP.

Thank you again.

Vipin