메뉴 건너뛰기

SAP 한국 커뮤니티

REPORT zfalv_011.

sapjoy 2011.02.16 19:50 조회 수 : 3627

REPORT  zfalv_011.


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 = '선택'.
APPEND gs_fieldcat TO gt_fieldcat.
*
CLEAR : gs_fieldcat.
gs_fieldcat-col_pos = 2.
gs_fieldcat-fieldname =  'CARRID'.
gs_fieldcat-seltext_m = '항공사 ID'.
APPEND gs_fieldcat TO gt_fieldcat.


CLEAR : gs_fieldcat.
gs_fieldcat-col_pos = 3.
gs_fieldcat-fieldname =  'CONNID'.
gs_fieldcat-seltext_m = '운항 ID'.
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-repid
    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

번호 제목 글쓴이 날짜 조회 수
411 REPORT Z02_16. sapjoy 2012.07.31 1511
410 REPORT z02_15. sapjoy 2012.07.31 1621
409 REPORT z02_14. sapjoy 2012.07.31 1538
408 REPORT z02_13. sapjoy 2012.07.31 1690
407 REPORT z02_12. sapjoy 2012.07.31 1619
406 REPORT z02_11. sapjoy 2012.07.31 1717
405 REPORT z02_10. sapjoy 2012.07.31 1609
404 REPORT z02_09. sapjoy 2012.07.31 1586
403 REPORT z02_08. sapjoy 2012.07.31 1843
402 REPORT z02_07. sapjoy 2012.07.31 1786
401 REPORT z02_06. sapjoy 2012.07.31 1658
400 REPORT z02_05. sapjoy 2012.07.31 1863
399 REPORT z02_04. sapjoy 2012.07.31 1953
398 REPORT z02_03 sapjoy 2012.07.31 1805
397 REPORT z02_01. sapjoy 2012.07.31 1788
396 REPORT Z_WHEREUSEDLIST [4] sapjoy 2011.03.29 3215
395 Z_EXPORT_GRAPHIC_FROM_SE78 [1] sapjoy 2011.03.29 4447
394 REPORT ZSMARTFORMS_03. sapjoy 2008.11.28 3345
» REPORT zfalv_011. sapjoy 2011.02.16 3627
392 <b>easy abap 소스 전체 파일 입니다. [188] file sapjoy 2008.05.02 10149