Skip to Content
0
Former Member
Jun 06, 2014 at 07:46 AM

upload excel to ztable how to deleting specs. lines

64 Views

hi experts

ım usıng TEXT_CONVERT_XLS_TO_SAP' to upload excel file to ztable.

in my codes ı need to delete line depend some conditions before upload to final table.

when ı execute the program its just upload my excel file to it_datatab

after that with loopin it_datatab to wa_datatab ıt starts to upload to ztable.

ı have to delete some lines when ıt upload to it_datatab.

how can ı delete lines from it_datatab depend some conditions?

any help will be apprciated..

thank u

here is my code:

tables : zmahsup_imei, mara .

type-pools: truxs.

parameters: p_file type rlgrap-filename.

types: begin of t_datatab,

col1 type gernr,

col2 type mara-normt,

col3 type zmahsup_imei-dmbtr,

col4 type zmahsup_imei-waers,

end of t_datatab.

data: it_datatab type standard table of t_datatab,

wa_datatab type t_datatab.

data: it_raw type truxs_t_text_data.

* At selection screen

at selection-screen on value-request for p_file.

call function 'F4_FILENAME'

exporting

field_name = 'P_FILE'

importing

file_name = p_file.

***********************************************************************

*START-OF-SELECTION.

start-of-selection.

call function 'TEXT_CONVERT_XLS_TO_SAP'

exporting

* I_FIELD_SEPERATOR =

i_line_header = 'X'

i_tab_raw_data = it_raw " WORK TABLE

i_filename = p_file

tables

i_tab_converted_data = it_datatab[] "ACTUAL DATA

exceptions

conversion_failed = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

***********************************************************************

* END-OF-SELECTION.

end-of-selection.

break-point.

loop at it_datatab into wa_datatab.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = wa_datatab-col1

importing

output = wa_datatab-col1

.

zmahsup_imei-imei = wa_datatab-col1.

zmahsup_imei-normt = wa_datatab-col2.

zmahsup_imei-dmbtr = wa_datatab-col3.

zmahsup_imei-waers = wa_datatab-col4.

insert zmahsup_imei.

endloop.

break-point.

if sy-subrc = 0 .

commit work and wait.

message 'Dosya yükleme işlemi başarı ile tamamlanmıştır' type 'I'.

else.

message 'Dosya yükleme işlemi sırasında hata oluştur,excel dosyasını kontrol ediniz' type 'E'.

endif.