• abap 数字移动小游戏


    【转自 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.

  • 相关阅读:
    css 冷知识
    js跨域问题
    检测浏览器是否支持ES6
    新增项目到GIT仓库中
    如何正确设置统计博客园的个人博客访问量(图文详解)
    Node中包的加载机制
    图片路径中含有中文在jsp下不能正常显示的问题
    通过Xshell来访问和连接Linux
    文件下载该注意的问题
    文件上传该注意的问题
  • 原文地址:https://www.cnblogs.com/rainysblog/p/4143362.html
Copyright © 2020-2023  润新知