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.

Related Articles

Background to the SAPTalk application
SapTALK User Messaging service
Example SAPTalk Screens
SAPTalk create screen 0100 with the following elements (see below screen shots for layout):
Create function module Z_SEND_MESSAGE
Create function module Z_ENQUE_SLEEP
Creation of GUI Status FEEDBACK
Creation of GUI Status 'MESS'
Creation of GUI Status 'OPTIONS'
Creation GUI Status 'ULIST'
SAPTalk - MSM messenger application for SAP
Code listings for SAPTALK includes
Code listing for ZSAPTALKF01(include)
Code listing for ZSAPTALKI01(include)
Code listing for ZSAPTALKO01(include)
SAPTalk selection screen parameters
Code listing for ZSAPTALKTOP(include)



SAPTALK - table creation
ZMESS: Function group creation details
Code listings for SAPLZMESS(fgroup)
Code listings for SAPLZMESS includes
SAPLZMESS(fgroup ZMESS) - Screen creation
SapTALK: Report creation details
Code listing for SAPTALK
SAPTALK - Include creation
SAPTALK - Screen creation
SAPTALK - GUI Status creation
SAPTALK - GUI Title creation
SapTALK - Transaction creation
Create SAPTalk SAP tables
Create table ZMESSFRIENDS
Create table ZMESSOPTIONS
Create table ZMESSTAB
SAPLZMESS(fgroup)- Function module creation
Message Class and messages
SAPTalk Parameter ID's
SAPTAlk clearup tranasction code