码迷,mamicode.com
首页 > 移动开发 > 详细

abap 数字移动小游戏

时间:2014-12-04 19:34:34      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   sp   for   on   art   log   

【转自 http://blog.csdn.net/forever_crazy/article/details/6542507】

report ......

selection-screen pushbutton 2(10)  pb11 user-command pb11.
selection-screen pushbutton 12(10) pb12 user-command pb12.
selection-screen pushbutton 22(10) pb13 user-command pb13.

selection-screen skip.
selection-screen pushbutton 2(10)  pb21 user-command pb21.
selection-screen pushbutton 12(10) pb22 user-command pb22.
selection-screen pushbutton 22(10) pb23 user-command pb23.

selection-screen skip.
selection-screen pushbutton 2(10)  pb31 user-command pb31.
selection-screen pushbutton 12(10) pb32 user-command pb32.
selection-screen pushbutton 22(10) pb33 user-command pb33.


selection-screen skip.
selection-screen pushbutton 12(10) pbrt user-command pbrt.


INITIALIZATION.
  "设定画面的初始值
  pb11 = ‘2‘. 
  pb12 = ‘1‘.
  pb13 = ‘4‘. 
  pb21 = ‘7‘. 
  pb22 = ‘3‘.
  pb23 = ‘6‘. 
  pb31 = ‘8‘. 
  pb32 = ‘ ‘.
  pb33 = ‘5‘.

at selection-screen.
  case sy-ucomm.
    when ‘pb11‘.
      perform exec_pb11.  
    when ‘pb12‘.
      perform exec_pb12.
    when ‘pb13‘.
      perform exec_pb13.
    when ‘pb21‘.
      perform exec_pb21.
    when ‘pb22‘.
      perform exec_pb22.
    when ‘pb23‘.
      perform exec_pb23.
    when ‘pb31‘.
      perform exec_pb31.
    when ‘pb32‘.
      perform exec_pb32.
    when ‘pb33‘.
      perform exec_pb33.

    when ‘pbrt‘
      perform exec_right_result.
    when 
  endcase.


form exec_pb11 .
  check pb11 is not initial.
  perform move_data changing pb11
                             pb12.
  perform move_data changing pb11
                             pb21.
endform.

form exec_pb12 .
  check pb12 is not initial.
  perform move_data changing pb12
                             pb11.
  perform move_data changing pb12
                             pb13.
  perform move_data changing pb12
                             pb22.
endform.

form exec_pb13 .
  check pb13 is not initial.
  perform move_data changing pb13
                             pb12.
  perform move_data changing pb13
                             pb23.
endform.

form exec_pb21 .
  check pb21 is not initial.
  perform move_data changing pb21
                             pb11.
  perform move_data changing pb21
                             pb22.
  perform move_data changing pb21
                             pb31.
endform.

form exec_pb22 .
  check pb22 is not initial.
  perform move_data changing pb22
                             pb12.
  perform move_data changing pb22
                             pb21.
  perform move_data changing pb22
                             pb23.
  perform move_data changing pb22
                             pb32.
endform.

form exec_pb23 .
  check pb23 is not initial.
  perform move_data changing pb23
                             pb13.
  perform move_data changing pb23
                             pb22.
  perform move_data changing pb23
                             pb33.
endform.

form exec_pb31 .
  check pb31 is not initial.
  perform move_data changing pb31
                             pb21.
  perform move_data changing pb31
                             pb32.
endform.

form exec_pb32 .
  check pb32 is not initial.
  perform move_data changing pb32
                             pb22.
  perform move_data changing pb32
                             pb31.
  perform move_data changing pb32
                             pb33.
endform.

form exec_pb33 .
  check pb32 is not initial.
  perform move_data changing pb33
                             pb23.
  perform move_data changing pb33
                             pb32.
endform.


form move_data changing p_pb1 type any
                        p_pb2 type any.
 "实现把点击的那按钮 移动到临近的空白按钮上 
  check p_pb1 is not initial
    and p_pb2 is initial.
  p_pb2 = p_pb1.
  clear pb1.
  
  perform check_right_result.

endform.


form check_right_result.
  if pb11 = ‘1‘
 and pb12 = ‘2‘
 and pb13 = ‘3‘
 and pb21 = ‘4‘
 and pb22 = ‘5‘
 and pb23 = ‘6‘
 and pb31 = ‘7‘
 and pb32 = ‘8‘
 and pb33 = ‘ ‘
    message ‘Very good !  boys‘. 
    leave screen.
  endif.
endform.

form exec_right_result.
 "正确结果为:
  pb11 = ‘1‘.
  pb12 = ‘2‘.
  pb13 = ‘3‘.
  pb21 = ‘4‘.
  pb22 = ‘5‘.
  pb23 = ‘6‘.
  pb31 = ‘7‘.
  pb32 = ‘8‘.
  pb33 = ‘ ‘.
endform.

abap 数字移动小游戏

标签:blog   http   io   ar   sp   for   on   art   log   

原文地址:http://www.cnblogs.com/rainysblog/p/4143362.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!