on 11-20-2003 10:29 AM
Dear colleagues,
Is it possible to have more then one ALV grid on the screen? For example two tables with different structures. If yes, could you please share some ideas how it can be done.
here is the code
&----
*& Report ZTKALVGRID1 *
*& *
&----
*& *
*& *
&----
report ztkalvgrid1.
data: container1 type ref to cl_gui_custom_container,
grid type ref to cl_gui_alv_grid.
data: container2 type ref to cl_gui_custom_container,
grid1 type ref to cl_gui_alv_grid.
data: gt_fieldcat type lvc_t_fcat,
wa_fieldcat like line of gt_fieldcat.
data: i_output like kna1 occurs 0 with header line.
data: i_struct like line of i_output.
data: i_alv like standard table of i_output.
data: i_alv1 like standard table of i_output.
select * from kna1 up to 10 rows into corresponding
fields of table i_output
where land1 = 'IN'.
delete i_output from 100 to 8622.
call screen '100'.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module status_0100 output.
set pf-status 'ALV'.
SET TITLEBAR 'xxx'.
if container1 is initial.
create object container1 exporting container_name = 'ALV'.
create object grid exporting i_parent = container1.
endif.
if container2 is initial.
create object container2 exporting container_name = 'ALV1'.
create object grid1 exporting i_parent = container2.
endif.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module DISPLAY_ALV OUTPUT
&----
text
----
module display_alv output.
*REFRESH gt_fieldcat.
*
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-coltext = 'CUSTOMER NAME'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-intlen = 20.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO gt_fieldcat.
*
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'KUNNR'.
wa_fieldcat-coltext = 'CUSTOMER CODE'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-intlen = 15.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO gt_fieldcat.
refresh i_alv.
clear i_alv.
clear i_output.
i_alv[] = i_output[].
i_alv1[] = i_output[].
call method grid->set_table_for_first_display
exporting i_structure_name = 'kna1'
changing it_outtab = i_alv.
call method grid1->set_table_for_first_display
exporting i_structure_name = 'kna1'
changing it_outtab = i_alv1.
endmodule. " DISPLAY_ALV OUTPUT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi copy thins pgm and on screnn 100 create 2 custom contrlols with names defined as in the pgm 'ALV'.. and put the moudles defined in the pgm in PBO of the screen.
regards,
kiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All demo programs for ALV using classes start can be found using BCALV*.
Also, Have a look at BCALV_VERIFY_DATATYPES.
We can have multiple ALVs in one screen.
Just place multiple custom controls on the csreen and create objects of type cl_gui_custom_container.
mail me for more info.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
some basic ALV creation and examples can be found here http://www.sapdevelopment.co.uk within the menu/section: ABAP Dev-> Reporting Development-> Advanced List Viewer(ALV)
if you are happy with the ALV list rather than the ALV grid functionality sap program BALVBT01 demonstrates multiply alvs on same page
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use this for Hierearchy
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = h_layout
it_fieldcat = hfield
i_save = x_save
is_variant = g_variant
it_events = gt_hevents
i_tabname_header = 'OUTTAB'
i_tabname_item = 'IDATA'
is_keyinfo = gs_keyinfo
is_print = is_t_print
tables
t_outtab_header = outtab
t_outtab_item = idata.
else use
REUSE_ALV_BLOCK_LIST_APPEND
and
REUSE_ALV_BLOCK_LIST_DISPLAY
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sventlana,
You can have many ALV grid controls in a screen if you use object oriented ALV (not REUSE_ALV function modules). You just have to create as many containers in your screen and then create the ALV grids in your program. If you have never used OO ALV grids in the past, you will find a lot of example programs named BCALV*. I don't know if there is an example showing multiple grids in one screen.
If you expect your program to be run in background, it will become difficult to implement this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An HR example of multi ALV grids is available in the HR Expert Online Download area.
http://www.hrexpertonline.com/
See below:
For: "What You're Missing Without Custom HR ABAP Object Technology," by James McCallum, SAP HR Consultant. The author supplements his article with the following:
Examples for all ABAP Objects mentioned in the article including attributes and method implementations for the Employee, Payroll, and ALV Grid Managers objects.
Example ABAP Data Dictionary objects needed for using the HR ABAP Objects including structures and table types.
Example coding for the Payroll Cluster Comparative Viewer (PCCV) program and data retrieval function modules used by the Employee and Payroll objects.
Supplemental ABAP Data Dictionary objects needed for 4.6B implementations.
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.