本文主要是介绍SM30 给字段添加搜索帮助同时带出描述,手动输入后回车带出描述,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
输入一级分类 二级分类,敲回车自动带出描述
CHAIN.FIELD zmmt0013d-zclass2 .FIELD zmmt0013d-zclass2t .MODULE frm_get_cl2t ON CHAIN-REQUEST.ENDCHAIN.CHAIN.FIELD zmmt0013d-zclass1 .FIELD zmmt0013d-zclass1t .MODULE frm_get_cl1t ON CHAIN-REQUEST.ENDCHAIN.
取出描述代码部分 zmmt0013d-zclass2t:表名-描述字段名
MODULE frm_get_cl2t INPUT.SELECT SINGLE a~kschl "#EC CI_SUBRCFROM swor AS aINNER JOIN klah AS bON a~clint = b~clintWHERE b~class = @zmmt0013d-zclass2AND a~spras = '1'INTO @zmmt0013d-zclass2t.ENDMODULE.MODULE frm_get_cl1t INPUT.SELECT SINGLE a~kschl "#EC CI_SUBRCFROM swor AS aINNER JOIN klah AS bON a~clint = b~clintWHERE b~class = @zmmt0013d-zclass1AND a~spras = '1'INTO @zmmt0013d-zclass1t.ENDMODULE.
二级分类搜索帮助,选中后可自动带出描述
屏幕部分
PROCESS BEFORE OUTPUT.MODULE liste_initialisieren.LOOP AT extract WITH CONTROLtctrl_zmmt0013d CURSOR nextline.MODULE liste_show_liste.ENDLOOP.
*
PROCESS AFTER INPUT.MODULE liste_exit_command AT EXIT-COMMAND.MODULE liste_before_loop.LOOP AT extract.MODULE liste_init_workarea.CHAIN.FIELD zmmt0013d-zclass2 .FIELD zmmt0013d-zclass2t .MODULE frm_get_cl2t ON CHAIN-REQUEST.ENDCHAIN.CHAIN.FIELD zmmt0013d-zclass1 .FIELD zmmt0013d-zclass1t .MODULE frm_get_cl1t ON CHAIN-REQUEST.ENDCHAIN.CHAIN.FIELD zmmt0013d-zcpxh .FIELD zmmt0013d-zclass2 .FIELD zmmt0013d-zclass2t .FIELD zmmt0013d-zclass1 .FIELD zmmt0013d-zclass1t .FIELD zmmt0013d-zvoice .FIELD zmmt0013d-spras .FIELD zmmt0013d-zyysl .MODULE set_update_flag ON CHAIN-REQUEST.ENDCHAIN.FIELD vim_marked MODULE liste_mark_checkbox.CHAIN.FIELD zmmt0013d-zcpxh .MODULE liste_update_liste.ENDCHAIN.ENDLOOP.MODULE liste_after_loop.PROCESS ON VALUE-REQUEST.FIELD zmmt0013d-zcpxh MODULE frm_zcpxh.FIELD zmmt0013d-zclass2 MODULE frm_cl2help.FIELD zmmt0013d-zclass1 MODULE frm_cl1help.
MODULE frm_cl2help INPUT.DATA: gt_dynpfields1 TYPE STANDARD TABLE OF dynpread,gs_dynpfields1 TYPE dynpread,gt_return1 TYPE STANDARD TABLE OF ddshretval,gs_return1 TYPE ddshretval,gv_povstepl1 TYPE sy-stepl,gv_index1 TYPE sy-stepl.DATA : gt_systems1 LIKE dynpread OCCURS 0 WITH HEADER LINE.TYPES:BEGIN OF gty_wlms,class TYPE klah-class,kschl TYPE swor-kschl,END OF gty_wlms.DATA:gt_data TYPE TABLE OF gty_wlms,gv_class TYPE zmmt0013d-zclass2,gv_classt TYPE zmmt0013d-zclass2t.* 获取本页当前行号CALL FUNCTION 'DYNP_GET_STEPL' "#EC CI_SUBRCIMPORTINGpovstepl = gv_povstepl1EXCEPTIONSstepl_not_found = 1.* 当前行号 = TC(包括翻页)的首行行号 + 本页当前行号 - 1gv_index1 = tctrl_zmmt0013d-top_line + gv_povstepl1 - 1.CLEAR gt_dynpfields1[].gs_dynpfields1-fieldname = 'ZMMT0013D-ZCLASS2'.gs_dynpfields1-stepl = gv_index1.APPEND gs_dynpfields1 TO gt_dynpfields1.CLEAR gs_dynpfields1.* 获取屏幕值(以防用户修改后未按回车)CALL FUNCTION 'DYNP_VALUES_READ' "#EC CI_SUBRCEXPORTINGdyname = sy-repiddynumb = sy-dynnrtranslate_to_upper = 'X'TABLESdynpfields = gt_dynpfields1EXCEPTIONSinvalid_abapworkarea = 1invalid_dynprofield = 2invalid_dynproname = 3invalid_dynpronummer = 4invalid_request = 5no_fielddescription = 6invalid_parameter = 7undefind_error = 8double_conversion = 9stepl_not_found = 10OTHERS = 11.READ TABLE gt_dynpfields1 INTO gs_dynpfields1 INDEX 1.IF sy-subrc = 0.gv_class = gs_dynpfields1-fieldvalue.ENDIF.* 获取值SELECT a~class,b~kschlFROM klah AS aLEFT JOIN swor AS bON a~clint = b~clintAND b~spras = '1'WHERE a~klart = '001'AND a~klagr = 'CLASS-03'INTO CORRESPONDING FIELDS OF TABLE @gt_data.IF sy-subrc = 0.SORT gt_data BY class.ENDIF.
* 自定义搜索帮助
* CLEAR :gt_return1,gs_return1.CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'EXPORTINGretfield = 'CLASS'
* dynpprog = sy-repid
* dynpnr = sy-dynnr
* dynprofield = 'ZCLASS2'value_org = 'S'TABLESvalue_tab = gt_datareturn_tab = gt_return1EXCEPTIONSparameter_error = 1no_values_found = 2OTHERS = 3.IF sy-subrc = 0.READ TABLE gt_return1 INTO gs_return1 INDEX 1.IF sy-subrc = 0.
* zbukrs_zhbblx-bukrs = gs_return1-fieldval.SELECT SINGLE a~kschl "#EC CI_SUBRCFROM swor AS aINNER JOIN klah AS bON a~clint = b~clintWHERE b~class = @gs_return1-fieldvalAND a~spras = '1'INTO @gv_classt.ENDIF.ENDIF.*更新屏幕上已经修改的字段CLEAR: gt_systems1[],gt_systems1.gt_systems1-fieldname = 'ZMMT0013D-ZCLASS2'.gt_systems1-stepl = gv_index1.gt_systems1-fieldvalue = gs_return1-fieldval. "返回的选择值APPEND gt_systems1.gt_systems1-fieldname = 'ZMMT0013D-ZCLASS2T'.gt_systems1-stepl = gv_index1.gt_systems1-fieldvalue = gv_classt.APPEND gt_systems1.CALL FUNCTION 'DYNP_VALUES_UPDATE' "#EC CI_SUBRCEXPORTINGdyname = sy-repiddynumb = '0001'TABLESdynpfields = gt_systems1EXCEPTIONSinvalid_abapworkarea = 1invalid_dynprofield = 2invalid_dynproname = 3invalid_dynpronummer = 4invalid_request = 5no_fielddescription = 6undefind_error = 7OTHERS = 8.IF sy-subrc <> 0.ENDIF.ENDMODULE.
产品型号搜索帮助,直接添加没有描述
MODULE frm_zcpxh INPUT.TYPES:BEGIN OF gty_wlms1,class TYPE klah-class,
* kschl TYPE swor-kschl,END OF gty_wlms1.DATA:gt_data1 TYPE TABLE OF gty_wlms1.DATA: gt_return TYPE ddshretval OCCURS 0 .CLEAR:gt_data1,gt_return.
* 获取值SELECT a~classFROM klah AS aWHERE a~class NE '0'AND a~klart = '001'AND a~klagr = 'PRD_MODEL'INTO CORRESPONDING FIELDS OF TABLE @gt_data1.IF sy-subrc = 0.SORT gt_data1 BY class.ENDIF.* "将取到的值通过函数显示在搜索帮助显示框中CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'EXPORTINGretfield = 'CLASS'dynpprog = sy-repiddynpnr = sy-dynnrdynprofield = 'ZCPXH'value_org = 'S'callback_program = sy-repidTABLESvalue_tab = gt_data1return_tab = gt_returnEXCEPTIONSparameter_error = 1no_values_found = 2OTHERS = 3.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.ENDMODULE.
这篇关于SM30 给字段添加搜索帮助同时带出描述,手动输入后回车带出描述的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!