2007 Aug 29 8:27 AM
how to hide a field(column) based on the user in basic or secondary list
2007 Aug 29 8:29 AM
hi,
No need to retrieve the field from the database if u dont want that field.
2007 Aug 29 8:30 AM
enclose the hide statement in if and endif.
if sy-uname = 'abc'.
hide zvar.
endif.
2007 Aug 29 8:31 AM
hi,
After a write stetment write
<b>hide fieldnaem</b>
We can use HIDE technique while creating LIST level to store line -specific information for later use.
syntax: HIDE <variable>.
this statement place the contents of the variable <variable> for the current output line(SY-LINNO) into the HIDE area.
you can think of the HIDE area as a table, in which the system stores the field name, field contents and line number in which field exisisting. as soon as they are needed the system reads the values from the table(HIDE) using READ LINE statement.
Keep in mind while working with HIDE.
1) Allways keep HIDE <variable> statement after WRITE statement for more readable format.
2) All way keep HIDE <variable> statement inside the LOOP statement, because syatem stores all the hide variable in system genarated table space, we can process table data throug it's work area only.
Sample Program.
Report Zreport_hide.
*table work area
tables: lfa1,ekko,ekpo.
*selection-screen logic
select-options: s_lifnr for lfa1-lifnr obligatory.
*logic for creating internal table
data: begin of it _lfa1 occurs 0,
it_lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of it_lfa1.
data: begin of it _ekko occurs 0,
it_ebeln like ekko-ebeln,
aedat like ekko-aedat,
end of it_ekko.
logic for genarating basic list
start-of-selection.
select lifnr name1 from lfa1 into table it_lfa1 where lifnr in s_lifnr.
*processing the data.
loop at it_lfa1.
write:/ it_lfa1-lifnr,
it_lfa1-name1,'
HIDE it_lfa1-lifnr. "here hide the varible lifnr
endloop.
*logic for genarating secondary list
at line-selection.
case sy-lsind.
when 1.
select ebeln aedat from ekko into table it_ekko where lifnr = it_lfa1-lifnr.
*processing seconadry list data.
loop at it_ekko.
write:/ it_ekko-ebeln,
it_ekko-aedat,
endloop.
regards,
Regards
Message was edited by:
ASHOK KUMAR
2007 Aug 29 8:34 AM
hi,
use HIDE KEYWORD TO HIDE A column as
in end of selection event, after u display clicked item to user use hide statement as
HIDE ITAB-MATNR. // MATNR IS THE CLICKED ITEM I THE INTERNAL TABLE ITAB.
IF HELPFUL REWARD SOME POINTS.
with regards,
Suresh Aluri.
2007 Aug 29 8:34 AM
Hi ,
Use the system field SY-UNAME to find the user name.and then set the no_out property of the field as 'X' in field catalog.
fieldcat-fieldname= 'ITAB-WRBTR'.
If sy-uname = 'VIGNESH'.
fieldcat-no_out = 'X'.
endif.
append fieldcat to it_fieldcat.