*&---------------------------------------------------------------------* *& Report ZPARMETERS3 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zparmeters3. TYPE-POOLS:slis. TABLES vbak. PARAMETERS p1 TYPE char10 DEFAULT '公海客户'. START-OF-SELECTION. PERFORM getdata. FORM getdata . DATA tables TYPE TABLE OF ztcategory. "数据字典分类表 DATA layout TYPE slis_layout_alv. "Layout布局对象 DATA wa TYPE slis_fieldcat_alv. "字段对象 DATA list TYPE TABLE OF slis_fieldcat_alv."字段集合 DATA lv_where type string VALUE ' zestatus = 1 '. IF p1 is NOT INITIAL. CONCATENATE lv_where ' and ZECATNAME = p1 ' INTO lv_where SEPARATED BY space. ENDIF. CLEAR wa. SELECT * INTO CORRESPONDING FIELDS OF TABLE tables FROM ztcategory where (lv_where) . wa-key = 'x'."是否是主键 wa-fieldname = 'ZEID'."编号 wa-ref_fieldname = 'ZEID'. "参考字段编号 wa-ref_tabname = 'ZTCATEGORY'. "参考数据表 wa-seltext_m = '编号'. wa-just = 'C'. APPEND wa TO list. CLEAR wa. wa-fieldname = 'ZECREATEDATE'."创建日期 wa-ref_fieldname = 'ZECREATEDATE'. "参考字段 wa-ref_tabname = 'ZTCATEGORY'. "参考数据表 wa-seltext_m = '创建日期'. APPEND wa TO list. wa-fieldname = 'ZECREATETIME'."创建时间 wa-ref_fieldname = 'ZECREATETIME'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '创建时间'. APPEND wa TO list. wa-fieldname = 'ZECODE'. wa-ref_fieldname = 'ZECODE'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '状态码'. wa-just = 'C'. APPEND wa TO list. wa-fieldname = 'ZECATNAME'. wa-ref_fieldname = 'ZECATNAME'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '分类名称'. wa-just = 'L'. APPEND wa TO list. wa-fieldname = 'ZESORT'. wa-ref_fieldname = 'ZESORT'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '数字排序'. wa-just = 'C'. APPEND wa TO list. wa-fieldname = 'ZESTATUS'. wa-ref_fieldname = 'ZESTATUS'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '当前状态'. wa-just = 'L'. APPEND wa TO list. wa-fieldname = 'ZEREMARK'. wa-ref_fieldname = 'ZEREMARK'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '描述说明'. wa-just = 'L'. APPEND wa TO list. wa-fieldname = 'ZECONTENT'. wa-ref_fieldname = 'ZECONTENT'. wa-ref_tabname = 'ZTCATEGORY'. wa-seltext_m = '状态描述'. wa-just = 'L'. APPEND wa TO list. *=================================================================== layout-zebra = 'X'. layout-colwidth_optimize = 'X'. layout-detail_popup = 'X'. layout-colwidth_optimize = 'X'. layout-detail_titlebar = '客户状态分类详细'. layout-f2code = '&ETA'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = IS_LAYOUT = layout IT_FIELDCAT = list * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = tables * EXCEPTIONS * PROGRAM_ERROR = 1 * OTHERS = 2 . IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. ENDFORM.
标签:layout,wa,list,seltext,abap,fieldname,sql,动态,ref From: https://www.cnblogs.com/hua900822/p/17268527.html