abap 數字移動小遊戲

來源:互聯網
上載者:User

標籤: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 數字移動小遊戲

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.