• 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.

  • 相关阅读:
    独立性检验|适应性检验|卡方检验|离散型数据|连续型数据
    双因子方差分析|adjusted R|强度|SSA|SSE|SST|
    发明人|申请人|专利权人|完全民事能力|谁主张谁证明|新颖性|创造性|实用性|先申请制
    方差分析|重复|指标|因素|处理效应|实验误差|实验设计可避免的误差|一般线性|广义线性
    字符数组1
    四舍五入输出数字
    如何输出0001, 0002, 0003... 这样的数
    shell scripting Python
    [C&Python]9x9乘法口诀打印
    [pointer]调用函数找出一维数组中的最值,
  • 原文地址:https://www.cnblogs.com/rainysblog/p/4143362.html
Copyright © 2020-2023  润新知