2007 Sep 24 11:05 AM
hi i hav a simple alv which contains five columns
i want to show only three columns
how to do this?
hi i hav a simple alv which contains five columns
i want to show only three columns
how to do this?
2007 Sep 24 11:07 AM
comment the field catalogs for the columns which u dont want to show in output.
reward points please...
2007 Sep 24 11:07 AM
2007 Sep 24 11:11 AM
Hi,
You can change the field catalog to achieve this.
And then call the method "alvgrid->set_table_for_first_display" and pass the field catalog to it.
Regards,
Sheron
2007 Sep 24 11:15 AM
Hi,
In the field catalog , just define the columns which u want to display.Then only that columns will be displayed.I am sending a simple eg of ALV in which i am displaying three columns Purchase orde, material no and net price from ekpo table.
Plz reward if useful.
Thanks.
REPORT ZHALV.
tables:ekpo.
data itab_ekpo type ekpo occurs 100 with header line.
types: begin of itab_new,
ebeln type ekpo-ebeln,
matnr type ekpo-matnr,
netpr type ekpo-netpr,
end of itab_new.
data itab1 TYPE STANDARD TABLE OF itab_new initial size 0.
type-pools: slis.
DATA: l_layout TYPE slis_layout_alv.
DATA : l_sort TYPE slis_t_sortinfo_alv,
w_sort TYPE slis_sortinfo_alv.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv, lf_fieldcat TYPE slis_fieldcat_alv.
DATA: ws_repid TYPE sy-repid VALUE 'ZHALV'.
selection-screen Begin of block block1 with frame title text-111.
select-options : S_EBELN for EKPO-EBELN.
selection-screen end of block block1.
INITIALIZATION.
start-of-selection.
select ebeln matnr netpr from ekpo into table itab1 up to 10 rows WHERE EBELN IN S_EBELN.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM GET_DETAILS.
PERFORM sort_layout.
end-of-selection.
&----
*& Form build_fieldcatalog
&----
text
----
**********************************************************************
Look fieldcatlog below carefully wher i am displaying three columns po,mat.no and
netprice.
*********************************************************************
FORM build_fieldcatalog .
PURCHASING DOCUMENT NUMBER
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'EBELN'.
lf_fieldcat-ref_tabname = 'EKKO'.
lf_fieldcat-ref_fieldname = 'EBELN'.
APPEND lf_fieldcat TO lt_fieldcat.
MATERIAL NUMBER
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'MATNR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'MATNR'.
APPEND lf_fieldcat TO lt_fieldcat.
NET PRICE IN PURCHASING DOCUMENT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'NETPR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'NETPR'.
lf_fieldcat-cfieldname = 'WAERS'.
lf_fieldcat-do_sum = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
ENDFORM. " build_fieldcatalog
&----
*& Form GET_DETAILS
&----
text
----
FORM GET_DETAILS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = ws_repid
IT_FIELDCAT = lt_fieldcat
TABLES
T_OUTTAB = itab1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
ENDIF.
ENDFORM. "GET_DETAILS
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |