메뉴 건너뛰기

SAP 한국 커뮤니티

REPORT z18_017

sapjoy 2007.03.11 22:29 조회 수 : 2672 추천:1

REPORT  z18_017                                                     .


DATA : con1_ref TYPE REF TO cl_gui_custom_container.


DATA : grid1  TYPE REF TO cl_gui_alv_grid,
       gs_variant     LIKE disvariant,
       gs_cs_variant  LIKE disvariant,
       gs_layout     TYPE lvc_s_layo,
       gs_toolbar    TYPE ui_functions,
       gt_sort       TYPE lvc_t_sort,
       gt_fieldcat   TYPE lvc_t_fcat,
       gt_sflight    TYPE TABLE OF sflight.


TYPE-POOLS: icon.


*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.


  PUBLIC SECTION.
    METHODS:


    handle_double_click
        FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING e_row e_column.


    METHODS : handle_toolbar
                 FOR EVENT toolbar OF cl_gui_alv_grid
                 IMPORTING e_object e_interactive.



    METHODS : handle_command
                 FOR EVENT user_command OF cl_gui_alv_grid
                 IMPORTING e_ucomm.


  PRIVATE SECTION.


ENDCLASS.                    "lcl_event_receiver DEFINITION


*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.


  METHOD handle_double_click.
    LEAVE TO SCREEN 0.
  ENDMETHOD.                           "handle_double_click


*-- Add ToolBar
  METHOD handle_toolbar.


    DATA: ls_toolbar  TYPE stb_button.


    CLEAR ls_toolbar.
    ls_toolbar-butn_type = 3.
    APPEND ls_toolbar    TO e_object->mt_toolbar.


    CLEAR ls_toolbar.
    ls_toolbar-function  = 'RESH'.
    ls_toolbar-icon      = icon_refresh.
    ls_toolbar-quickinfo = 'Refresh'.
    ls_toolbar-text      = ' '.
    ls_toolbar-disabled  = ' '.
    APPEND ls_toolbar    TO e_object->mt_toolbar.


  ENDMETHOD.                    "handle_toolbar



  METHOD handle_command.
    DATA : l_scroll TYPE lvc_s_stbl.


    CASE e_ucomm.
*-  REFRESH
      WHEN 'RESH'.


        SELECT * FROM sflight INTO TABLE gt_sflight.
        l_scroll-row = 'X'.
        l_scroll-col = 'X'.
        CALL METHOD grid1->refresh_table_display
          EXPORTING
            i_soft_refresh = ''
            is_stable      = l_scroll.
    ENDCASE.
  ENDMETHOD.                    "handle_user_command



ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
*


DATA :     event_receiver TYPE REF TO lcl_event_receiver.



START-OF-SELECTION.
  SELECT * FROM sflight INTO TABLE gt_sflight.


  CALL SCREEN 100.


 


 


*---------------------------------------------------------------------*
*  MODULE init_con OUTPUT
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
MODULE init_con OUTPUT.


  IF con1_ref IS INITIAL.
    CREATE OBJECT con1_ref
    EXPORTING container_name = 'CON1'.



    CREATE OBJECT grid1
           EXPORTING
                i_parent = con1_ref.


    PERFORM setting_layout.
    PERFORM setting_catalog.
    PERFORM setting_toolbar.
    PERFORM setting_sort.
    PERFORM setting_event.


    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
*        i_structure_name     = 'SFLIGHT'
        i_save               = 'A'
        is_variant           = gs_variant  " variant display
        i_default            = ' '
        is_layout            = gs_layout
        it_toolbar_excluding = gs_toolbar
      CHANGING
        it_outtab            = gt_sflight
        IT_FIELDCATALOG      = gt_fieldcat
        it_sort              = gt_sort.


 



  ENDIF.
ENDMODULE.                 " init_con  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'G100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT


*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.


  CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANC'.
      LEAVE TO SCREEN 0.
  ENDCASE.


ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Form  setting_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_GS_LAYOCAT  text
*----------------------------------------------------------------------*
FORM setting_layout .
*- General display options
  gs_layout-cwidth_opt = 'X'.
* TITLE BAR
  gs_layout-grid_title = 'Field Cataglog TEST'.
* Selection modes for SEL_MODE
  gs_layout-sel_mode = 'D'.
* Grid pattern
  gs_layout-zebra      = 'X'.
ENDFORM.                    " setting_layout
*&---------------------------------------------------------------------*
*&      Form  setting_toolbar
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_GS_TOOLBAR  text
*----------------------------------------------------------------------*
FORM setting_toolbar.
  DATA: l_exclude TYPE ui_func.


  l_exclude = cl_gui_alv_grid=>mc_fc_save_variant.
  APPEND l_exclude TO gs_toolbar.


  l_exclude = cl_gui_alv_grid=>mc_fc_maintain_variant.
  APPEND l_exclude TO gs_toolbar.


ENDFORM.                    " setting_toolbar
*&---------------------------------------------------------------------*
*&      Form  setting_sort
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setting_sort .


  DATA : ls_sort TYPE lvc_s_sort.


  ls_sort-spos = '1'.
  ls_sort-fieldname = 'CARRID'.
  ls_sort-up = 'X'.
  ls_sort-subtot = 'X'.
  APPEND ls_sort TO gt_sort.


ENDFORM.                    " setting_sort
*&---------------------------------------------------------------------*
*&      Form  setting_event
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM setting_event .
  CREATE OBJECT event_receiver.
  SET HANDLER event_receiver->handle_double_click FOR grid1.
  SET HANDLER event_receiver->handle_toolbar       FOR grid1.
  SET HANDLER event_receiver->handle_command       FOR grid1.


ENDFORM.                    " setting_event
*&---------------------------------------------------------------------*
*&      Form  setting_catalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form setting_catalog .
data ls_fieldcat  TYPE lvc_s_fcat.


   ls_fieldcat-fieldname = 'CARRID'.
   ls_fieldcat-COLTEXT = 'Carrid ID'.
   ls_fieldcat-JUST = 'L'.
   ls_fieldcat-KEY = 'X'.
   ls_fieldcat-OUTPUTLEN = '2'.


   APPEND LS_FIELDCAT TO GT_FIELDCAT.



   ls_fieldcat-fieldname = 'CONNID'.
   ls_fieldcat-COLTEXT = 'Flight Number'.
   ls_fieldcat-JUST = 'C'.
   ls_fieldcat-KEY = 'X'.
   ls_fieldcat-OUTPUTLEN = '4'.


   APPEND LS_FIELDCAT TO GT_FIELDCAT.


   ls_fieldcat-fieldname = 'PRICE'.
   ls_fieldcat-COLTEXT = 'Airfare'.
   ls_fieldcat-JUST = 'R'.
   ls_fieldcat-KEY = ' '.
   ls_fieldcat-OUTPUTLEN = '15'.


   APPEND LS_FIELDCAT TO GT_FIELDCAT.



endform.                    " setting_catalog

번호 제목 글쓴이 날짜 조회 수
589 REPORT ZDYNAMIC_ITAB_08. sapjoy 2009.02.16 2760
588 REPORT Z15_026 sapjoy 2007.01.31 2758
587 REPORT Z07_002 . sapjoy 2006.12.06 2755
586 REPORT Z17_019 [1] sapjoy 2007.02.14 2748
585 REPORT Z03_021 [5] sapjoy 2007.05.15 2737
584 REPORT Z03_005 [1] sapjoy 2006.12.02 2735
583 report zunicode_034. [1] sapjoy 2008.11.21 2734
582 REPORT z18_037 [3] sapjoy 2008.04.21 2728
581 REPORT zBADI_FIND sapjoy 2009.01.15 2724
580 REPORT Z15_027 . sapjoy 2007.02.01 2715
579 REPORT z18_032 sapjoy 2008.04.21 2710
578 TYPE-POOL ztgrp [1] sapjoy 2007.05.14 2699
577 REPORT Z07_007 sapjoy 2006.12.07 2698
576 zbapi_java sapjoy 2009.02.02 2693
575 Z01_019 [2] sapjoy 2006.12.02 2688
574 report zunicode_031. sapjoy 2008.11.21 2684
573 TOTAL sapjoy 2009.02.19 2683
572 REPORT Z15_007 eabap 2007.01.23 2677
» REPORT z18_017 sapjoy 2007.03.11 2672
570 REPORT z_userexit_01 sapjoy 2008.12.14 2655