Code listing for ZMESSCLEARUP
The below intructions / ABAP code is part of the SAPTAlk Instant messaging program for SAP.
Place the following code list into the program object 'ZMESSCLEARUP'.
*&-------------------------------------------------------------*
*& Report ZMESSCLEARUP *
*& *
*&-------------------------------------------------------------*
*& *
*& *
*&-------------------------------------------------------------*
REPORT ZMESSCLEARUP .
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
DATA: e_file TYPE STRING,
ld_filepath type zmessoptions-filepath.
*parameter: p_fpath(200) type c.
************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
select single filepath
from zmessoptions
into (ld_filepath)
where uname eq sy-uname.
if ld_filepath is initial.
ld_filepath = 'C:\TEMP\CONV\'.
endif.
update zmessoptions set isonline = ' '
where uname eq sy-uname.
************************************************************************
*END-OF-SELECTION.
END-OF-SELECTION.
concatenate sy-uname '*.htm' into it_datatab-row.
concatenate 'del' it_datatab-row into it_datatab-row separated by space.
*it_datatab-row = 'del *.htm'.
append it_datatab.
concatenate ld_filepath 'deletefiles.bat' into e_file.
call function 'GUI_DOWNLOAD'
EXPORTING
filename = e_file
filetype = 'ASC'
TABLES
data_tab = it_datatab[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
others = 3.
DELETE FROM zmesstab where TOUSER eq sy-uname.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
* DOCUMENT = ' '
CD = ld_filepath
* COMMANDLINE = 'del *.htm '
* INFORM = ' '
PROGRAM = 'deletefiles.bat'
* STAT = ' '
* WINID = ' '
* OSMAC_SCRIPT = ' '
* OSMAC_CREATOR = ' '
* WIN16_EXT = ' '
* EXEC_RC = ' '
* IMPORTING
* RBUFF =
* EXCEPTIONS
* FRONTEND_ERROR = 1
* NO_BATCH = 2
* PROG_NOT_FOUND = 3
* ILLEGAL_OPTION = 4
* GUI_REFUSE_EXECUTE = 5
* OTHERS = 6
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
|