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: 

Excel to internal table upload 'ALSM_EXCEL_TO_INTERNAL_TABLE' issue

Former Member
0 Kudos
978

I am using ALSM_EXCEL_TO_INTERNAL_TABLE function module to upload the excel into an internal table. In case there is a column with no data. This function module is still populating the previous row data into the internal table

Ex. if the Excel has data like the below 3 rows and 3 columns

1 10 5.0

20

2 6.0

The internal table is posting data like this

1 10 5.0

1 20 5.0

2 20 6.0

Please tell me if i am missing something to be added in the below snip of code

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = p_file

I_BEGIN_COL = B1

I_BEGIN_ROW = C1

I_END_COL = B2

I_END_ROW = C2

TABLES

INTERN = IT_upload

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

IF SY-SUBRC = 0.

ENDIF.

LOOP AT IT_upload.

CASE IT_Upload-COL.

WHEN 1.

IT_Excel-BILLCO = IT_Upload-VALUE.

WHEN 2.

IT_Excel-PONUM = IT_Upload-VALUE.

WHEN 3.

CLEAR v_upload.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = IT_upload-value

IMPORTING

OUTPUT = v_upload.

IT_Excel-STORENUM = v_upload.

WHEN 4.

IT_Excel-VINVNUM = IT_Upload-VALUE.

WHEN 5.

IT_Excel-LINEITNUM = IT_Upload-VALUE.

WHEN 6.

IT_Excel-LINEITAMT = IT_upload-VALUE.

WHEN 7.

IT_Excel-TAXAMT = IT_upload-VALUE.

WHEN 8.

IT_Excel-TOTAL = IT_upload-VALUE.

ENDCASE.

AT END OF ROW.

APPEND IT_Excel.

ENDAT.

ENDLOOP.

1 ACCEPTED SOLUTION

jitendra_it
Active Contributor
0 Kudos
278

Hi,

Please check below link. surely it will help u.

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105

Thanks

Jitendra

6 REPLIES 6

Former Member
0 Kudos
278

You have to clear your work area at each loop pass.

Rob

Former Member
0 Kudos
278

Hi,

Clear IT_EXCEL after append the records. see the below code



AT END OF ROW.
APPEND IT_Excel.
clear it_excel.
ENDAT.

Regards,

Dhina..

jitendra_it
Active Contributor
0 Kudos
279

Hi,

Please check below link. surely it will help u.

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105

Thanks

Jitendra

0 Kudos
278

Thanks! Appreciate your help

Edited by: kiransap123 on Jun 1, 2011 4:59 PM

0 Kudos
278

This message was moderated.

Former Member
0 Kudos
278

I don't see the points flag displaying for this post. Please advice how to give points