09-20-2007 11:36 AM
Hi,
I have an ALV report that basically works. The problem is when users try to select columns in 'Change Layout', some of the column names are different from what is displayed in the list. E.g. one column header is 'DOB' in the list, but in the column selection, it is 'Birth date'. In the internal table, this field is is defined as: GBDAT LIKE P0002-GBDAT. And in the field catalogue definition, all fields have the following definitions:
<FS_GT_FIELDCAT>-SELTEXT_L = 'DOB'. (The text changes for each field.)
<FS_GT_FIELDCAT>-DDICTXT = 'L'.
So what is wrong?
Thanks a lot,
RW
09-20-2007 2:03 PM
Add these lines to your catalog.
<FS_GT_FIELDCAT>-SELTEXT_M = 'DOB'.
by default it picks the Medium one for displaying in the Layout settings option.
this will solve the problem.
09-20-2007 2:05 PM
please do like this
<FS_GT_FIELDCAT>-SELTEXT_M = 'DOB'.
<FS_GT_FIELDCAT>-DDICTXT = 'M'.
now it will work.
09-20-2007 2:51 PM
hi,
can u plz paste the code so that i can help u.
thanks,
maheedhar
09-21-2007 4:14 AM
Hi,
I tried you guys' suggestions but they didn't work. I found SELTEXT_M and DDICTXT = 'M' are not as important as you suggested. It seems if the text value I use is less than 10 characters, e.g. 'DOB' is only 3 chars, then the system will use it's default 10 chars description in column selection, although the column header in the displayed list is 'DOB'. In this case, the system always use 'Birth date' as the column selection text.
Please try the following code. You can increase the length of the text 'DOB' to e.g. 'DOB123456789' to see how it works. In my system, it's very ridiculous: with DDICTXT = 'L', the system uses the short/medium text 'Birth date' in column selection; while with DDICTXT = 'M', the system uses the long text 'Date of birth'. I'm totally lost about how the column selection text is controlled.
Thanks a lot,
RW
REPORT ZALV.
TABLES: P0002.
TYPE-POOLS: SLIS.
DATA: BEGIN OF GT_EE_INFO OCCURS 0,
DAT1 LIKE P0002-GBDAT, " Date of birthday
DAT2 LIKE P0002-GBDAT, " Date of birthday
END OF GT_EE_INFO.
START-OF-SELECTION.
GT_EE_INFO-DAT1 = '19700101'.
GT_EE_INFO-DAT2 = '19700102'.
APPEND GT_EE_INFO.
END-OF-SELECTION.
PERFORM FRM_SHOW_DATA.
FORM FRM_SHOW_DATA.
PERFORM FRM_OUTPUT_BY_ALV TABLES GT_EE_INFO USING 'GT_EE_INFO'.
ENDFORM. " FRM_SHOW_DATA
FORM FRM_OUTPUT_BY_ALV TABLES I_TABLE USING VALUE(ITABNAM).
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_SAVE TYPE C,
G_VARIANT LIKE DISVARIANT.
DATA: G_REPID LIKE SY-REPID.
FIELD-SYMBOLS: <FS_GT_FIELDCAT> TYPE SLIS_FIELDCAT_ALV.
G_REPID = SY-REPID.
G_SAVE = 'A'.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-F2CODE = '&ETA'.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = G_REPID
I_INTERNAL_TABNAME = ITABNAM
I_INCLNAME = G_REPID
CHANGING
CT_FIELDCAT = GT_FIELDCAT.
LOOP AT GT_FIELDCAT ASSIGNING <FS_GT_FIELDCAT>.
CASE <FS_GT_FIELDCAT>-FIELDNAME.
WHEN 'DAT1'.
<FS_GT_FIELDCAT>-SELTEXT_L = 'DOB1'.
<FS_GT_FIELDCAT>-DDICTXT = 'L'.
WHEN 'DAT2'.
<FS_GT_FIELDCAT>-SELTEXT_M = 'DOB2'.
<FS_GT_FIELDCAT>-DDICTXT = 'M'.
ENDCASE.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IT_FIELDCAT = GT_FIELDCAT[]
IS_LAYOUT = GS_LAYOUT
I_SAVE = G_SAVE
I_GRID_TITLE = SY-TITLE
IT_EVENTS = GT_EVENTS[]
IS_VARIANT = G_VARIANT
TABLES
T_OUTTAB = I_TABLE.
ENDFORM. " FRM_OUTPUT_BY_ALV
10-14-2011 7:51 AM
Hi ,
This is simple problem you no need to worry about this Just you can do one thing
While filling the field catalog don't mention the reference field name and reference table name
Give the text whatever you want as SELTEXT_M
ex : wa_fieldcat-seltext_m = 'DOB' .
Thanks ,
Mallikarjun