TYPE-POOLS: SLIS.
DATA: RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: G_REPID LIKE SY-REPID.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: POS TYPE I VALUE 1.
G_REPID = SY-REPID.
DATA: L_WA_LYOUT TYPE SLIS_LAYOUT_ALV. -----要写一个这个语句
就是参照ALV的FUNCTION定义一个结构.
CLEAR LS_FIELDCAT. "//归档文件
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-FIELDNAME = 'FILENAME'.
LS_FIELDCAT-REF_FIELDNAME = 'FILENAME'.
LS_FIELDCAT-REF_TABNAME = 'ZARCHCD'.
LS_FIELDCAT-SELTEXT_L = '归档文件'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT. "//光盘名称
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-FIELDNAME = 'CDNAME'.
LS_FIELDCAT-REF_FIELDNAME = 'CDNAME'.
LS_FIELDCAT-REF_TABNAME = 'ZARCHCD'.
LS_FIELDCAT-SELTEXT_L = '光盘名称'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
L_WA_LYOUT-COLWIDTH_OPTIMIZE = 'X' 在这里加一条语句
它可以优化ALV的列宽
就是说列宽会随着字段内容的长度变化.
应该可以满足你的需求.
*---------------内存表数据输出到列表控件显示---------
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IT_FIELDCAT = RT_FIELDCAT[]
IS_LAYOUT = L_WA_LYOUT
I_SAVE = 'X'
TABLES
T_OUTTAB = showcd_itab.
文字文字
DATA: RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: G_REPID LIKE SY-REPID.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: POS TYPE I VALUE 1.
G_REPID = SY-REPID.
DATA: L_WA_LYOUT TYPE SLIS_LAYOUT_ALV. -----要写一个这个语句
就是参照ALV的FUNCTION定义一个结构.
CLEAR LS_FIELDCAT. "//归档文件
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-FIELDNAME = 'FILENAME'.
LS_FIELDCAT-REF_FIELDNAME = 'FILENAME'.
LS_FIELDCAT-REF_TABNAME = 'ZARCHCD'.
LS_FIELDCAT-SELTEXT_L = '归档文件'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT. "//光盘名称
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-FIELDNAME = 'CDNAME'.
LS_FIELDCAT-REF_FIELDNAME = 'CDNAME'.
LS_FIELDCAT-REF_TABNAME = 'ZARCHCD'.
LS_FIELDCAT-SELTEXT_L = '光盘名称'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
L_WA_LYOUT-COLWIDTH_OPTIMIZE = 'X' 在这里加一条语句
它可以优化ALV的列宽
就是说列宽会随着字段内容的长度变化.
应该可以满足你的需求.
*---------------内存表数据输出到列表控件显示---------
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IT_FIELDCAT = RT_FIELDCAT[]
IS_LAYOUT = L_WA_LYOUT
I_SAVE = 'X'
TABLES
T_OUTTAB = showcd_itab.
文字文字