Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7203001
  • 博文数量: 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)

分类:

2007-06-06 12:12:34

*&---------------------------------------------------------------------*
*& Report  Z_BARRY_CDHDR_CDPOS                                         *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
REPORT  z_barry_cdhdr_cdpos                     .
TYPE-POOLS slis.
DATA : cdhdr TYPE cdhdr.
SELECT-OPTIONS :
  s_objcls FOR cdhdr-objectclas OBLIGATORY,
  s_objtid FOR cdhdr-objectid,
  s_chngnr FOR cdhdr-changenr,
  s_usrnam FOR cdhdr-username ,"DEFAULT sy-uname,
  s_udate  FOR cdhdr-udate   ," DEFAULT sy-datum,
  s_time   FOR cdhdr-utime,
  s_tcode  FOR cdhdr-tcode,
  s_plncnr FOR cdhdr-planchngnr,
  s_chngno FOR cdhdr-act_chngno,
  s_wsplnd FOR cdhdr-was_plannd,
  s_chngid FOR cdhdr-change_ind.
SELECTION-SCREEN SKIP.
PARAMETERS p_max TYPE numc3 OBLIGATORY DEFAULT '200'.
TYPES: BEGIN OF ty_s_cdhdr.
        INCLUDE STRUCTURE cdhdr.
TYPES:   checkbox,
       END OF ty_s_cdhdr.
TYPES:  BEGIN OF ty_s_cdpos.
        INCLUDE STRUCTURE cdpos.
TYPES:    checkbox,
        END OF ty_s_cdpos.
DATA : gs_layout TYPE slis_layout_alv,
       t_cdhdr TYPE TABLE OF ty_s_cdhdr.
START-OF-SELECTION.
  SELECT * INTO TABLE t_cdhdr
             UP TO p_max ROWS
           FROM cdhdr
          WHERE objectclas IN s_objcls
            AND objectid   IN s_objtid
            AND changenr   IN s_chngnr
            AND username   IN s_usrnam
            AND udate      IN s_udate
            AND utime      IN s_time
            AND tcode      IN s_tcode
            AND planchngnr IN s_plncnr
            AND act_chngno IN s_chngno
            AND was_plannd IN s_wsplnd
            AND change_ind IN s_chngid.
  gs_layout-zebra = 'X'.
  gs_layout-colwidth_optimize = 'X'.
  gs_layout-box_fieldname = 'CHECKBOX'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = sy-cprog
      i_callback_user_command = 'USER_COMMAND'
      i_structure_name        = 'CDHDR'
      is_layout               = gs_layout
    TABLES
      t_outtab                = t_cdhdr.
*---------------------------------------------------------------------*
*       FORM USER_COMMAND                                             *
*---------------------------------------------------------------------*
FORM user_command USING u_ucomm     TYPE syucomm
                        us_selfield TYPE slis_selfield.
  DEFINE m_sort.
    add 1 to ls_sort-spos.
    ls_sort-fieldname = &1.
    ls_sort-up = 'X'.
    append ls_sort to lt_sort.
  END-OF-DEFINITION.
  DATA :
    ls_cdhdr TYPE ty_s_cdhdr,
    ls_sort  TYPE slis_sortinfo_alv,
    lt_sort  TYPE slis_t_sortinfo_alv,
    lt_cdpos TYPE TABLE OF ty_s_cdpos.
  CASE u_ucomm.
    WHEN '&IC1'.
      PERFORM check_marked USING us_selfield.
      LOOP AT t_cdhdr INTO ls_cdhdr WHERE checkbox = 'X'.
        SELECT * APPENDING TABLE lt_cdpos
                 FROM cdpos
                WHERE objectclas = ls_cdhdr-objectclas
                  AND objectid   = ls_cdhdr-objectid
                  AND changenr   = ls_cdhdr-changenr.
      ENDLOOP.
      m_sort 'CHANGENR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_structure_name = 'CDPOS'
          is_layout        = gs_layout
          it_sort          = lt_sort
        TABLES
          t_outtab         = lt_cdpos.
  ENDCASE.
ENDFORM.                               " USER_COMMAND
*---------------------------------------------------------------------*
*       Form  CHECK_MARKED
*---------------------------------------------------------------------*
FORM check_marked USING us_selfield TYPE slis_selfield.
  FIELD-SYMBOLS :
    TYPE ty_s_cdhdr.
  READ TABLE t_cdhdr TRANSPORTING NO FIELDS WITH KEY checkbox = 'X'.
  IF NOT sy-subrc IS INITIAL AND
     NOT us_selfield-tabindex IS INITIAL.
    READ TABLE t_cdhdr INDEX us_selfield-tabindex ASSIGNING .
    -checkbox = 'X'.
  ENDIF.
ENDFORM.                    "check_marked
阅读(5248) | 评论(0) | 转发(0) |
0

上一篇:SAP FTP

下一篇:权限控制中的几个TCODE

给主人留下些什么吧!~~