Chinaunix首页 | 论坛 | 博客
  • 博客访问: 203391
  • 博文数量: 54
  • 博客积分: 2056
  • 博客等级: 大尉
  • 技术积分: 568
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-25 12:07
文章分类

全部博文(54)

文章存档

2014年(1)

2013年(1)

2012年(1)

2011年(2)

2010年(1)

2009年(11)

2008年(28)

2007年(9)

我的朋友

分类:

2007-08-17 15:16:39

*&---------------------------------------------------------------------*
*& Report Z14841_TEST041
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT z14841_test041.

DEFINE m_fieldcat.
  add 1 to ls_fieldcat-col_pos.
  ls_fieldcat-fieldname = &1.
  ls_fieldcat-ref_tabname = &2.
  ls_fieldcat-ref_fieldname = &3.
* ls_fieldcat-ref_table = &4.
* ls_fieldcat-outputlen = &5.
* ls_fieldcat-scrtext_s = &6.
* ls_fieldcat-scrtext_m = &7.
* ls_fieldcat-scrtext_l = &8.
* ls_fieldcat-coltext = &9.
  append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.


TYPE-POOLS: slis. " alv global types
DATA: g_repid LIKE sy-repid.

SELECTION-SCREEN :
  SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '30' OBLIGATORY.
SELECTION-SCREEN END OF LINE.

DATA:
* Data displayed
  BEGIN OF gt_vbak OCCURS 0,
    vkorg LIKE vbak-vkorg, "
sales organization
    kunnr LIKE vbak-kunnr, " sold-to party
    vbeln LIKE vbak-vbeln, "
sales document
    netwr LIKE vbak-netwr, " net VALUE of the sales order
    line_color(4), "
line color
  END OF gt_vbak.

*———————————————————————*
INITIALIZATION.

* v_1 = 'maximum OF records TO read'.

START-OF-SELECTION.
  PERFORM f_read_data.
  PERFORM f_fill_color.
  PERFORM f_display_data.

*———————————————————————*
* Form f_read_data_vbak
*———————————————————————*
FORM f_read_data.

  SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
           FROM vbak UP TO p_max ROWS.

ENDFORM. "f_read_data
"
f_read_data
*——————————————————————–*
* Form f_fill_color
*——————————————————————–*
FORM f_fill_color.
  DATA: l_rnd_value LIKE datatype-integer2.
  LOOP AT gt_vbak.
    CALL FUNCTION 'RANDOM_I2'
      EXPORTING
        rnd_min = 0
        rnd_max = 5
      IMPORTING
        rnd_value = l_rnd_value.
    CASE l_rnd_value.
      WHEN 0.
        gt_vbak-line_color = 'C610'." red.
      WHEN 1.
        gt_vbak-line_color = 'C510'."
green.
      WHEN 2.
        gt_vbak-line_color = 'C410'. " light blue.
      WHEN 3.
        gt_vbak-line_color = 'C310'."
yellow.
      WHEN 4.
        gt_vbak-line_color = 'C210'.
      WHEN 5.
        gt_vbak-line_color = 'C110'. "blue.
      WHEN 6.
        gt_vbak-line_color = 'C010'.
    ENDCASE.
    MODIFY gt_vbak.
  ENDLOOP.

ENDFORM. "
f_read_data
" f_fill_color
*———————————————————————*
* Form f_display_data
*———————————————————————*
FORM f_display_data.

  DATA:
    ls_layout TYPE slis_layout_alv,
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.

* Build the field catalog
  m_fieldcat 'VKORG' 'VBAK' 'VKORG'.
  m_fieldcat 'KUNNR' 'VBAK' 'KUNNR'.
  m_fieldcat 'VBELN' 'VBAK' 'VBELN' .
  m_fieldcat 'NETWR' 'VBAK' 'NETWR'.

* Fill Layout - Name of the field with color
  ls_layout-zebra = 'X'.
  ls_layout-cell_merge = 'X'.
  ls_layout-colwidth_optimize = 'X'.
  ls_layout-info_fieldname = 'LINE_COLOR'.
*ls_layout-BOX_FIELDNAME = 'VKORG'.
*ls_layout-NO_UNIT_SPLITTING
*ls_layout-TOTALS_BEFORE_ITEMS
*ls_layout-TOTALS_ONLY
*ls_layout-TOTALS_TEXT
*ls_layout-SUBTOTALS_TEXT
*ls_layout-BOX_FIELDNAME
*ls_layout-BOX_TABNAME
*ls_layout-BOX_ROLLNAME
*ls_layout-EXPAND_FIELDNAME
*ls_layout-HOTSPOT_FIELDNAME
*ls_layout-CONFIRMATION_PROMPT
*ls_layout-KEY_HOTSPOT
*ls_layout-GROUP_BUTTONS
*ls_layout-GET_SELINFOS
*ls_layout-GROUP_CHANGE_EDIT
*ls_layout-NO_SCROLLING
*ls_layout-DETAIL_POPUP
*ls_layout-DETAIL_INITIAL_LINES
*ls_layout-DETAIL_TITLEBAR
*ls_layout-HEADER_TEXT
*ls_layout-DEFAULT_ITEM
*ls_layout-INFO_FIELDNAME
*ls_layout-COLTAB_FIELDNAME


  g_repid = sy-repid.
* Display the list
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
* i_callback_pf_status_set = 'MENU_SET'
* i_callback_user_command = 'USER_COMMAND'
      i_callback_program = g_repid
      is_layout = ls_layout
      it_fieldcat = lt_fieldcat
* i_structure_name = 'vbak'
    TABLES
      t_outtab = gt_vbak.

ENDFORM. "
f_read_data
" f_display_data
***************** END OF PROGRAM Z_ALV_LINE_COLOR *********************

*&--------------------------------------------------------------------*
*& Form menu_set
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->RT_EXTAB text
*---------------------------------------------------------------------*
FORM menu_set USING lt_extab TYPE slis_t_extab.
  DATA: ls_extab TYPE slis_extab.

  SET PF-STATUS '101'. "
定义屏幕状态,然后在里面定义自己的按钮

ENDFORM. "menu_set
*&--------------------------------------------------------------------*
*& Form execute_command
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELDtext
*---------------------------------------------------------------------*
FORM user_command USING ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
  CASE ucomm.
    WHEN '&IC1'."
双击
* READ TABLE itab INDEX rs_selfield-tabindex .
* REFRESH : i_t_params . CLEAR: i_s_params .
* i_s_params-selname = 'IV_GUID' .
* i_s_params-kind = 'S' .
* i_s_params-sign = 'I' .
* i_s_params-option = 'EQ' .
* i_s_params-low = itab-head_guid .
* APPEND i_s_params TO i_t_params .
* SUBMIT crm_report_start AND RETURN WITH SELECTION-TABLE i_t_params.



    WHEN 'TRANSPORT'.
* CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
* EXPORTING
* textline1 = '您确认正确且继续吗?'
* titel = '传输'
* IMPORTING
* answer = answer.
* IF answer = 'J' .
* CALL FUNCTION 'Z1CRM_TRANSFER_2_R3_VC'
* STARTING NEW TASK 'task'
* EXPORTING
* guid = itab-head_guid
* sign = 'X'.
*
* MESSAGE 'OK!' TYPE 'I' .
* ENDIF.
  ENDCASE.
ENDFORM.

阅读(1049) | 评论(0) | 转发(0) |
0

上一篇:BADI and BAPI

下一篇:WorkFlow_Downloader

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