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: 

Help me out working with excel sheet with multiple worksheets, need help

Former Member
0 Kudos
136

Hi Gurus, I got a requirement to uploading the data from Excel sheet with multiple worksheets, i followed the below given process and want to know how to move the data from i_data(contains row, col, and value) into the internal table, I have 4 sheets in my excel file, i am getting the data into i_data for every sheet, but the thing is for each and every sheet i will have roughly 50 to 60 fields, please suggest me in this regards. After moving the data into the internal tables, i have to build BAPI structure which i have to pass to the BAPI BAPI_SALESORDER_CREATEFROMDAT2 PLease suggest me of how to build the internal to pass the data. Code as follows : In the code i have taken only few fields(6) in the structure .

4 REPLIES 4

Sm1tje
Active Contributor
0 Kudos
95

But what is the actual problem here? You already have uploaded the data into your internal table. In this table the data is sorted in rows. So first create a new internal table with all the fields (columns) from your i_data. Move the data from this i_data to the new internal table.

Now loop at this internal table and move the data into the structures / internal tables corresponding to the ones mentioned in the BAPI interface.

Again, I don't quite see what the problem seems to be.

1. Don't you know how to create an internal table based on the columns from i_data?

2. Don't you know how to define all these structures / itabs from BAPI interface?

3. Don't you know the mapping of the input onto the structures / itabs for BAPI interface?

4. Or....???

Code as follows : In the code i have taken only few fields(6) in the structure

I don't see any code. Did you forgot to post it, or are you referring to something else.

Former Member
0 Kudos
95

In the excel sheet i will have 80 fields in each and every worksheets, as you are telling to move the data with respect to row no and column, the case is i can move the data by checking the row no and column no., since the loop repeates for all the rows and columns, the performance wise that would be worst code,

I am asking the code without checking the row no. and column no.

Regards,

C.Bharath Kumar

Sm1tje
Active Contributor
0 Kudos
95

1. This is the format you have to work with, no way of getting around that.

2. This is an internal table, processing won't take that long at all. Or are you uploading a very huge amount of data? Otherwise, just go ahead.

Former Member
0 Kudos
95

Hi,

As you are asking for the amount of data, i too don't of how many records that the user is going to maintain in the excel sheet, also i have 4 sheets in a single excel file,

if i move the data with respect to column and row no, for each and every i have to repeat the loop like for 60 fields, the loop should repeat for 60 fields and to all the sheets, this itself reduces the performance of the program.

I am in need of some better solution to give the quality based report in migrating the data.

given the sample code as follows :

loop at i_sheets into wa_sheets.

LOOP AT i_data INTO wa_data.

IF lv_row NE wa_data-row.

COLLECT wa_data1 INTO it_data.

MOVE wa_data-row TO lv_row.

CLEAR wa_data1.

ENDIF.

IF wa_sheets-sheet_name = 'Sheet1'.

IF wa_data-row GE 1 AND wa_data-column = 1.

wa_data1-name = wa_data-value.

ELSEIF wa_data-row GE 1 AND wa_data-column = 2.

wa_data1-name1 = wa_data-value.

ELSEIF wa_data-row GE 1 AND wa_data-column = 3.

wa_data1-name2 = wa_data-value.

ELSEIF wa_data-row GE 1 AND wa_data-column = 4.

wa_data1-type = wa_data-value.

ELSEIF wa_data-row GE 1 AND wa_data-column = 5.

wa_data1-name3 = wa_data-value.

ELSEIF wa_data-row GE 1 AND wa_data-column = 6.

wa_data1-name4 = wa_data-value.

endloop.

endloop

Tthis is written only for some 6 fields in the internal table, looking for some better solution for moving the data into an internal table other the above written code for all the fields.

Regards,

C.Bharath Kumar