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: 

Upload excel file

Former Member
0 Kudos

Hi All,

I have a upload of data scenario whereby i will be using a bapi program to upload the data in the excel sheet to the SAP system.

This is the scenario:-

The excel sheet has 30,000 lines. I am supposed to upload in batches of 30 lines per document number.

How do code the program to read in batches of 30 lines? Which means, i upload the whole file of 30,000 lines and allow the program to upload accordingly.

Appreciate any help. Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Charlene..

Sorry the syntax for APPEND LINES.. is:

APPEND LINES OF itab1 FROM 1 TO 30 TO itab2.

Make sure you load the file in one shot, do not try to load it from the workstation in chunks.. this will make very bad impact on the performance.

Thanks and Best Regards,

Vikas Bittera.

**Points for useful answers**

4 REPLIES 4

Former Member
0 Kudos

Hi!

Use ALSM_EXCEL_TO_INTERNAL_TABLE fm, and its BEGIN_ROW and END_ROW parameters.

Increment them by 30 for a new segment to read.

Regards

Tamá

Former Member
0 Kudos

Hi Charlene..

You can use the below logic.. If your table has the records already sorted so that u just need to break them in chunks of 30..

1) Load the complete file in an internal table say itab1.

2) Declare another table itab2 similar to itab1.

2) WHILE itab1[] IS NOT INITIAL.

APPEND LINES OF itab1 TO itab2 FROM 1 TO 30.

**Do ur processing on the 30 line**

DELETE itab1 FROM 1 TO 30.

ENDWHILE.

Thanks and Best Regards,

Vikas Bittera.

**Points for useful answers**

Former Member
0 Kudos

Hi Charlene..

Sorry the syntax for APPEND LINES.. is:

APPEND LINES OF itab1 FROM 1 TO 30 TO itab2.

Make sure you load the file in one shot, do not try to load it from the workstation in chunks.. this will make very bad impact on the performance.

Thanks and Best Regards,

Vikas Bittera.

**Points for useful answers**

Former Member
0 Kudos

Thanks to Tamás for giving your suggestion solution.

Also, thanks to Vikas Bittera for helping me solve the problem.

Have a good day!