‎2007 Mar 28 7:51 PM
ALV
i have created table types (tt1) with f1,f2,f3 and f4 and (tt2) f5 and f6 using different line types.
Now i want display column order f6,f4,f3,f2,f5 and f1 in alv output .
it should happen before displaying the alv out put.
i don'T want go for ALV varient methood and change layout after ALV display.
any thoughts about this logic...
...Nandha
‎2007 Mar 28 7:56 PM
‎2007 Mar 28 7:56 PM
‎2007 Mar 28 8:01 PM
For example, say you are using the MERGE field catalog, notice in this example, i'm loop thru the field catalog and changing the column position numbers.
type-pools: slis.
data: begin of xma,
matnr like makt-matnr,
maktx like makt-maktx,
fld1(10) type c,
fld2(10) type c,
end of xma.
data: ima like standard table of xma with header line.
data: fieldcat type slis_t_fieldcat_alv.
data: wa_fieldcat like line of fieldcat.
data: repid type syrepid.
repid = sy-repid.
select matnr maktx
into table ima
from makt
up to 100 rows
where spras = sy-langu.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repid
i_internal_tabname = 'XMA'
i_inclname = repid
i_bypassing_buffer = 'X'
changing
ct_fieldcat = fieldcat.
loop at fieldcat into wa_fieldcat.
case wa_fieldcat-fieldname.
when 'FLD1'.
wa_fieldcat-col_pos = '1'.
when 'FLD2'.
wa_fieldcat-col_pos = '2'.
when 'MATNR'.
wa_fieldcat-col_pos = '3'.
when 'MAKTX'.
wa_fieldcat-col_pos = '4'.
endcase.
modify fieldcat from wa_fieldcat index sy-tabix.
endloop..
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
tables
t_outtab = ima.
Regards,
Rich HEilman
‎2007 Mar 28 8:01 PM
‎2007 Mar 28 8:01 PM
Nandha,
Create a field catalog of whichever order in which you need the fields and then pass this fieldcatalog to
if you are use REUSE* fm then pass this as import parameter
of
if you are using class set_table_first_display then pass fieldcatalog as import table parameter.
Search this site , you will get lot of example programs
aRs