Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7202986
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2010-04-29 17:06:25

REPORT  z_barry_test NO STANDARD PAGE HEADING .
 
TYPE-POOLS: slis.
DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.
DATA: sla TYPE slis_layout_alv ,
      ivariant LIKE disvariant,
      i_repid LIKE sy-repid .
DATA: tcode(10) TYPE c.
DATA: BEGIN OF itab OCCURS 0,
        f1(10) TYPE c,
        f2(10) TYPE c,
      END OF itab.
 
START-OF-SELECTION.
  PERFORM getdata.
  PERFORM outdata.
 
AT LINE-SELECTION.
  CALL TRANSACTION tcode.
 
*&---------------------------------------------------------------------*
*&      Form  GETDATA
*&---------------------------------------------------------------------*
FORM getdata.
  itab-f1 = 'ALV Line 1'.
  APPEND itab.
ENDFORM.                    " GETDATA
*&---------------------------------------------------------------------*
*&      Form  outdata
*&---------------------------------------------------------------------*
FORM outdata.
  PERFORM fieldcat_init .
  i_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = i_repid
      it_fieldcat             = gd_fieldcat[]
      is_layout               = sla
      i_callback_user_command = 'USER_COMMAND'
    TABLES
      t_outtab                = itab
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.
ENDFORM.                    " outdata
*---------------------------------------------------------------------*
*       FORM fieldcat_init                                            *
*---------------------------------------------------------------------*
FORM fieldcat_init .
  PERFORM frm_catlg_set USING: 'F1'   'F1' ,
                               'F2'   'F2'.
ENDFORM.                    "fieldcat_init
*---------------------------------------------------------------------*
*       FORM frm_catlg_set                                            *
*---------------------------------------------------------------------*
FORM frm_catlg_set USING p_field   p_text.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.
  ls_fieldcat-fieldname     = p_field.
  ls_fieldcat-seltext_l     = p_text.
  ls_fieldcat-outputlen     = 20 .
  APPEND ls_fieldcat TO gd_fieldcat .
  CLEAR ls_fieldcat .
ENDFORM.                    "frm_catlg_set
*&--------------------------------------------------------------------*
*&      Form  user_command
*&--------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
                    rs_selfield TYPE slis_selfield.
  READ TABLE itab INDEX rs_selfield-tabindex.
  CASE r_ucomm.
    WHEN '&IC1'.
      CALL SCREEN 100.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
ENDFORM. "user_com
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SUPPRESS DIALOG.
  LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
  SET PF-STATUS space.
  tcode = 'SE11'.
  WRITE 'SE11'. HIDE tcode.
  tcode = 'SE37'.
  WRITE / 'SE37'. HIDE tcode.
ENDMODULE.                 " STATUS_0100  OUTP
阅读(6050) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~