Code listing for ZSAPTALKI01(include)
The below ABAP code is part of the SAPTAlk Instant messaging program for SAP.
*INCLUDE ZSAPTALKI01 *--------------------------------------------------------------* ***INCLUDE ZMESSANGERI01 . *--------------------------------------------------------------* *&-------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&-------------------------------------------------------------* * text *--------------------------------------------------------------* MODULE USER_COMMAND_0100 INPUT. DATA: return TYPE REF TO cl_gui_event, ld_output LIKE btcxpm OCCURS 0 WITH HEADER LINE. * save_ok = ok_code. case ok_code. when 'EXIT' or 'BACK' or 'CANC'. * Exit program update zmessoptions set talkingto = ' ' where UNAME eq sy-uname. * call clearup program to remove all created conversation files, * also stops any refresh processing instantly if not gd_talkingto is initial. * call clearup tranasction (leave to trans...) perform recall_transaction using 'C'. else. leave to screen 0. endif. when 'OPT'. "display users options/settings leave to screen 200. when 'FCT_R'. "RFC/refresh process * automatic refresh of conversation window if gd_task le 40. "changed from 10 perform update_conversation using gd_talkingto 'X'. else. * maximum screen calls reached!!! recall transaction to reset clear gd_task. SET PARAMETER ID 'ZMESS' field p_friend. "rememebr current opts * recall tranasction (leave to trans...) perform recall_transaction using 'X'. endif. when 'BSEND'. "send message to user if gd_talkingto is initial. * no user has be selected for conversation message i000(zumess) with 'Please select a user to talk to!'. else. * set RFC/refresh process flag to stop while message is input perform update_conversation using gd_talkingto 'S'. if sy-xcode ne 'FCT_R'. * Display popup via function module to allow user to input * message text. CALL FUNCTION 'Z_SEND_MESSAGE' IMPORTING MESSAGE = SC_MESSAGE EXCEPTIONS CANCELED = 1 OTHERS = 2. IF SY-SUBRC EQ 0. * populate message table with message perform populate_table using gd_talkingto sy-uname SC_MESSAGE. * set flag to restart refesh functionality clear: gd_stoprfc. SET PARAMETER ID 'ZMESSAGE' field gd_stoprfc. * send popup mess if user is logged into SAP but not saptalk perform send_popup_message_if_required. perform update_conversation using gd_talkingto 'X'. ENDIF. clear: gd_stoprfc. SET PARAMETER ID 'ZMESSAGE' field gd_stoprfc. else. * RFC(refresh process) and online process have got mixed up, * reset by recalling transaction, Will lose users current input! ok_code = 'BSEND'. * recall tranasction (leave to trans...) perform recall_transaction using 'X'. endif. endif. when 'FEED'. "display feedback information if sy-xcode ne 'FCT_R'. CALL SCREEN 150 STARTING AT 10 10 ENDING AT 100 25. else. ok_code = ' '. perform recall_transaction using 'X'. endif. when others. "there are no others but here it is anyway * call method cl_gui_cfw=>get_current_event_object * receiving * event_object = return. * call method cl_gui_cfw=>dispatch. endcase. CLEAR ok_code. CALL METHOD cl_gui_cfw=>flush. ENDMODULE. " USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0150 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE USER_COMMAND_0150 INPUT. save_ok = ok_code. case ok_code. when 'EXIT' or 'BACK' or 'CANC'. leave to screen 0. endcase. ENDMODULE. " USER_COMMAND_0150 INPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0200 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE USER_COMMAND_0200 INPUT. save_ok = ok_code. case ok_code. when 'EXIT' or 'BACK' or 'CANC'. leave to screen 100. when 'SAVE' or 'OPT'. wa_messopt-uname = sy-uname. wa_messopt-disname = sc200_disnam. wa_messopt-filepath = sc200_filepath. modify zmessoptions from wa_messopt. gd_filepath = sc200_filepath. concatenate gd_filepath sy-uname into doc_url. endcase. ENDMODULE. " USER_COMMAND_0200 INPUT
Related Articles
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 ZSAPTALKO01(include)
SAPTalk selection screen parameters
Code listing for ZSAPTALKTOP(include)
SAPTALK - table creation
Code listing for ZMESSCLEARUP
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