Conteúdo

Chat entre mandantes e mandantes diferentes

Bóra trocar uma ideia? Só cuidado pra não mandar para TODOS que estiverem logados heim!!!
REPORT ZSAPeiros_a.

*********************************************************************************
* CHAT - MESMO MANDANTE
*********************************************************************************
PARAMETERS: p_client   LIKE sy-mandt DEFAULT sy-mandt,
            p_user     LIKE sy-uname DEFAULT sy-uname,
            p_msg(128) TYPE C        DEFAULT '' LOWER CASE.

DATA: opcode_send_pop_up(1) TYPE x VALUE 31,
      msg_length            LIKE sy-index,
      loc_cut_blanks        TYPE x VALUE 1.

DESCRIBE FIELD p_msg LENGTH msg_length IN CHARACTER MODE.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_send_pop_up
  ID 'CLIENT'     FIELD p_client
  ID 'USR'        FIELD p_user
  ID 'MSG'        FIELD p_msg
  ID 'MSG_LEN'    FIELD msg_length
  ID 'CUT_BLANKS' FIELD loc_cut_blanks.

IF sy-subrc = 0.
  WRITE:/ 'Mensagem enviada para ', p_user, ' com sucesso!'.
ELSE.
  WRITE:/ 'Usuário Inexistente!'.
ENDIF.


REPORT ZSAPeiros_b.

*********************************************************************************
* CHAT - MANDANTES DIFERENTES
*********************************************************************************
PARAMETERS: p_client     LIKE sy-mandt DEFAULT sy-mandt,
            p_user       LIKE sy-uname DEFAULT sy-uname,
            p_msg(128)   TYPE c        DEFAULT '' LOWER CASE.

CALL FUNCTION 'TH_POPUP'
  EXPORTING
    client         = p_client
    user           = p_user
    MESSAGE        = p_msg
  EXCEPTIONS
    user_not_found = 1
    OTHERS         = 2.

IF sy-subrc = 0.
  WRITE:/ 'Mensagem enviada para ', p_user, ' com sucesso!'.
ELSE.
  WRITE:/ 'Usuário Inexistente!'.
ENDIF.