report z. types: t_file(255) type c, t_inf(65535) type c, t_it type t_inf occurs 0. ************************************************************************ parameters: pcfile like rlgrap-filename default 'c:\temp\' obligatory lower case, unixfile type t_file default '/tmp/' obligatory lower case, pctounix radiobutton group x, unixtopc radiobutton group x. ************************************************************************ data: it_file type t_it with header line, w_msg(100). ************************************************************************ at selection-screen on value-request for pcfile. call function 'WS_FILENAME_GET' exporting mask = ',*.*,*.*.' importing filename = pcfile exceptions others = 1. if sy-subrc <> 0. message id sy-msgid type 'I' number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. ************************************************************************ end-of-selection. if pctounix = 'X'. perform ws_upload. check sy-subrc = 0. perform write_file. else. perform read_file. check sy-subrc = 0. perform ws_download. endif. check sy-subrc = 0. call function 'WS_MSG' exporting msg_type = 'I' text = 'Completed successfully'. ************************************************************************ form read_file. *--- open UNIX file open dataset unixfile for input in text mode message w_msg. if sy-subrc ne 0. write: / 'Cannot open for reading:', unixfile, w_msg. exit. endif. *--- read UNIX file do. read dataset unixfile into it_file. if sy-subrc = 0. append it_file. else. exit. endif. enddo. *--- close UNIX file close dataset unixfile. endform. ************************************************************************ form write_file. *--- open UNIX file open dataset unixfile for output in text mode message w_msg. if sy-subrc ne 0. write: / 'Cannot open for writing:', unixfile, w_msg. exit. endif. *--- write UNIX file loop at it_file. transfer it_file to unixfile. endloop. *--- close UNIX file close dataset unixfile. endform. ************************************************************************ form ws_upload. call function 'WS_UPLOAD' exporting filename = pcfile filetype = 'ASC' tables data_tab = it_file exceptions others = 1. if sy-subrc <> 0. message id sy-msgid type 'I' number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. endform. ************************************************************************ form ws_download. call function 'WS_DOWNLOAD' exporting filename = pcfile filetype = 'ASC' tables data_tab = it_file exceptions others = 1. if sy-subrc <> 0. message id sy-msgid type 'I' number sy-msgno with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. endif. endform. ************************************************************************