메뉴 건너뛰기

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
번호 제목 글쓴이 날짜 조회 수
370 report zsalv_020 . sapjoy 2010.08.20 2381
369 report zsalv_019 . sapjoy 2010.08.20 2272
368 report zsalv_018 . sapjoy 2010.08.20 2327
367 report zsalv_017 . sapjoy 2010.08.20 2269
366 report zsalv_015 sapjoy 2010.08.20 2280
365 report zsalv_014 sapjoy 2010.08.20 2296
364 report zsalv_013 sapjoy 2010.08.20 2361
363 report zsalv_012 sapjoy 2010.08.20 2271
362 report zsalv_011 sapjoy 2010.08.20 2331
361 report zsalv_010 sapjoy 2010.08.20 2294
» report zsalv_004 sapjoy 2010.08.20 3076
359 report zsalv_003 sapjoy 2010.08.20 2336
358 report zsalv_002 [1] sapjoy 2010.08.20 2476
357 report zsalv_001 sapjoy 2010.08.20 2442
356 zsalv_edit [1] sapjoy 2010.08.20 3208
355 REPORT ZRTTS_02 sapjoy 2009.12.24 2586
354 REPORT ZRTTS_01 . sapjoy 2009.12.24 2652
353 Z16_005TOP sapjoy 2009.09.21 2549
352 Z16_005 sapjoy 2009.09.21 2577
351 Z16_001TOP sapjoy 2009.09.21 2593