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: 

error while uploading data to ztable from excel file

Former Member
0 Kudos

Hi,

I have a requirement where i have to upload data from excel file to ztable.I have used the fm 'ALSM_EXCEL_TO_INTERNAL_TABLE' for reading the excel file.After reading the excel file i have used INSERT zrb_hdr from table t_zrb_hdr for updating the ztable with data .

here it is giving error as the data base table zrb_hdr and the internal table t_zrb_hdr should be declared of same type .

I got this error b'coz i have changed the date and time fields in t_zrb_hdr table to char type.so the structure of zrb_hdr and t_zrb_hdr are not same.If i don't change the date and time fields,in the o/p i am not getting proper date and time formats.

now how can i upload data into ztable?

7 REPLIES 7

Former Member
0 Kudos

create one more itab with same structure as that of your z table...

in the existing table change date and time acc. to your need...then move entire data from this itab to new itab..

pass this itab to 'ALSM_EXCEL_TO_INTERNAL_TABLE'

0 Kudos

hi,

How can i move the entire data from old internal table to new internal table?

former_member223537
Active Contributor
0 Kudos

Hi,

Data : itab type standard table of ZTABLE.

INSERT INTO ZTABLE from table ITAB.

Itab here is declared as ZTABLE.

Former Member
0 Kudos

Hi hema,

declare t_zrb_hdr of the type of your Ztable.

loop at values read from xls and populate t_zrb_hdr .

former_member223537
Active Contributor
0 Kudos
loop at itab_old.
MOVE-CORRESPONDING itab_old to itab_new.
append itab_new.
endloop.

former_member194152
Contributor
0 Kudos

hi,

for copying internal table use.

append lines of itab_old to utab_new.

Regards

Gagan

Former Member
0 Kudos

Hi,

Try this.

Data: itab type standard table of ztable,

wa_itab type ztable.

loop at t_zrb_hdr into wa_t_zrb_hdr.

wa_itab-date = wa_t_zrb_hdr-date.

wa_itab-time = wa_t_zrb_hdr-time.

like move all the fiedl to wa_itab...........

append itab with wa_itab.

Endloop.

now insert the records from itab to the database table ztable.

Thanks,

Muthu.