"Transfer from http://blog.csdn.net/forever_crazy/article/details/6542507"
Report ...
Selection-screen pushbutton 2 (Ten) Pb11 User-command pb11.
Selection-screen Pushbutton (Ten) pb12 User-command pb12.
Selection-screen Pushbutton (Ten) Pb13 User-command pb13.
Selection-screen Skip.
Selection-screen pushbutton 2 (Ten) Pb21 User-command pb21.
Selection-screen Pushbutton (Ten) Pb22 User-command pb22.
Selection-screen Pushbutton (Ten) pb23 User-command pb23.
Selection-screen Skip.
Selection-screen pushbutton 2 (Ten) Pb31 User-command pb31.
Selection-screen Pushbutton (Ten) Pb32 User-command pb32.
Selection-screen Pushbutton (Ten) pb33 User-command pb33.
Selection-screen Skip.
Selection-screen Pushbutton (Ten) PBRT User-command PBRT.
Initialization.
"Set the initial value of the screen
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.
"Implementation moves the clicked button to the adjacent blank button."
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.
"The correct result is:
PB11 = ' 1 '.
PB12 = ' 2 '.
Pb13 = ' 3 '.
Pb21 = ' 4 '.
Pb22 = ' 5 '.
pb23 = ' 6 '.
Pb31 = ' 7 '.
Pb32 = ' 8 '.
Pb33 = '.
EndForm.
ABAP Digital Mobile Mini-game