在做VL01N/VL02N/VL02N的项目屏幕增强的时候,因为module模块是写在函数组的include模块中的,所以不能直接使用屏幕字段,直接访问关联字典的屏幕字段报错:
1.在函数组包含top文件LZFG_DELIVERY_ENHCTOP中声明表结构:
然后在module包含文件中可以直接访问屏幕变量lips-prueflos, lips-vcode.
-------------------------------------------------------------------------------------------------------
2.调用函数:DYNP_VALUES_READ
*&---------------------------------------------------------------------* *& Module GET_VCODETXT INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE GET_VCODETXT INPUT. BREAK ybin. DATA iv_vcode TYPE lips-vcode. DATA vcodetxt TYPE qpct-kurztext. DATA: lt_dynpread TYPE STANDARD TABLE OF dynpread . DATA: lw_dynpread TYPE dynpread .
CLEAR lt_dynpread[].
CLEAR lw_dynpread. lw_dynpread-fieldname = 'LIPS-VCODE'. APPEND lw_dynpread TO lt_dynpread . CALL FUNCTION 'DYNP_VALUES_READ' EXPORTING dyname = sy-repid dynumb = sy-dynnr TABLES dynpfields = lt_dynpread EXCEPTIONS invalid_abapworkarea = 1 invalid_dynprofield = 2 invalid_dynproname = 3 invalid_dynpronummer = 4 invalid_request = 5 no_fielddescription = 6 invalid_parameter = 7 undefind_error = 8 double_conversion = 9 stepl_not_found = 10 OTHERS = 11. IF sy-subrc = 0. CLEAR lw_dynpread. READ TABLE lt_dynpread INTO lw_dynpread WITH KEY fieldname = 'LIPS-VCODE'. IF sy-subrc = 0. CLEAR: iv_vcode, vcodetxt. iv_vcode = lw_dynpread-fieldvalue. vcodetxt = lw_dynpread-fieldvalue. ENDIF. ENDIF. ENDMODULE.