Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to give message when files are transfered..Thank you

Hi members,

Need some help in completing this code. Thank you.

I have program which writes files on application server, Please let me know how can I give messages on sucefull completion or failure of data transfer.

IF p_Unix = X.

open dataset w_fname for output in text mode encoding default.

loop at itab into wa.

transfer wa to w_fname.

endloop.

Elseif p_desktop = X.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = local_file

filetype = 'ASC'

TABLES

data_tab = itab

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7.

endif.

Please help me creating messages, eg : X number of records are transfered / No files were transfered.

Also please note that, BY default it is unix and will be running as back ground job.

Thank You

Tags:
replied

Something like this?

IF p_Unix = X.

open dataset w_fname for output in text mode encoding default.
loop at itab into wa. 
transfer wa to w_fname.
endloop. 
close dataset w_fname.

Elseif p_desktop = X.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = local_file
filetype = 'ASC'
TABLES
data_tab = itab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7.

endif.

if sy-subrc <> 0.
 message e001(00) with "File was not transfered successfully".
else.
data: lines(5) type c.
data: message type char40.
lines = lines( itab ).

concatenate lines ' rows were transferred successsfully' into message.
message e001(00) with message.

endif.




Regards,

Rich Heilman

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question