ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 在代码中调用“回车”命令

在代码中调用“回车”命令

原创 Linux操作系统 作者:hzq2010 时间:2011-05-15 11:04:51 0 删除 编辑

函数SAPGUI_SET_FUNCTIONCODE可以模拟屏幕上输入的命令。下面一个例子是在value-request事件中调用回车命令,如果通过F4选择多个记录,按钮自动变为绿色。

button

*&———————————————————————*
*& Report  ZFLIGHTBOOKING
*&
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT  zflightbooking_new.

INCLUDE rhxmacro.
TABLES: objec, pchdy.

DATA: lt_marked_objects TYPE TABLE OF hrsobid,
wa_marked_objects TYPE hrsobid,
lt_sel_objects TYPE TABLE OF objec,
wa_sel_objects TYPE objec.

SELECT-OPTIONS:
  p_objid FOR pchdy-objid_seq NO INTERVALS.                     “ObjektId”YMOK139293

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_objid-low.       “YMOK303367
  PERFORM. f4_objid_o.                                       “YMOK303367

AT SELECTION-SCREEN OUTPUT.

INITIALIZATION.

START-OF-SELECTION.

END-OF-SELECTION.
*&———————————————————————*
*&      Form  F4_OBJID_O
*&———————————————————————*
*       text
*———————————————————————-*
*      <–P_P_OBJID  text
*———————————————————————-*
FORM. f4_objid_o.
  CLEAR: lt_marked_objects, wa_marked_objects.
  CLEAR: lt_sel_objects, wa_sel_objects.

  LOOP AT p_objid.
    wa_marked_objects-plvar = ‘01′.
    wa_marked_objects-otype = ‘O’.
    wa_marked_objects-sobid = p_objid-low.
    INSERT wa_marked_objects inTO lt_marked_objects index 1.
  ENDLOOP.

  CALL FUNCTION ‘RH_OBJID_REQUEST’
   EXPORTING
     plvar                   = ‘01′
     otype                   = ‘O’
     seark                   = ‘*’
     set_mode                = ‘X’
     dynpro_repid = sy-repid
     dynpro_dynnr = sy-dynnr
*     SEARK_BEGDA             = $LOW_DATE
*     SEARK_ENDDA             = $HIGH_DATE
   TABLES
     marked_objects          = lt_marked_objects
     sel_objects             = lt_sel_objects
   EXCEPTIONS
     cancelled               = 1
     wrong_condition         = 2
     nothing_found           = 3
     internal_error          = 4
     illegal_mode            = 5
     OTHERS                  = 6
            .

  CLEAR: p_objid, p_objid[].
  LOOP AT lt_sel_objects INTO wa_sel_objects.
    p_objid-sign = ‘I’.
    p_objid-option = ‘EQ’.
    p_objid-low = wa_sel_objects-objid.
    insert p_objid index 1.
  ENDLOOP.

  CALL FUNCTION ‘SAPGUI_SET_FUNCTIONCODE’
    EXPORTING
      functioncode           = ‘=’
    EXCEPTIONS
      function_not_supported = 1
      OTHERS                 = 2.

ENDFORM.                    ” F4_OBJID_O

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23495244/viewspace-695397/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 常用FUNCTION
请登录后发表评论 登录
全部评论

注册时间:2010-03-11

  • 博文量
    196
  • 访问量
    168579