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 internal table upload 'ALSM_EXCEL_TO_INTERNAL_TABLE' issue

Former Member
0 Kudos
1,143

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
Read only

jitendra_it
Active Contributor
0 Kudos
443

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
Read only

Former Member
0 Kudos
443

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

Rob

Read only

Former Member
0 Kudos
443

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..

Read only

jitendra_it
Active Contributor
0 Kudos
444

Hi,

Please check below link. surely it will help u.

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

Thanks

Jitendra

Read only

0 Kudos
443

Thanks! Appreciate your help

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

Read only

0 Kudos
443

This message was moderated.

Read only

Former Member
0 Kudos
443

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