메뉴 건너뛰기

SAP 한국 커뮤니티

REPORT z16_11.

sapjoy 2012.08.02 05:13 조회 수 : 1408

REPORT  z16_11.

TYPE-POOLS : slis.


DATA gt_fieldcat  TYPE  slis_t_fieldcat_alv.
DATA gs_fieldcat  TYPE  slis_fieldcat_alv.

DATA gt_events    TYPE slis_t_event.
DATA gs_event     TYPE slis_alv_event.

DATA gs_layout    TYPE  slis_layout_alv.
DATA gs_glay      TYPE lvc_s_glay.

TYPES BEGIN OF t_line.
        INCLUDE STRUCTURE sflight.
TYPES checkbox TYPE c.
TYPES  END OF t_line.

DATA gt_itab TYPE TABLE OF t_line WITH HEADER LINE.

SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE gt_itab
UP TO 25 ROWS.


MOVE    'PF_STATUS_SET'   TO  gs_event-name.
MOVE    'ALV_STATUS_SET'  TO  gs_event-form.
APPEND  gs_event          TO  gt_events.

MOVE    'DATA_CHANGED'   TO  gs_event-name.
MOVE    'ALV_DATA_CHANGED'  TO  gs_event-form.
APPEND  gs_event          TO  gt_events.


CLEAR : gs_fieldcat, gt_fieldcat.
gs_fieldcat-col_pos = 1.
gs_fieldcat-fieldname =  'CHECKBOX'.
gs_fieldcat-checkbox = 'X'.
gs_fieldcat-edit = 'X'.
gs_fieldcat-seltext_m = 'Sel'.
APPEND gs_fieldcat TO gt_fieldcat.
*
CLEAR : gs_fieldcat.
gs_fieldcat-col_pos = 2.
gs_fieldcat-fieldname =  'CARRID'.
gs_fieldcat-seltext_m = 'Airline Code'.
APPEND gs_fieldcat TO gt_fieldcat.

CLEAR : gs_fieldcat.
gs_fieldcat-col_pos = 3.
gs_fieldcat-fieldname =  'CONNID'.
gs_fieldcat-seltext_m = 'Connection Number'.
APPEND gs_fieldcat TO gt_fieldcat.


CLEAR : gs_fieldcat.
gs_fieldcat-col_pos = 4.
gs_fieldcat-fieldname =  'FLDATE'.
gs_fieldcat-seltext_m = '운항일'.
APPEND gs_fieldcat TO gt_fieldcat.

gs_glay-edt_cll_cb = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program      = sy-cprog
    i_grid_settings         = gs_glay
    it_fieldcat             = gt_fieldcat
    it_events               = gt_events
    is_layout               = gs_layout
    i_callback_user_command = 'ALV_USER_COMMAND'
  TABLES
    t_outtab                = gt_itab.


*&---------------------------------------------------------------------*
*&      Form  alv_user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_UCOMM    text
*      -->P_SELFIELD text
*----------------------------------------------------------------------*
FORM alv_user_command USING p_ucomm    LIKE sy-ucomm
                            p_selfield TYPE slis_selfield.
  CASE p_ucomm.
    WHEN '&IC1'.

      READ TABLE gt_itab INDEX p_selfield-tabindex.
      gt_itab-checkbox = 'X'.
      MODIFY gt_itab INDEX p_selfield-tabindex.

    WHEN 'SAVE'.

      MODIFY sflight FROM TABLE gt_itab.
      IF sy-subrc EQ 0.
        COMMIT WORK.
      ELSE.
        ROLLBACK WORK.
      ENDIF.
  ENDCASE.

ENDFORM.                    " ALV_USER_COMMAND
*&---------------------------------------------------------------------*
*&      Form  alv_status_set
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PT_EXTAB   text
*----------------------------------------------------------------------*
FORM alv_status_set  USING pt_extab  TYPE slis_t_extab .

  CLEAR: pt_extab[].
*  SET PF-STATUS 'ALV_STATUS'.
  SET PF-STATUS 'STANDARD_FULLSCREEN'.

ENDFORM.                    "ALV_STATUS_SET


*&---------------------------------------------------------------------*
*&      Form  ALV_DATA_CHANGED
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PCL_DATA   text
*----------------------------------------------------------------------*
FORM alv_data_changed USING pcl_data TYPE REF TO
                         cl_alv_changed_data_protocol.

  DATA : l_name(20),
         ls_cells TYPE lvc_s_modi.

  FIELD-SYMBOLS <fs_value>.

  LOOP AT pcl_data->mt_mod_cells INTO ls_cells.

    CLEAR gt_itab.
    READ TABLE gt_itab  INDEX ls_cells-row_id.

    CONCATENATE 'GT_ITAB-' ls_cells-fieldname INTO l_name.
    ASSIGN (l_name) TO  <fs_value>.
    <fs_value> = ls_cells-value.
    MODIFY gt_itab INDEX ls_cells-row_id.
  ENDLOOP.
ENDFORM. "alv_data_changed

번호 제목 글쓴이 날짜 조회 수
631 REPORT z17_01 . sapjoy 2012.08.02 1084
» REPORT z16_11. sapjoy 2012.08.02 1408
629 REPORT z16_10. sapjoy 2012.08.02 1191
628 REPORT z16_08. sapjoy 2012.08.02 1095
627 REPORT z16_07. sapjoy 2012.08.02 1079
626 REPORT z16_06. sapjoy 2012.08.02 1015
625 REPORT z16_05. sapjoy 2012.08.02 1193
624 REPORT z16_04. sapjoy 2012.08.02 1247
623 REPORT z16_03. sapjoy 2012.08.02 1148
622 REPORT Z16_02. sapjoy 2012.08.02 945
621 REPORT z16_01. sapjoy 2012.08.02 1078
620 REPORT z15_28. sapjoy 2012.08.02 1030
619 REPORT z15_27. sapjoy 2012.08.02 949
618 REPORT z15_26. sapjoy 2012.08.02 978
617 REPORT z15_25. [1] sapjoy 2012.08.02 1202
616 REPORT z15_24. sapjoy 2012.08.02 1410
615 REPORT z15_23. [1] sapjoy 2012.08.02 1220
614 REPORT z15_22. sapjoy 2012.08.02 1112
613 REPORT z15_21. sapjoy 2012.08.02 1163
612 REPORT z15_20. sapjoy 2012.08.02 1212