Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

while using alv

Former Member
0 Likes
855

Why do we need to prepare layout?

And the procedure.

Please help.

Thanks in advance.

deniz.

6 REPLIES 6
Read only

Former Member
0 Likes
796

field catalog is used give some descriptions for different columns individually.

layout is used to describe the table as a hole.

Like u can use columnwidth_optimize - to optimize the width of the entire table.

go through the slis_layout_alv in SLIS.

Read only

Former Member
0 Likes
796

To define general appearance of our ALV Grid we fill a structure of type “LVC_S_LAYO”.

example code :

FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.

ps_layout-zebra = 'X' .

ps_layout-grid_title = 'Flights' .

ps_layout-smalltitle = 'X' .

ENDFORM.

some of the fields in the structure lvc_s_layo can be set are:

CWIDTH_OPT

If this field is set, the ALV Grid Control optimizes the column width. You can then see the column header and the contents of the cells of this column.

SPACE, 'X'

SMALLTITLE

If this field is set, the title size in the grid control is set to the font size of the column header.

SPACE, 'X'

GRID_TITLE

Title between grid control and toolbar

Char string of max. 70

NO_HEADERS

If this field is set, column headers are hidden.

SPACE, 'X'

NO_HGRIDLN

If this field is set, columns are displayed without horizontal grid lines.

SPACE, 'X'

NO_MERGING

If this field is set, cells are not merged when a column is sorted.

SPACE, 'X'

NO_ROWMARK

If this field is set, the button at the beginning of a row is hidden in selection modes cell selection ( SEL_MODE = 'D' ) and column/row selection ( SEL_MODE = 'A' ).

SPACE, 'X'

NO_TOOLBAR

If this field is set, the toolbar is hidden.

SPACE, 'X'

NO_VGRIDLN

If this field is set, columns are displayed without vertical grid lines.

SPACE, 'X'

SEL_MODE

Set the selection mode (see table at C.4.).

SPACE, 'A', 'B', 'C', 'D'

Message was edited by:

Sridhar Srirama

Read only

Former Member
0 Likes
796

hi deniz,

suppose if u r having many fcat's.... and only a few fcat u need to be displayed while loading....

then u can layout's.

for ex : fcat 1 --- fcat 10 --- layout 1.

fcat 11 -


fcat20 --- layout2...

for that,

in the reuse_alv fn module u hav to specify this line

I_SAVE = 'A'

then, after execution, from the alv scrren,

goto menu settings --> change / choose.... in that u hav u select the fields and save it....

With Regards,

S.Barani

Read only

Former Member
0 Likes
796

hi,

field catalog is used for a structured display of report. displaying the output fields in a structure is important as the ned user should able to know that what field in which position. and in field catalog used-defiend names for fields is also possible by 'seltext option'.and also it has 'do-sum' option for caluclating totals.

........

......

so for more readability field catalog is used in alvs

if helpful reward some points.

with regards,

suresh babu.

Read only

Former Member
0 Likes
796

The layout contains fields for setting graphical properties of the grid control, displaying exceptions, calculating totals and enabling specific interaction options.

Regards,

Naveena.

Read only

0 Likes
796

Comon guys --this method is "Out of the ark".

Use this type of approach for SIMPLE classic ALV list formatting

data: lr_functions type ref to cl_salv_functions_list.

ata: gr_table TYPE REF TO cl_salv_table.

data: gr_container type ref to cl_gui_custom_container.

data: gr_display TYPE REF to cl_salv_display_settings.

constants: gc_true type sap_bool value 'X',

gc_false type sap_bool value space.

  • add for colour displays

data: ls_color type lvc_s_colo.

DATA : LV_SALV_COLUMNS_TABLE TYPE REF TO CL_SALV_COLUMNS_TABLE.

data: lr_columns type ref to cl_salv_columns_table,

lr_column type ref to cl_salv_column_table.

TRY.

CALL METHOD cl_salv_table=>factory

EXPORTING

list_display = if_salv_c_bool_sap=>false "display as a LIST

IMPORTING

r_salv_table = gr_table

CHANGING

t_table = t_vbak. "Your internal table

CATCH cx_salv_msg.

ENDTRY.

try.

LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).

lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).

ls_color-col = col_negative.

ls_color-int = 0.

ls_color-inv = 0.

lr_column->set_color( ls_color ).

catch cx_salv_not_found.

endtry.

try.

lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'VBELN' ).

ls_color-col = col_negative.

ls_color-int = 1.

ls_color-inv = 1.

lr_column->set_color( ls_color ).

catch cx_salv_not_found.

endtry.

try.

*LV_SALV_COLUMNS_TABLE = gr_table->get_columns( ).

lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'NETWR' ).

lr_column->set_short_text( 'Short' ).

lr_column->set_medium_text( 'Medium' ).

lr_column->set_long_text( 'Net Value' ).

*lr_column ?= LV_SALV_COLUMNS_TABLE->get_column( 'URL' ).

*

catch cx_salv_not_found.

endtry.

gr_table->set_screen_status( pfstatus = 'SALV_STANDARD'

report = sy-repid

  • you only need above statement if you want to use an ALV * with standard functionality as dialog job

set_functions = gr_table->c_functions_all ).

gr_display = gr_table->get_display_settings( ).

gr_display->set_horizontal_lines( value = ' ' ). "Switch Off horizontal lines

gr_display->set_vertical_lines( value = ' ' ). "Switch off Vertical lines

  • this statement actually does the display.

gr_table->display( ).

No field catalog or whatever needed.

Forget all the OLD STUFF. It''s long, complicated and you are much more likely to make an error.

Note that the class cl_salv_table doesn't allow you to EDIT data so if you need to EDIT columns / add / modify stuff then you'll need the more complex class cl_gui_alv_grid but when you just need to DISPLAY data use the class cl_salv_table. Works in BATCH as well without change.

Cheers

Jimbo