此链接是步循环的一些知识:https://blog.csdn.net/moonfly1127/article/details/83250869?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242
首先把代码贴出来:
REPORT ZTMP_TEST_IT003. *功能码返回值 DATA:OK_CODE TYPE SY-UCOMM, SAVE_OK TYPE SY-UCOMM. DATA:FIELD_NAME TYPE char8, FIELD_VALUE TYPE char8. START-OF-SELECTION. CALL SCREEN 100. MODULE status_0100 OUTPUT. * SET PF-STATUS 'xxxxxxxx'. * SET TITLEBAR 'xxx'. ENDMODULE. MODULE user_command_0100 INPUT. SAVE_OK = OK_CODE. CLEAR OK_CODE. *分析功能码,如果是工具条上的第2个按钮,则退出当前屏幕 CASE SAVE_OK. WHEN 'BACK'. LEAVE PROGRAM. ENDCASE. ENDMODULE. MODULE pbo_0100_fields_setinfo OUTPUT. *修改输出前屏幕上的数据 FIELD_NAME = SY-STEPL. CONDENSE FIELD_NAME NO-GAPS. CONCATENATE 'Name:' FIELD_NAME INTO FIELD_NAME. CONDENSE FIELD_NAME NO-GAPS. FIELD_VALUE = SY-STEPL. LOOP AT SCREEN. IF screen-name = 'FIELD_VALUE'. screen-input = 0. ENDIF. MODIFY SCREEN. ENDLOOP. ENDMODULE. MODULE pbo_0100_fields_getinfo INPUT. *获取屏幕数据 DATA:t_value TYPE char8. CLEAR t_value. t_value = FIELD_VALUE. ENDMODULE.
1.新建一个屏幕100,并作图上操作,如图:
效果如下:
2.屏幕元素清单&&逻辑流如图:
3.最后的效果如图: