Categorias

Aprenda a criar um bate papo em ABAP

Criado para ajudar quando sua empresa reprimi seus meros trabalhadores e não os deixa usar MSN, GTALK, ou YAHOO…

Criei pra nós o ZCHAT =)

Basicamente um programa que mistura ABAP, Methodos e um pouco de javascript.

Abraços.

*&---------------------------------------------------------------------*
*& Report  ZTESTEDI                                                    *
*& Autor    : Diego Rodrigues - BBKO                Data: 29.07.2009   *
*&---------------------------------------------------------------------*
*& Histórico de Alterações:                                            *
*&---------------------------------------------------------------------*
*& Data      |Autor               |Alteração                           *
************************************************************************
*& Criar uma tela 0100 e nessa tela:
*& Criar um container com o nome de O_CONT
*& Outro com o nome de DBOX 
*& 2 campos um com nome de v_usuario e v_message
*& mais um botão com o nome de SEND
*& --------------------------------------------
*& Criar uma tela 050 de acordo com a foto
*& ok com nome de OK e sair com nome de SAIR
*&---------------------------------------------------------------------*

REPORT  ztestedi.


**********************************************************************
*** Declaração de Tipos
**********************************************************************

TYPES: BEGIN OF ty_chat,
  uname TYPE zchat-uname,
  texto TYPE zchat-texto,
  END OF ty_chat.

**********************************************************************
*** Declaração de Tabelas
**********************************************************************

DATA: t_chat     TYPE TABLE OF zchat,
      t_chat_aux TYPE TABLE OF ty_chat.

**********************************************************************
*** Declaração de Work Areas
**********************************************************************

DATA: wa_chat TYPE zchat,
      wa_chat_aux TYPE ty_chat.


**********************************************************************
*** Declaração de Variáveis para os Methodos.
**********************************************************************
DATA: custom_container TYPE REF TO cl_gui_custom_container,
      editor           TYPE REF TO cl_gui_textedit,
      g_grid1          TYPE REF TO cl_gui_alv_grid.

DATA: vg_exibe TYPE boolean,
      ok_code  TYPE syucomm.

DATA : wa_indx TYPE indx.
**********************************************************************
*** Tabelas e work areas para validar linhas de seleção no ALV.
**********************************************************************
DATA: v_extension TYPE i,
      v_usuario   TYPE c LENGTH 15,
      v_message   TYPE c LENGTH 132.


*----------------------------------------------------------------------*
* Includes
*----------------------------------------------------------------------*
INCLUDE: zsuppi_dg_identif_centro.

*----------------------------------------------------------------------*
* Declaração de tabelas internas
*----------------------------------------------------------------------*
DATA: t_bdc LIKE bdcdata OCCURS 0 WITH HEADER LINE.

* Tabela para armazenar status tela
DATA: BEGIN OF t_func OCCURS 0,
       fcode LIKE rsmpe-func,
      END OF t_func.

*----------------------------------------------------------------------*
* Declaração de work areas
*----------------------------------------------------------------------*

*----------------------------------------------------------------------*
* HTML
*----------------------------------------------------------------------*
DATA: "dbox    TYPE REF TO cl_gui_dialogbox_container,
      dbox    TYPE REF TO cl_gui_custom_container,
      html    TYPE REF TO cl_gui_html_viewer.

*----------------------------------------------------------------------*
* Declaração de variáveis
*----------------------------------------------------------------------*
DATA: v_contador         TYPE i,
      v_data_hora(15),
      v_process          TYPE i,
      v_dia1             TYPE sy-datum,
      v_dia2             TYPE sy-datum,
      v_hora1            TYPE sy-uzeit,                     "#EC NEEDED
      v_hora2            TYPE sy-uzeit,
      v_hora_aux         TYPE sy-uzeit,
      v_dh_aux1          TYPE tzntstmps,                    "#EC NEEDED
      v_dh_aux2          TYPE tzntstmps,                    "#EC NEEDED
      v_hora_r(6)        TYPE n,
      v_prim_vez         VALUE 'S',
      v_temp1(3)         TYPE c VALUE '15',
      v_centro           LIKE zsuppt_dg_usuari-werks,
      v_desccentro       LIKE t001w-name1,
      v_cancel,
*      ok_code            LIKE sy-ucomm,
      save_ok            LIKE sy-ucomm,

      v_data             LIKE sy-datum,
      v_hora             LIKE sy-uzeit.

*----------------------------------------------------------------------*
* Declaração de contantes
*----------------------------------------------------------------------*
CONSTANTS: c_x          VALUE 'X'.


*******************************************************************
CLASS lcl_toolbar DEFINITION INHERITING FROM cl_gui_toolbar.
  TYPE-POOLS
    icon.

  PUBLIC SECTION.
    METHODS
      constructor IMPORTING html TYPE REF TO cl_gui_html_viewer.

  PRIVATE SECTION.
    DATA
      html TYPE REF TO cl_gui_html_viewer.
    METHODS on_function_selected FOR EVENT function_selected OF lcl_toolbar
      IMPORTING fcode.
ENDCLASS.                    "lcl_toolbar DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_toolbar IMPLEMENTATION.
  METHOD constructor.
    DATA:
      dbox TYPE REF TO cl_gui_dialogbox_container,
      ievents TYPE cntl_simple_events,
      xevents LIKE LINE OF ievents.

    IF sy-subrc <> 0.
    ENDIF.

    super->constructor( parent       = dbox
                        display_mode = m_mode_horizontal ).
    me->html = html.
    xevents-eventid = m_id_function_selected.
    APPEND xevents TO ievents.

    set_registered_events( events = ievents ).

    SET HANDLER on_function_selected FOR me.
  ENDMETHOD.                    "constructor

*----------------------------------------------------------------------*

Arquivos para Download:

Cara do programa.jpgChat.txtRotina tela 005.txtRotina tela 0100.txtTabela usada.jpgTela 0050.jpgTela 0100.jpg