Report with two ALV grids and a header
Hi experts,
I have a report with two ALV grids in the same screen, each one in a separated container. The information displays it correctly. The report has been implemented by using OO Programming.
My real trouble is in the header. It must have a logo, a title with a specific font and other information.
I'll attach a capture of my need:
[Report with two ALV grids and a header|http://picasaweb.google.com/lh/photo/AcQD49QPmm-0L_jL2iMedA?feat=directlink]
Then, I want to set up the header you can see, with logo, a font with specific features. Obviously, the header you see has taken from another report. But is the same idea.
I've tried with a third container, using the CL_GUI_CONTAINER and CL_GUI_CONTAINER classes, but it doesn't work.
Any idea? Would welcome any help you can provide.
Thanks in advance,
Jorge Rojas
Hi, Jorge.
Should the header be a"attached" to any of the ALV? Or it should be carried alone?
If first applies, you've given the solution yourself: put the info & logo in first ALV's header and invoke it from the proper method.
You could use CL_GUI_DOCKING_CONTAINER CLASS to divide screen in several containers and then, in the upper one, I would create another one docking container to divide the screen into two: the written info could be performed with an HTML viewer class and the logo with a CL_GUI_PICTURE element.
Cheers.
Similar Messages
-
Report with 5 ALV grids on 1 screen
I am trying to build a screen/report with 5 ALV grids which are interactive. One grid will display all sales order. When I click on a Sales order Hotspot, the items of the sales order would appear in the ALV grid box below.
When i click on an sales order item hotspot, i want the delivery information in another alv grid in the same screen.
There should be 2 more grids - one displaying the customer information -name,address, in one grid and one grid for open items if any. Any advice is welcome . Should I be creating a split container/docking container or multiple containers ? Sample code is welcome.
Edited by: Shareen Hegde on Apr 2, 2008 9:25 PMHello Shareen
Below I have added my sample report ZUS_SDN_THREE_ALV_GRIDS showing three interactive ALV grids. Perhaps it might be useful to you. I would prefer one or multiple splitter containers over multiple "stand-alone" containers.
*& Report ZUS_SDN_THREE_ALV_GRIDS
*& Display Customer data in three ALV lists:
*& 1st ALV: Customers
*& 2nd ALV: Sales order of selected customer (double-click)
*& 3rd ALV: Positions of selected sales order (double-click)
*& Double-click on material -> display material (MM02)
*& NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
*& Flow logic of dynpro '0100':
*&PROCESS BEFORE OUTPUT.
*& MODULE STATUS_0100.
*&PROCESS AFTER INPUT.
*& MODULE USER_COMMAND_0100.
REPORT zus_sdn_three_alv_grids.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_splitter_2 TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_vbak TYPE STANDARD TABLE OF vbak,
gt_vbap TYPE STANDARD TABLE OF vbap.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000'.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender. " sending control, i.e. ALV grid that raised event
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_vbak TYPE vbak,
ls_vbap TYPE vbap.
* Distinguish according to sending grid instance
CASE sender.
WHEN go_grid1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
WHEN go_grid2.
READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
WHEN go_grid3.
READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
CHECK ( ls_vbap-matnr IS NOT INITIAL ).
SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 2
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
* Create 2nd splitter container
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_cell_left
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid3
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_vbak.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_vbak " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH: gt_vbap.
CALL METHOD go_grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_vbap " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
CALL SCREEN '0100'.
* Flow logic of dynpro:
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "ORDERS"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Refresh display of detail ALV list
CALL METHOD go_grid3->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Orders"
WHEN 'ORDERS'.
PERFORM customer_show_orders.
WHEN 'ORDER_DETAILS'.
PERFORM order_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form CUSTOMER_SHOW_ORDERS
* text
* --> p1 text
* <-- p2 text
FORM customer_show_orders .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbak INTO TABLE gt_vbak
WHERE kunnr = ls_knb1-kunnr.
REFRESH: gt_vbap.
ENDFORM. " CUSTOMER_SHOW_ORDERS
*& Form ORDER_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM order_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_vbak TYPE vbak.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbap INTO TABLE gt_vbap
WHERE vbeln = ls_vbak-vbeln.
ENDFORM. " ORDER_SHOW_DETAILS
Regards
Uwe -
ALV print problems for reports with two sort fields and subtotal at each
When a report has two sort fields and subtotal at each of them, the print function is not working correctly. Please see the report below.
The second "" (single star) record (the 10 RL record) and the '*' (double star) record (the 12 RL record) are not printing.
This is happening for any standard SAP reports. Any resolution? Any OSS Notes?
Material/Stock Code Grade Units Count Unit Type Set Position LFT
520085V000 7818 1 RL A 19,682 LF
520085V000 7818 1 RL A 19,682 LF
* 520085V000 2 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 1 RL
599098V000 7717 1 RL A 36,167 LF
* 599098V000 10 RL
** 12 RL
*** 12
Thanks
Anand
Edited by: Anand Velayudhan on Feb 9, 2009 11:50 PMHi,
Check these OSS Notes..
Note 975777 - ALV total: Subtotals disappear from printout
Note 1039655 - ALV total: Subtotals disappear from printout II
Thanks
Naren -
Problem with same layout (variant) for two ALV Grid and ALV Tree
Hello!
I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
How to avoid this?Hi,
Take Two radio buttons.
First radion button display the two containers in grid format,
second radio button display the two containers in tree format base on user selection.
CREATE OBJECT G_DOCING_CONTAINER
EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
DISPLAY THE DATA IN GRID FORMATA
CREATE OBJECT r_grid
EXPORTING
i_parent = G_DOCING_CONTAINER
CALL METHOD g_docing_container->set_width
EXPORTING
width = 1300.
DISPLAY THE GRID DATA IN SECOND CONTAINER
CREATE OBJECT r_grid1
EXPORTING
i_parent = G_DOCING_CONTAINER
CALL METHOD g_docing_container->set_width
EXPORTING
width = 1300.
OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
CREATE OBJECT g_tree
EXPORTING
parent = g_docing_container"g_custom_container
IF R1 = 'X'. "FOR GRID DISPLAY
CALL METHOD r_grid1->set_table_for_first_display
CALL METHOD r_grid2->set_table_for_first_display
ELSE.
************TREE DISPLAY
ENDIF.
regards,
muralii -
How to create report with two independent queries and templates?
Hi,
I have a requirement where I have to use two queries in Data Template. Now, these queries are unrelated and I need to display data from these two queries in my report. Can anyone let me know how to do this?Hi Thanks alot...It works.
Is it possible to create two independent SQL queries too and display the o/p from both queris in report?
Thanks alot in advance. -
Hi,
How to create Report With Two Heading
[http://apex.oracle.com/pls/apex/f?p=267:31:]
thanksSee: Re: Two level row header
-
ALV REPORT: read selected checkbox in alv grid and process the pushbutton
my requirement is to check some rows from alv grid and the press the pushbutton. Thereby following things should process:
select all checked rows into an itab and call the transaction code CJ01 for all
entries......
I am finding the problem that when I select the checkbox....the internal table doesnt recognize the boxes as checked ones......
thanks in advance...
Kartikey Singh,Data: ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
loop at t_output where Flag = 'X'.
if t_output-VKUEGRU is initial.
message e000 with text-110.
endif.
endloop. -
Background Execution Problem-Docking Container with 2 ALV Grids in one scre
Hi Friends,
I have created 2 ALV Grids in one screen - one below another using DOCKING CONTAINER.
The objects are 'g_dock_cont' and 'g_dock_cont1'.
I am getting the foreground output as expected with 2 ALV Grids.
While executing in background (F9), I am getting only output of first ALV grid. Second ALV is not getting displayed in BACKGROUND(F9) mode.
How to solve this.
FORM create_objects.
* Materials with data
IF g_dock_cont IS INITIAL.
IF sy-batch NE 'X'.
*CREATE THE OBJECT FOR DOCKING CONTAINER
CREATE OBJECT g_dock_cont
EXPORTING
side = cl_gui_docking_container=>dock_at_top
extension = 300.
ENDIF.
*CREATE THE OBJECT FOR ALV GRID
CREATE OBJECT g_alvgrid
EXPORTING i_parent = g_dock_cont.
wa_layout-grid_title =
'Materials with Data'.
ENDIF.
IF NOT I_DETAIL[] IS INITIAL.
CALL METHOD g_alvgrid->set_table_for_first_display
EXPORTING
IS_VARIANT = WA_VARIANT_STX
IS_LAYOUT = wa_layout
CHANGING
it_outtab = I_DETAIL
IT_FIELDCATALOG = LIT_FIELDCATALOG[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
ENDIF.
ENDIF.
*MATERIALS WITHOUT DATA
IF g_dock_cont1 IS INITIAL.
IF sy-batch NE 'X'.
*CREATE THE OBJECT FOR DOCKING CONTAINER
CREATE OBJECT g_dock_cont1
EXPORTING
side = cl_gui_docking_container=>dock_at_bottom
extension = 300.
ENDIF.
*CREATE THE OBJECT FOR ALV GRID
CREATE OBJECT g_alvgrid1
EXPORTING i_parent = g_dock_cont1.
wa_layout1-grid_title =
'Materials without Data'.
ENDIF.
IF NOT I_MARA[] IS INITIAL.
CALL METHOD g_alvgrid1->set_table_for_first_display
EXPORTING
IS_LAYOUT = wa_layout1
CHANGING
it_outtab = I_MARA
IT_FIELDCATALOG = i_fieldcat[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDFORM. " create_objects
Regards,
Viji.Hi,
What i was saying is that you need to code again for background mode of execution.
AT END OF SELECTION.
IF SY-BATCH EQ 'X'.
PERFORM DISPLAY1.
PERFORM DISPLAY2.
In DISPLAY1 use REUSE_ALV_LIST_DISPLAY to display data from outtab1.
In DISPLAY2 use REUSE_ALV_LIST_DISPLAY to display data from outtab2.
For example : execute this report in background mode.this will not execute in online mode.
After execution you will get two spools one for KNA1 and one for LFA1 data. Spool can be controlled via IS_PRINT structure.
report zrbackground.
data gt_lfa1 type standard table of lfa1.
data gt_kna1 type standard table of kna1.
start-of-selection.
select * from lfa1 into table gt_lfa1 up to 10 rows.
select * from kna1 into table gt_kna1 up to 20 rows.
end-of-selection.
if sy-batch eq 'X'.
perform display_lfa1.
perform display_kna1.
endif.
*& Form DISPLAY_LFA1
text
--> p1 text
<-- p2 text
form display_lfa1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
i_structure_name = 'LFA1'
tables
t_outtab = gt_lfa1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " DISPLAY_LFA1
*& Form DISPLAY_KNA1
text
--> p1 text
<-- p2 text
form display_kna1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
i_structure_name = 'KNA1'
tables
t_outtab = gt_kna1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " DISPLAY_KNA1
Please let me know if its not clear or you need more info.
Thanks,
Abhishek
Edited by: abhishek sinha on May 8, 2009 7:42 PM
Edited by: abhishek sinha on May 8, 2009 8:45 PM -
Hello ;
My Program is type of report, not a moduler program.
And Im using the alv grid , But there isnt refresh button ,I couldnt see it.
How can I see refresh button?
Thanks.Hai
Check the following Code
REPORT z_alv_grid_ctrl_refresh_2.
ALV Grid Control *
This report reads and displays data from table MARA, using *
the Method set_table_for_first_display of CL_GUI_ALV_GRID *
Button 'NEXT_PAGE' : displays the next N records *
Button 'PREV_PAGE' : displays the previous N records *
Button 'FIRST_PAGE' : displays the first page *
Button 'LAST_PAGE' : displays the last page *
When the buttons Sort up, sort down, Filter, Delete Filter are *
pressed, N record are still displayed *
Steps : *
- Create the report Z_ALV_GRID_CTRL_REFRESH_2 *
- Create the Dynpro 0100 (size 27x120) *
- Add OKCODE (type OK) in the element list *
- Modify the flow logic of dynpro 0100 : *
* PROCESS BEFORE OUTPUT. *
MODULE pbo_0100. *
* PROCESS AFTER INPUT. *
MODULE user_command_0100. *
- Create a status named 'MAIN' *
with the buttons : REFRESH BACK EXIT *
and the buttons : FIRST_PAGE PREV_PAGE NEXT_PAGE LAST_PAGE *
Author : Michel PIOUD *
Email : [email protected] HomePage : http://www.geocities.com/mpioud *
CONSTANTS:
c_first_page TYPE syucomm VALUE 'FIRST_PAGE',
c_next_page TYPE syucomm VALUE 'NEXT_PAGE',
c_prev_page TYPE syucomm VALUE 'PREV_PAGE',
c_last_page TYPE syucomm VALUE 'LAST_PAGE'.
TYPES:
BEGIN OF ty_s_mara,
ernam LIKE mara-ernam,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
brgew LIKE mara-brgew,
END OF ty_s_mara.
CLASS lcl_event_alv DEFINITION DEFERRED.
DATA:
gt_mara TYPE STANDARD TABLE OF ty_s_mara,
go_container TYPE REF TO cl_gui_docking_container,
go_alv_grid TYPE REF TO cl_gui_alv_grid,
go_events TYPE REF TO lcl_event_alv,
gt_mara_ftr TYPE STANDARD TABLE OF ty_s_mara, " Data filtered
gt_mara_all TYPE STANDARD TABLE OF ty_s_mara, " Data readfrom DB
okcode TYPE syucomm,
gv_okcode TYPE syucomm.
CLASS lcl_event_alv DEFINITION
CLASS lcl_event_alv DEFINITION.
PUBLIC SECTION.
METHODS:
h_user_command FOR EVENT after_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm
sender.
ENDCLASS. " LCL_EVENT_ALV DEFINITION
Class (Implementation) lcl_event_alv
CLASS lcl_event_alv IMPLEMENTATION.
METHOD h_user_command.
CASE e_ucomm.
WHEN '&SORT_ASC' OR '&SORT_DSC'. " Sort
PERFORM f_sort_big_table.
PERFORM f_read_data USING c_first_page.
PERFORM f_refresh_table.
WHEN '&FILTER'. " Filter
PERFORM f_filter_data.
PERFORM f_read_data USING c_first_page.
PERFORM f_refresh_table.
WHEN '&DELETE_FILTER'. " Delete filter
gt_mara_ftr[] = gt_mara_all[].
PERFORM f_read_data USING c_first_page.
PERFORM f_refresh_table.
ENDCASE.
ENDMETHOD. " user_command
ENDCLASS. " LCL_EVENT_ALV
SELECTION-SCREEN :
BEGIN OF LINE,COMMENT 10(20) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '30' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Lines per page'.
START-OF-SELECTION.
SELECT matnr ernam ersda brgew
INTO TABLE gt_mara_all
FROM mara.
gt_mara_ftr[] = gt_mara_all[].
PERFORM f_read_data USING c_first_page.
CALL SCREEN 100.
Module pbo_0100 OUTPUT
MODULE pbo_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
PERFORM create_and_init_alv.
ENDMODULE. " PBO_0100 OUTPUT
Module user_command_0100 INPUT
MODULE user_command_0100 INPUT.
gv_okcode = okcode.
CLEAR okcode.
CASE gv_okcode.
WHEN 'BACK'.
SET SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN c_first_page OR c_next_page OR c_last_page OR c_prev_page.
PERFORM f_read_data USING gv_okcode. " Update gt_mara
PERFORM f_refresh_table.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Form f_read_data
FORM f_read_data USING u_ucomm TYPE syucomm.
STATICS :
l_1 TYPE sytabix,
l_2 TYPE sytabix.
DATA l_max TYPE sytabix. " Internal table size
DESCRIBE TABLE gt_mara_ftr LINES l_max.
CASE u_ucomm.
WHEN c_first_page. " 1st page
l_1 = 1.
WHEN c_prev_page. " Previous page
SUBTRACT p_max FROM l_1.
IF l_1 < 1.
l_1 = 1.
ENDIF.
WHEN c_next_page. " Next page
IF l_1 IS INITIAL.
l_1 = 1.
ELSE.
ADD p_max TO l_1.
ENDIF.
IF l_1 > l_max.
l_1 = l_max.
ENDIF.
WHEN c_last_page. " Last page
l_1 = l_max - p_max + 1.
IF l_1 < 1.
l_1 = 1.
ENDIF.
ENDCASE.
l_2 = l_1 + p_max - 1.
IF l_2 > l_max.
l_2 = l_max.
ENDIF.
REFRESH gt_mara.
IF l_max > 0.
APPEND LINES OF gt_mara_ftr FROM l_1
TO l_2
TO gt_mara.
ENDIF.
ENDFORM. " F_READ_DATA
Form create_and_init_alv
FORM create_and_init_alv.
Macro definition
DEFINE m_fieldcat.
add 1 to ls_alv_cat-col_pos.
ls_alv_cat-fieldname = &1.
ls_alv_cat-ref_table = 'MARA'.
append ls_alv_cat to lt_alv_cat.
END-OF-DEFINITION.
DATA:
ls_variant TYPE disvariant,
lt_alv_cat TYPE lvc_t_fcat,
ls_alv_cat TYPE lvc_s_fcat,
ls_alv_lay TYPE lvc_s_layo,
l_offline TYPE char1.
CHECK go_container IS INITIAL.
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = l_offline.
IF l_offline EQ 0.
CREATE OBJECT go_container
EXPORTING
extension = 2000
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE e208(00) WITH 'The control could not be created'.
ENDIF.
ENDIF.
Create an instance of alv control
CREATE OBJECT go_alv_grid
EXPORTING i_parent = go_container.
CREATE OBJECT go_events.
SET HANDLER go_events->h_user_command FOR go_alv_grid.
Build field catalog
m_fieldcat 'ERNAM'.
m_fieldcat 'MATNR'.
m_fieldcat 'ERSDA'.
m_fieldcat 'BRGEW'.
Layout
CLEAR ls_alv_lay.
ls_alv_lay-zebra = 'X'.
ls_alv_lay-cwidth_opt = 'X'.
ls_variant-report = sy-cprog.
Display
CALL METHOD go_alv_grid->set_table_for_first_display
EXPORTING
is_variant = ls_variant
is_layout = ls_alv_lay
i_save = 'A'
CHANGING
it_outtab = gt_mara
it_fieldcatalog = lt_alv_cat.
ENDFORM. " CREATE_AND_INIT_ALV
Form F_REFRESH_TABLE
FORM f_refresh_table.
DATA: ls_layout TYPE lvc_s_layo.
CALL METHOD go_alv_grid->get_frontend_layout
IMPORTING es_layout = ls_layout.
ls_layout-cwidth_opt = 'X'.
CALL METHOD go_alv_grid->set_frontend_layout
EXPORTING is_layout = ls_layout.
CALL METHOD go_alv_grid->refresh_table_display.
ENDFORM. " F_REFRESH_TABLE
Form F_SORT_BIG_TABLE
FORM f_sort_big_table.
DATA:
lt_sort_kkblo TYPE kkblo_t_sortinfo,
lt_sort TYPE lvc_t_sort.
CALL METHOD go_alv_grid->get_sort_criteria
IMPORTING et_sort = lt_sort.
CHECK NOT lt_sort[] IS INITIAL.
Format LVC --> KKBLO
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_sort_lvc = lt_sort
IMPORTING
et_sort_kkblo = lt_sort_kkblo.
The big tables must be sorted like the small one
PERFORM fb_outtab_sort(saplkkbl) TABLES gt_mara_ftr
lt_sort_kkblo
USING 'X'
'X'.
PERFORM fb_outtab_sort(saplkkbl) TABLES gt_mara_all
lt_sort_kkblo
USING 'X'
'X'.
ENDFORM. " F_SORT_BIG_TABLE
Form f_filter_data
FORM f_filter_data.
DATA:
lt_filter_lvc TYPE lvc_t_filt,
lt_filter_index TYPE lvc_t_fidx WITH HEADER LINE.
CALL METHOD go_alv_grid->get_filter_criteria
IMPORTING et_filter = lt_filter_lvc.
Find data to filter
CALL FUNCTION 'LVC_FILTER_APPLY'
EXPORTING
it_filter = lt_filter_lvc
IMPORTING
et_filter_index = lt_filter_index[]
TABLES
it_data = gt_mara_all.
gt_mara_ftr[] = gt_mara_all[].
SORT lt_filter_index DESCENDING.
LOOP AT lt_filter_index.
DELETE gt_mara_ftr INDEX lt_filter_index.
ENDLOOP.
ENDFORM. " F_FILTER_DATA
END OF PROGRAM Z_ALV_GRID_CTRL_REFRESH_2 ********************
Thanks & regards
Sreenivasulu P -
How can I get the selected rows from two ALV grids at the same time?
I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
How can I select the rows, then click on just one button, and process the marked entries from both grids?
Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
Thanks.Hello Tamas ,
If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
is it possible to have a check box in each grid & get the selected lines in PAI of the screen ?
regards
prabhu -
Two AlV Grids in a single screen
I want to bring two ALV GRIDS in a single report output screen.How can i achieve this through Classical coding( not OBJECT ORIENTED ). If possible please provide with codes.
thanks,
VenkatHello Venkat
I agree that using fm's this is an almost impossible task whereas using OO-based ALV lists it is just a piece of cake.
For a sample have a look at report ZUS_SDN_TWO_ALV_GRIDS in thread alv
or report ZUS_SDN_THREE_ALV_GRIDS in thread Alv
Regards
Uwe -
ALV Grid and return to selection screen
Hello
I have an ALV Grid and when I push a buttom that I program appears another ALV Grid. In this second ALV I try to program different buttoms. When I program the BACK buttom I want to go to selection screen.
I try with CALL SELECTION SCREEN but when I stay in selection screen and push the execute buttom the ALV that I see is the second, not the first. It seems that we don't catch the news selections.
I put rs_selfied-refresh = 'X' after the CALL SELECTION SCREEN but is wrong again.
What can I do????Hello Silvia
There is a simple trick to return from the second ALV list directly back to the selection screen:
*& Report ZUS_SDN_REUSE_ALV_GRID_DISPLAY
REPORT zus_sdn_reuse_alv_grid_display.
TYPE-POOLS: slis.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
DATA:
gs_fcat TYPE slis_fieldcat_alv,
gt_fcat_t001 TYPE slis_t_fieldcat_alv,
gt_fcat_knb1 TYPE slis_t_fieldcat_alv.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000'.
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
* I_PROGRAM_NAME =
* I_INTERNAL_TABNAME =
i_structure_name = 'T001'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = gt_fcat_t001
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = syst-cprog
i_callback_pf_status_set = 'ALV_SET_PF_STATUS'
i_callback_user_command = 'ALV_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = ' '
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = gt_fcat_t001
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_t001
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END-OF-SELECTION.
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM alv_set_pf_status USING rt_extab TYPE slis_t_extab.
* NOTE: identical to STANDARD_FULLSCREEN with additional button
* for detail list ('DETAILLIST')
SET PF-STATUS 'STANDARD_FULLSCREEN'.
ENDFORM. "set_pf_status
*& Form alv_user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELDtext
FORM alv_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
* Display detail list: all customers for selected company code
WHEN 'DETAILLIST'.
IF ( rs_selfield-fieldname = 'BUKRS' ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = rs_selfield-value.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = syst-cprog
i_callback_pf_status_set = 'ALV_SET_PF_STATUS'
i_callback_user_command = 'ALV_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = 'KNB1'
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_knb1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>* NOTE: when the program logic returns from the 2nd ALV list
* and exit = 'X' then the program leaves the
* 1st ALV list, too, and returns to the selection screen.</b>
rs_selfield-exit = 'X'.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDFORM. "alv_user_command
Regards
Uwe -
ALV GRID and Integrated ITS 7 (SAP GUI for HTML) - dissapears on reload
Hi All,
We have a custom report that uses an ALV grid to display information to the user. Within this grid, there are fields that are display only and fields that are editable. Also, the grid is wider than the screen's width. It works fine in ECC. It also worked fine when we were using ITS 6.4.
We have recently upgraded to ITS 7. Now when we run the report using a Transaction iView (in EP 7) or the Webgui service (SAP GUI for HTML), if a field that is editable has focus when an event is triggered that reloads the grid, the screen becomes blank. So, you can click the Save button and the screen goes blank, also, there are date fields in the grid and if you choose a new date, the grid reloads and the screen becomes blank.
We have found that when the screen is blank, you can use the "Page Up" button on your keyboard and the last few columns of the grid will appear. As if the entire grid has moved off-screen to the left.
If you click onto a non-editable field and refresh or save, the grid returns to its normal state.
We are on Basis Patch level 15.
Does anyone have any ideas on how to fix this?
Also, does anyone know of a standard SAP transaction we can call from the Webgui that would have a similar setup...with an ALV grid containing editable and non-editable fields? We would like to rule out any errors in the report itself. Since it worked before we upgraded and it works fine in ECC. This would be a really big help too.
Thank you so much!
-KevinHi,
Thanks Raymond, I have seen Note 314568. I could not get the second link to work but I have looked at just about every Note in reference to Integrated ITS 7 and Tables or ALV Grids and there are very many, so it would appear that SAP has had a hard time with implementing this control, but I have not seen any instance that matches the problem we are having.
Unfortunately, SAP will not investigate this unless we can provide a standard Transaction that exhibits the same behavior.
If anyone knows of a standard SAP Transaction that displays an ALV Grid that is wider than the screen (requiring a horizontal scroll bar) and with editable and non-editable fields, that would be fantastic. If we can test against that, then we would know for sure if this is a problem with ITS / SAP GUI for HTML, or if there is an issue with this specific report.
Thanks!
-Kevin -
hi all
I am designing a report which has two pages , i completed first page, i need to insert second page
how to design report with two pages
Thanks in advance
KrishHi,
Usually,any report automatically adjusts its page numbers as per the quantity of data that needs to be displayed.However, if your specific requirement is to show certain data on one page and the remaining on another then you can simply insert a group on a valid field.
Following is some information from the Crystal Reports Online Help menu:
New Page After:
- When the End of Section check box is selected, the program inserts a page break after the section.
- The Page Header and Page Footer appear on each page.
- Use New Page After in the Group footer section to print each group on a separate page.
May be, if this is not what you are looking for then please elaborate on the report design/data -
Help me in alv grid and form printing
hi experts,
my requirement is
i have a check box in the selection screen for batch processing.
if i tick the check box, the data which is in the t_output table should be displayed in alv grid and
in turn if i select one row in alv o/p and double click on it the entire data shold be displayed in the form.
if 2 rows are selected in alv and double clicked on it then data in the two rows is dispalyed in the form.
points are rewarded .
thanks in advance.Hi,
Check the following link:
http://sapdev.co.uk/reporting/alv/alvgrid_rowsel.htm
Regards,
bhaskar
Maybe you are looking for
-
How do I hide selection in Photoshop CC , while the ⌘+H is not working anymore?
Hi! I´m using now the finnish version of Photoshop CC. However, the good old ⌘+H shortcut for hiding the selection seems not to work anymore in Photoshop CC. And I cannot find the new shortcut for the command - neither I do not find the way to modify
-
All projects and images on Aperture have disappeared.
My Aperture application froze so I had to force quit it, and restart the computer. When I reopened it every project and image for the past two years has dissapeared. I attempted to restore the library and application using time machine, but each one
-
Quiz questions answered not considered
Hello, I created a multiple choice quiz with a few questions, but as I preview it (in a browser and in the project preview section of Cp), or publish it and play it (same places), the answers that I enter are not being considered, every time I keep g
-
HI All I am developing a semi seach engine. I want to split the string using (+) operator. I write the following code: } else if( source.contains("+")) { words = source.split("+"); for ( String str : words ) {
-
How do I put the new games on the ipod without taking off the old ones?
downloaded some games from the itunes store, on my ipod, then I had to restore my PC causing me to have to redownload itunes. Now I tring to download more games so how do I put the new games on the ipod without taking off the old ones? Because if I p