登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

dropdownlist at selection screen  

2011-01-27 11:57:27|  分类: ABAP屏幕操作 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

report  ztest_sc_2 no standard page heading.

*Types & data: For dropdownlist
type-pools : vrm .
tables:sscrfields.

parameters : p_list1(4) as listbox   visible length 20 ,
             p_list2 type rmmg1-mtart as listbox  visible length 28,
             p_list3 type rmmg1-berty as listbox visible length 15,
             p_list4 type c as listbox visible length 10 user-command p4.

* Initialization
initialization.
  "Set the value list
  perform value_list using 'p_list1'.
  perform value_list using 'p_list4'.

* at selection-screen output
at selection-screen output.
  "Set the default key of value list
  perform value_list_default.

* at selection-screen
at selection-screen.
  "Check the PAI event of value-list
  perform value_list_pai.

* start of selection
start-of-selection.

*&———————————————————————*
*&      Form  VALUE_LIST
*&———————————————————————*
*       Create the Dropdown list
*———————————————————————-*
form value_list using i_name type c.
  data:
    lv_name  type vrm_id,
    lt_list  type vrm_values,
    ls_list  type vrm_value.

  clear:ls_list,lt_list.
  if i_name = 'p_list1'.
* For the items: p_list1
    clear:ls_list.
    ls_list-key = 'MM01'.
    ls_list-text = 'Create Material'.
    append ls_list to lt_list.

    clear:ls_list.
    ls_list-key = 'MM02'.
    ls_list-text = 'Change Material'.
    append ls_list to lt_list.

    clear:ls_list.
    ls_list-key = 'MM03'.
    ls_list-text = 'Display Material'.
    append ls_list to lt_list.
  elseif i_name = 'p_list4'.
* For the items: p_list4
    clear:ls_list.
    ls_list-key = 'A'.
    ls_list-text = 'Character A'.
    append ls_list to lt_list.

    clear:ls_list.
    ls_list-key = 'B'.
    ls_list-text = 'Character B'.
    append ls_list to lt_list.
  endif.

* Set the value list
  lv_name = i_name.
  call function 'VRM_SET_VALUES'
    exporting
      id              = lv_name
      values          = lt_list
    exceptions
      id_illegal_name = 1
      others          = 2.

  if sy-subrc <> 0.
    "For the item list error!
    message 'For the item list error!' type 'E'.
  endif.

endform.                    " VALUE_LIST
*&———————————————————————*
*&      Form  VALUE_LIST_DEFAULT
*&———————————————————————*
*       Set the default key of value list
*———————————————————————-*
form value_list_default .
*Note:
*  For dropdownlist, it will use ”Key-match” to determine the selected.
*  if no match, for exmaple,if you enter such as ”MM04″, then the item
*  'MM04' will be added in the below of the value-list automatically.

*1. For p_list1
  p_list1 = 'MM02'. " Key-match

*2. For p_list2
  p_list2 = 'No KEY'. " No Key-match and cast

*3. For p_list3
  p_list3 = '3'. " Key-match

endform.                    " VALUE_LIST_DEFAULT
*&———————————————————————*
*&      Form  VALUE_LIST_PAI
*&———————————————————————*
*       Check the PAI event of value-list
*———————————————————————-*
form value_list_pai .

*1. For p_list1 : Should be triggered by ENTER or F-code
  case p_list1.
    when 'MM01'.
      message 'You have selected ”MM01” item.' type 'I'.
    when 'MM02'.
      message 'You have selected ”MM02” item.' type 'I'.
    when 'MM03'.
      message 'You have selected ”MM03” item.' type 'I'.
    when others.
      message 'No relevant transaction maintained!' type 'W'.
  endcase.

*2. For p_list4 : Triggered automatically when state changed
  if sscrfields-ucomm = 'P4'. "Only when change the item in List 'P4'
    case p_list4.
      when 'A'.
        message 'You have selected ”A” Character.' type 'I'.
      when 'B'.
        message 'You have selected ”B” Character.' type 'I'.
    endcase.
  endif.

endform.                    " VALUE_LIST_PAI

*-------------------------------------------------------
REPORT."调用模板

PARAMETERSp_out(4AS LISTBOX VISIBLE LENGTH 20.

TYPE-POOLS vrm .
TABLES sscrfields.
DATAlv_name  TYPE vrm_id,
      lt_list  TYPE vrm_values,
      ls_list  TYPE vrm_value.

INITIALIZATION.
  CLEARls_listlt_list.

  ls_list-key 'ZLD0'.
  ls_list-text '交货单打印'.
  APPEND ls_list TO lt_list.

  CLEAR:ls_list.
  ls_list-key 'ZLD1'.
  ls_list-text '出库单打印'.
  APPEND ls_list TO lt_list.

  CLEAR:ls_list.
  ls_list-key 'ZLDX'.
  ls_list-text '全部打印'.
  APPEND ls_list TO lt_list.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              'P_OUT' "p_out可以取lt_list-key中的任一值
      values          lt_list
    EXCEPTIONS
      id_illegal_name 1
      OTHERS          2.

  评论这张
 
阅读(484)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018