report znadar_downthis line-size 255.
tables: dd03l.
* Tabla obligatoria para comparar
tables: anla.
data: aux_tab like anla,
d03 like dd03l occurs 0 with header line.
field-symbols: <f>, <k>.
parameters: tabname like dd02l-tabname,
down as checkbox default 'X',
upl as checkbox default ' '.
data: itab(65534) occurs 0 with header line,
tabread(65534),
di(30), si(30).
end-of-selection.
if down = 'X'.
perform load_data.
perform download_filez.
elseif upl = 'X'.
select * from dd03l into table d03 where tabname = tabname.
perform upload_filez.
loop at itab.
aux_tab = itab.
perform compara_tab.
if sy-subrc ne 0.
write: / 'No econtrado:', aux_tab.
else.
if aux_tab ne tabread.
write: / 'Campos diferentes:', aux_tab.
loop at d03.
concatenate 'aux_tab-' d03-fieldname into si.
concatenate tabname '-' d03-fieldname into di.
assign (si) to <f>.
assign (di) to <k>.
if <f> ne <k>.
write: / 'Campo diferente:', d03-fieldname,
'Fichero:', <f>,
'BBDD:', <k>.
endif.
endloop.
endif.
endif.
endloop.
endif.
form compara_tab.
select single * from anla into tabread
where bukrs = aux_tab-bukrs and
anln1 = aux_tab-anln1 and
anln2 = aux_tab-anln2.
* where belnr = aux_tab-belnr
* and blpos = aux_tab-blpos.
* where bukrs = aux_tab-bukrs
* and hbkid = aux_tab-hbkid.
if tabread is initial.
sy-subrc = 4.
else.
anla = tabread.
endif.
endform.
form load_data.
select * up to 5000 rows
from (tabname) into table itab.
endform.
form upload_filez.
call function 'UPLOAD'
exporting
filetype = 'ASC'
tables
data_tab = itab
exceptions
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7
.
endform.
form download_filez.
call function 'DOWNLOAD'
exporting
filetype = 'ASC'
tables
data_tab = itab.
endform.