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: 

Doubt in FM - 'ALSM_EXCEL_TO_INTERNAL_TABLE'

Former Member
0 Kudos

Hi ,

I am using the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' to upload a excel sheet.

The Excel sheet has a header line also.

The excel sheet may contain no data for few of the fields.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = P_FILE

I_BEGIN_COL = 1

I_BEGIN_ROW = 1

I_END_COL = 60

I_END_ROW = 100

TABLES

INTERN = I_DATA

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

if there is no data in that particular column , the internal table doesnt have the info for that particular field.

For ex. if ROW 1 ,COL 3 doesnt contain data :

I_DATA-ROW = '001'.

I_DATA-COL = '001'.

I_DATA-ROW = '001'.

I_DATA-COL = '002'.

I_DATA-ROW = '001'.

I_DATA-COL = '004'.

But i need that column also included in the internal table.

How to do this.

Vikki,

2 REPLIES 2

Former Member
0 Kudos

Hi,

Use this FM,

This FM will internally call the FM: 'ALSM_EXCEL_TO_INTERNAL_TABLE'

CALL FUNCTION 'FAA_FILE_UPLOAD_EXCEL'

EXPORTING

i_filename = p_input

i_delimiter = gc_tab (Horizontal tab cl_..)

TABLES

et_filecontent = gt_rec

EXCEPTIONS

error_accessing_file = 1

OTHERS = 2.

IF sy-subrc NE 0.

  • Input file could not be read

MESSAGE s001 WITH text-s02.

flg_error = gc_x. " X

EXIT.

Later the data can be split at the delimiter...

Regards

Shiva

0 Kudos

can we insert the missing records in the I_DATA table?

vikki.