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: 

delete first 2 rows of a file

Former Member
0 Kudos

Hi Experts,

In an interface i'm uploading a spread sheet data into the program's internal table. I dont want the first 2 rows of the spreadsheet in the internal table as they are just the headings.

plz advise me.

thank you.

venu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi Venu,

you can use

delete itab index 1.

delete itab index 2.

or

delete itab index : 1 , 2 .

regards

satesh

6 REPLIES 6

Former Member
0 Kudos

hi Venu,

you can use

delete itab index 1.

delete itab index 2.

or

delete itab index : 1 , 2 .

regards

satesh

former_member186741
Active Contributor
0 Kudos

instead of deleting them you could just ignore them in your loop:

loop at itab.

check sy-tabix > 2.

*blah blah blah....

*process goes here

endloop.

0 Kudos

data: begin of itab occurs 0,

name1 type c,

name2 type c,

..............

..........

..........

..........

end of itab.

data: t_filedata like alsmex_tabline occurs 0 with header line.

start-of-selection.

clear itab.

refresh itab.

*---Upload Spreadsheet.

perform read_file using p_xlfile.

*---Process data into formatted internal table.

perform format_data.

.................

............

form read_file using p_filename like rlgrap-filename.

*---Upload spreadsheet.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = p_filename

I_BEGIN_COL = 1

I_BEGIN_ROW = 1

I_END_COL = 256

I_END_ROW = 65536

TABLES

INTERN = t_filedata

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3

.

IF t_filedata[] is initial.

message i009 with 'NO DATA FOUND IN FILE' p_filename.

stop.

ENDIF.

sort t_filedata by row col.

endform. "READ_FILE

form format_data.

data: l_index type i.

field-symbols: <fs1>.

loop at t_filedata.

can i write that like this, here?????????

1method:

-


<b>delete t_filedata index 1.

delete t_filedata index 2.</b>

2nd method:

-


or

<b>check sy-tabix > 2.</b>

l_index = t_filedata-col.

assign component l_index of structure t_sheet to <fs1>.

<fs1> = t_filedata-value.

at end of row.

append itab.

clear itab.

endat.

endloop.

refresh t_filedata.

free t_filedata.

endform. "FORMAT_DATA

Message was edited by: venu gopal

0 Kudos

Assign

I_BEGIN_ROW = 3

This will start loading data from the 3rd row of the file. This way you do not have to delete any entries from internal table.

0 Kudos

hi ashish,

can u pls tell I_BEGIN_ROW in which fn module??

thanks and regards

hyma

0 Kudos
---Upload spreadsheet.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_filename
I_BEGIN_COL = 1
I_BEGIN_ROW = <b>3</b>
I_END_COL = 256
I_END_ROW = 65536
TABLES
INTERN = t_filedata
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.

You can get data from 3rd row of the excel file.

or else you can

delete itab index 1.
                delete itab index 2.

Regards

vijay