메뉴 건너뛰기

SAP 한국 커뮤니티

report zsalv_004

sapjoy 2010.08.20 10:58 조회 수 : 3076

 

report  zsalv_004                                 .

data gt_itab       type table of sflight.
data gt_itab2       type table of mara.
data g_flg   type c.
data gr_table      type ref to cl_salv_table.
data gr_table2     type ref to cl_salv_table.

data gr_columns type ref to cl_salv_columns_table.
data gr_column  type ref to cl_salv_column_table.

data gr_functions  type ref to cl_salv_functions_list.
data gr_container  type ref to cl_gui_custom_container.
data gr_container2  type ref to cl_gui_custom_container.

data ok_code type syucomm.

select * from sflight into table gt_itab
up to 25 rows.

select * from mara into table gt_itab2
up to 25 rows.

call screen 100.
*&---------------------------------------------------------------------*
*&      Module  0100_PBO  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module 0100_pbo output.

  set pf-status '0100'.


*  GR_TABLE->refresh( ).
  cl_gui_cfw=>flush( ).

clear : gr_container, gr_table.

  free : gr_container,gr_table.

if g_flg is initial.
*1. 컨테이너 생성
    create object gr_container
      exporting
        container_name = 'CONTAINER'.

  else.
*1. 컨테이너 생성
    create object gr_container
      exporting
        container_name = 'CONTAINER'.

  endif.


*2. ALV 테이블 및 데이터 전달
if g_flg is initial.
    cl_salv_table=>factory(
      exporting
        r_container    = gr_container
        container_name = 'CONTAINER'
      importing
        r_salv_table   = gr_table
      changing
        t_table        = gt_itab ).

 else.


     cl_salv_table=>factory(
      exporting
        r_container    = gr_container
        container_name = 'CONTAINER'
      importing
        r_salv_table   = gr_table
      changing
        t_table        = gt_itab2 ).


 endif.


*3. ALV 기본 기능 버튼 설정

*    gr_functions->set_default( ).
*    gr_functions->set_all( abap_true ).

*4. ALV 호출

if g_flg is initial.
    gr_functions = gr_table->get_functions( ).
    gr_table->display( ).
            g_flg = 'X'.
    else.
    gr_functions = gr_table->get_functions( ).


    gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'MANDT' ).
gr_column ?= gr_columns->add_column( 'MATNR' ).

        gr_table->refresh( ).

    endif.

endmodule.                 " 0100_PBO  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  0100_PAI  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module 0100_pai input.

  case ok_code.
    when 'BACK' or 'EXIT' or 'CANC'.
      set screen 0.
      leave screen.
  endcase.

endmodule.                 " 0100_PAI  INPUT
번호 제목 글쓴이 날짜 조회 수
629 REPORT z20_002 [2] sapjoy 2007.04.15 3092
628 REPORT Z18_002 sapjoy 2007.03.05 3082
627 REPORT z18_02. sapjoy 2012.08.01 3078
» report zsalv_004 sapjoy 2010.08.20 3076
625 Z02_003 [2] sapjoy 2006.12.02 3042
624 Z01_018 [2] sapjoy 2006.12.02 3042
623 doi_create [1] sapjoy 2008.12.25 3040
622 REPORT Z_DYNAMIC_SCREEN [1] sapjoy 2010.10.07 3034
621 REPORT Z05_014 sapjoy 2008.04.14 3010
620 Z01_020 [2] sapjoy 2006.12.02 3008
619 report zsalv_041 . sapjoy 2010.08.20 2998
618 REPORT Z15_033 sapjoy 2007.02.05 2987
617 report zsalv_043 . sapjoy 2010.08.20 2978
616 report zsapdoi_005. sapjoy 2008.12.26 2978
615 report zsalv_032 . sapjoy 2010.08.20 2976
614 REPORT Z11_001 sapjoy 2006.12.20 2976
613 INLUCDE ZXAISU02 sapjoy 2008.12.15 2961
612 PROGRAM z16_001 sapjoy 2007.04.26 2952
611 REPORT Z17_028 sapjoy 2007.02.26 2937
610 REPORT z19_005 [1] sapjoy 2007.04.03 2927