Messaging th_popup with the capability to detect who is online (protoype)

Ever wanted to send  message and checking your friends online on that particular day?

The coding below is a prototype which only detect on a particular day the system user online but not the time which needs to be enhanced.

Which uses the search help technology which is similar to matchcode.

-----------------------------------------------------------------------------------------------
REPORT Z_send_message.

PARAMETERS CLIENT   LIKE  SY-MANDT.
PARAMETERS USER     LIKE  SY-UNAME.
PARAMETERS MESSAGE  LIKE  SM04DIC-POPUPMSG.
PARAMETERS MSG_LEN  LIKE  SY-INDEX."MESSAGE_LEN  LIKE  SY-INDEX.
PARAMETERS CUT_BLKS LIKE  SY-LANGU."CUT_BLANKS LIKE  SY-LANGU.

INITIALIZATION.

CLIENT   =  SY-MANDT.
USER     =  SY-UNAME.
MESSAGE  =  'TYPE your message here'.
MSG_LEN  =  SY-INDEX."MESSAGE_LEN  LIKE  SY-INDEX.
CUT_BLKS =  SY-LANGU."CUT_BLANKS LIKE  SY-LANGU.

at selection-screen on value-request for  USER.
  PERFORM F_SEARCHHELP.

START-OF-SELECTION.
      CALL FUNCTION 'TH_POPUP'
        EXPORTING
          CLIENT               CLIENT
          USER                 USER
          MESSAGE              MESSAGE
*         MESSAGE_LEN          = 0
*         CUT_BLANKS           = ' '
*       EXCEPTIONS
*         USER_NOT_FOUND       = 1
*         OTHERS               = 2
                .
      IF SY-SUBRC <> 0.
*       Implement suitable error handling here
      ENDIF.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*&      Form  F_SEARCHHELP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM F_SEARCHHELP .
TABLESusr02.
data:
     begin of t_BNAME occurs 0,
           BNAME like USR02-BNAME,
           "maktx like makt-maktx,
     end   of t_BNAME,
     t_values type DYNPREAD occurs WITH HEADER LINE,
     v_prog like D020S-PROG.
TYPESBEGIN OF X_RETURN .
        INCLUDE STRUCTURE DDSHRETVAL"Search help structure
TYPESEND OF X_RETURN.
datal_dynpprog       type sy-repid,
      l_dynnr          type sy-dynnr,
      l_dynprofld      TYPE help_info-dynprofld.
dataRETURN_TAB   TYPE STANDARD TABLE OF X_RETURN WITH HEADER LINE.





   v_prog sy-repid.
   REFRESHt_values.
   CLEARt_values.
   t_values-fieldname 'USER'.
   APPEND t_VALUES.
   CALL FUNCTION 'DYNP_VALUES_READ'
     EXPORTING
       dyname                         v_prog
       dynumb                         '1000'
         TRANSLATE_TO_UPPER             ' '
         REQUEST                        ' '
         PERFORM_CONVERSION_EXITS       ' '
         PERFORM_INPUT_CONVERSION       ' '
         DETERMINE_LOOP_INDEX           ' '
     tables
       dynpfields                     t_values.
   IF sy-subrc 0.
      READ TABLE T_VALUES INDEX 1.
      IF SY-SUBRC 0.
          SELECT BNAME FROM usr02 INTO t_BNAME
                     where USTYP 'A' AND
                           TRDAT SY-DATUM.
            APPEND T_BNAME.
          ENDSELECT.
          "==================
                   if sy-subrc 0.
           l_dynpprog sy-repid.
           l_dynnr    sy-dynnr.
           l_dynprofld  'BNAME'  .
             CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
               EXPORTING
                 retfield               'BNAME'
                DYNPPROG               l_dynpprog
                DYNPNR                 l_dynnr
                DYNPROFIELD            l_dynprofld
                VALUE_ORG              'S'
               tables
                 value_tab              t_BNAME
                RETURN_TAB             RETURN_TAB.
             IF sy-subrc 0.
                IF NOT RETURN_TAB[] IS INITIAL.
                   READ TABLE RETURN_TAB INDEX 1.
                   IF SY-SUBRC 0.
                      T_BNAME RETURN_TAB-FIELDVAL.
                   ENDIF.
                ENDIF.
             ENDIF.
          ENDIF.
          "==================
      ENDIF.
   ENDIF.

ENDFORM.                    " F_SEARCHHELP
0 comments:

Post a Comment

message

Labels

NuffNang

Search google

Blog Archive

My Blog List

Twitter

Message

Followers