SAP Development

Help and Information for SAP/ABAP development professionals around the world

Replies to This Discussion

Checkout: http://en.wikipedia.org/wiki/ABAP

Search for: REUSE_ALV_FIELDCATALOG_MERGE

Basically you pass it an internal table and it returns a field catalog that you can pass into your ALV display function.

Reply to This

Hi there,

check out this ALV grid for details on creating basic and advanced ALV grids including how to build the fieldcatalog. Here is the code for creating your ALV grid including how to define your ALV fieldcatalog

Regards
Mart

Reply to This

I am really pleased with the latest ALV tools. You just don’t need to bother with all the fiddly catalog details. I created an impressive report with only a few lines. The framework is presented here with only a few (field specific) bits removed (as the original is copyright to my employer).

types: begin of t_slo, "for detail of storage location
[various field declarations]
end of t_slo.
data: gt_oiislo type table of t_slo,
wa_oiislo type t_slo,
go_alv type ref to cl_salv_table,
go_columns type ref to cl_salv_columns_table,
go_column type ref to cl_salv_column_table,
go_functions type ref to cl_salv_functions_list.
START-OF-SELECTION.
* Just one command to gather all required data from three tables
select [various fields]
into corresponding fields of table gt_oiislo
from oiisocisl
inner join mard on [conditions]
inner join oiisock on [conditions]
where [values meet selection criteria]
END-OF-SELECTION.
* Prepare the standard Objects as a global object instance go_alv to deal with internal table gt_oiislo.
call method cl_salv_table=>factory
importing r_salv_table = go_alv
changing t_table = gt_oiislo.
* Optimize the width of columns to the data displayed
go_columns = go_alv->get_columns( ).
go_columns->set_optimize( ).
* Example of dynamic alteration of display characteristics
loop at gt_oiislo into wa_oiislo where volun ne 'L'.
exit. "if it gets here, there is a strange unit present, show it
endloop.
if sy-subrc ne 0. "then all in litres so can hide the unit column
go_column ?= go_columns->get_column( 'VOLUN' ).
go_column->set_visible( ' ' ).
endif.
* Provide all the standard functional buttons
go_functions = go_alv->get_functions( ).
go_functions->set_all( ).
* Present the report to screen
go_alv->display( ).

…and there you have it!

Except this stupid editor screws up my edits so there's no indents and most importantly wherever you see ">" it should be a right arrow head (right chevron).

Reply to This

RSS

About

sapdev sapdev created this social network on Ning.

Create your own social network!

© 2009   Created by sapdev on Ning.   Create Your Own Social Network

Badges  |  Report an Issue  |  Privacy  |  Terms of Service