Multiple ALV Display
Hi All,
How can i display Multiple ALV Grids at a time in the output screen ?
I have to create dynamic table structures for each ALV, but all this ALV's has to be displayed at 1 time in the first output screen!
Regards
Rakesh.
Have a custom control on the screen.
Create a custom conatiner.
Use EASY splitter container.
Now you have two containers, in which each of the ALV grids can be displayed with the two dynamic tables you have.
Look at the BCALV examples in your system.
Regards,
Ravi
Note - Please mark all the helpful answers
Similar Messages
-
Multiple ALV display in one screen using SALV(Factory method)...
Hello Experts,
I tried using the old 'REUSE_ALV_BLOCK_LIST_APPEND' but it does not suit my
requirement. So will it be possible to display multiple ALV display(block) using
SALV?check the sample code..
REPORT zsalv_demo_multiple.
DATA: salv1 TYPE REF TO cl_salv_table,
salv2 TYPE REF TO cl_salv_table,
salv3 TYPE REF TO cl_salv_table.
DATA: g_custom TYPE REF TO cl_gui_custom_container,
o_splitter TYPE REF TO cl_gui_splitter_container,
o_grid1 TYPE REF TO cl_gui_container,
o_grid2 TYPE REF TO cl_gui_container,
o_grid3 TYPE REF TO cl_gui_container.
DATA: it_flight TYPE STANDARD TABLE OF sflight,
it_carr TYPE TABLE OF scarr,
it_book TYPE TABLE OF sbook.
START-OF-SELECTION.
SELECT * FROM sflight
INTO TABLE it_flight
UP TO 20 ROWS.
SELECT * FROM scarr
INTO TABLE it_carr
UP TO 20 ROWS.
SELECT * FROM sbook
INTO TABLE it_book
UP TO 20 ROWS.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ABC'.
CREATE OBJECT g_custom
EXPORTING container_name = 'CONT'.
CREATE OBJECT o_splitter
EXPORTING parent = g_custom
rows = 3
columns = 1.
CALL METHOD o_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = o_grid1.
CALL METHOD o_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = o_grid2.
CALL METHOD o_splitter->get_container
EXPORTING
row = 3
column = 1
RECEIVING
container = o_grid3.
cl_salv_table=>factory(
EXPORTING
r_container = o_grid1
IMPORTING
r_salv_table = salv1
CHANGING
t_table = it_flight
cl_salv_table=>factory(
EXPORTING
r_container = o_grid2
IMPORTING
r_salv_table = salv2
CHANGING
t_table = it_carr
cl_salv_table=>factory(
EXPORTING
r_container = o_grid3
IMPORTING
r_salv_table = salv3
CHANGING
t_table = it_book
CALL METHOD salv1->display.
CALL METHOD salv2->display.
CALL METHOD salv3->display.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Flow Logic..
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
in the Screen i placed a custom control and named it as CONT -
Multiple ALV display using SALV(Factory method)...
Hello Experts,
Please provide me any examples on how to display multiple ALV
displays in a screen using SALV(Factory method).
Hope you can help me guys.
Thank you and take care!Hi Viraylab,
Kindly check the program below, this will help you..
*& Report Z101754_REPORT
REPORT z101754_report.
TABLES: zvbak_101754,zvbap_101754,mara.
TYPE-POOLS: slis.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
DATA: FLDNAME(24).
DATA : BEGIN OF itab_zvbap OCCURS 0,
zvbeln LIKE zvbap_101754-zvbeln,
zposnr LIKE zvbap_101754-zposnr,
zmatnr LIKE zvbap_101754-zmatnr,
zbrgew LIKE zvbap_101754-zbrgew,
zgi_qty LIKE zvbap_101754-zgi_qty,
zinv_qty LIKE zvbap_101754-zinv_qty,
END OF itab_zvbap.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS : s_zvbeln FOR zvbak_101754-zvbeln,
s_zkunwe FOR zvbak_101754-zkunwe,
s_zerdat FOR zvbak_101754-zerdat,
s_zmatnr FOR zvbap_101754-zmatnr.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME TITLE t02.
PARAMETERS : invoiced AS CHECKBOX,
s_gi AS CHECKBOX .
SELECTION-SCREEN: END OF BLOCK block2.
SELECTION-SCREEN: BEGIN OF BLOCK block3 WITH FRAME TITLE t03.
PARAMETERS : alv_list RADIOBUTTON GROUP g1,
alv_grid RADIOBUTTON GROUP g1,
s_class RADIOBUTTON GROUP g1.
SELECTION-SCREEN: END OF BLOCK block3.
Screen Field Validation event
AT SELECTION-SCREEN ON s_zvbeln.
SELECT SINGLE *
FROM zvbak_101754 WHERE zvbeln IN s_zvbeln.
IF sy-subrc NE 0.
MESSAGE e000(z754).
ENDIF.
AT SELECTION-SCREEN ON s_zkunwe.
SELECT SINGLE *
FROM zvbak_101754 WHERE zkunwe IN s_zkunwe.
IF sy-subrc NE 0.
MESSAGE e001(z754).
ENDIF.
AT SELECTION-SCREEN ON s_zerdat.
SELECT SINGLE *
FROM zvbak_101754 WHERE zerdat IN s_zerdat.
IF sy-subrc NE 0.
MESSAGE e002(z754).
ENDIF.
AT SELECTION-SCREEN ON s_zmatnr.
SELECT SINGLE *
FROM zvbap_101754 WHERE zmatnr IN s_zmatnr.
IF sy-subrc NE 0.
MESSAGE e003(z754).
ENDIF.
Start-Of-Selection Event
START-OF-SELECTION.
PERFORM select-data.
End-Of-Selection Event
END-OF-SELECTION.
PERFORM display.
*& Form select-data
text
--> p1 text
<-- p2 text
FORM select-data .
SELECT zvbeln zposnr zmatnr zbrgew zgi_qty zinv_qty
INTO CORRESPONDING FIELDS OF TABLE itab_zvbap
FROM zvbap_101754
WHERE zvbeln IN s_zvbeln.
ENDFORM. " select-data3
TOP-OF-PAGE.
AT LINE-SELECTION.
FORMAT HOTSPOT.
*GET THE FIELD NAME ON LINE SELECTION
GET CURSOR FIELD FLDNAME . "value field_value.
IF FLDNAME = 'itab_zvbap-zvbeln'.
SET PARAMETER ID 'BES' FIELD itab_zvbap-zvbeln.
CALL TRANSACTION 'ZVA01_101754'.
ENDIF.
*& Form DISPLAY
text
--> p1 text
<-- p2 text
FORM display .
IF s_class ='X'.
PERFORM display_header.
LOOP AT itab_zvbap.
WRITE : / sy-vline,
itab_zvbap-zvbeln ,
13 sy-vline,
itab_zvbap-zposnr ,
30 sy-vline,
itab_zvbap-zmatnr ,
45 sy-vline,
itab_zvbap-zbrgew UNIT mara-meins ,
65 sy-vline,
itab_zvbap-zgi_qty UNIT mara-meins,
85 sy-vline,
itab_zvbap-zinv_qty UNIT mara-meins,
105 sy-vline,
/ sy-uline(105).
ENDLOOP.
ENDIF.
*& Creating the fieldcatalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB_ZVBAP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat
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.
IF alv_list = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = ' '
i_callback_user_command = 'USER_COMMAND '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab_zvbap[]
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.
ENDIF.
IF alv_grid = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = ' '
i_callback_user_command = '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 = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab_zvbap[]
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.
ENDIF.
ENDFORM. " DISPLAY
*& Form display_header
text
--> p1 text
<-- p2 text
FORM display_header .
WRITE : / sy-vline,
'ORDER NO',
13 sy-vline,
'ITEM NO',
30 sy-vline,
'MATERIAL NO',
45 sy-vline,
'ORDER QTY',
65 sy-vline,
'GI QTY',
85 sy-vline,
'INVOICED QTY',
105 sy-vline,
/ sy-uline(105).
ENDFORM. " display_header
Please let me know if you have any doubt.
Regards,
Amit. -
Default Layout for Multiple ALV displays
Hello All,
I have a requirement where I am displaying multiple ALV grid displays on different tabs of a screen.
Now I have to set a default layout for each of the grids separately as they have different fields.
Please let me know how to do it, I am using OO ALV display.
Thanks a lot
RuchiHi,
According to your grid called pass the variant name
gs_variant-report = sy-repid.
gs_variant-username = sy-uname.
gs_variant-variant = v_vari. " Your variant Name
call method grid1->set_table_for_first_display
exporting
is_layout = gs_layout
is_variant = gs_variant "<<<<<<<<<
i_save = 'A'
it_toolbar_excluding = i_exclude[]
changing
it_outtab = i_output[]
it_fieldcatalog = i_fieldcat[]
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
a® -
Display Multiple ALV layouts on one screen
Hi,
I have created 4 ALV Catalogues named: ALVCAT1, ALVCAT2, ALVCAT3, ALVCAT4
I have also created the corresponding internal tables with data for each catalogue: ALVITAB1, ALVITAB2, ALVITAB3, ALVITAB4
I have so far used the following function to generate each of the catalogues above:
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = 'ALVITAB1'
I_INCLNAME = SY-CPROG
CHANGING
ct_fieldcat = ALVCAT1[].
And I have used the following function module to display the table as ALV:-
*DISPLAYING REPORT AS ALV GRID
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
IT_FIELDCAT = ALVCAT1[]
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = ALVITAB1.
How can I now using the above function modules or similar function modules to DISPLAY multiple ALV layouts on a single SCREEN. Each layout should be treated separately with their own ALV tool bar etc.
In this case i need to display 4 screens but I have scenarios where i need to also display 5.
Would be really grateful for your guidance with source code to achieve this.....
Thnx
Salman
Edited by: Salman Akram on Sep 20, 2010 2:47 PMHi
Try this [Link|http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=61243570] or the below program
BCALV_TEST_GRID_DRAG_DROP
or else
Try to use splitter container to display multiple ALVs on one screen
here is the demo program RSDEMO_SPLITTER_CONTROL
the below code will help you to call grid using splitter control
EXPORTING
container_name = 'CUSTOM'.
CREATE OBJECT splitter
EXPORTING
parent = container
rows = 1
columns = 1
align = 15.
CALL METHOD splitter->set_row_height
EXPORTING
id = 1
height = 1.
CALL METHOD splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = container_1.
CREATE OBJECT grid1
EXPORTING
i_parent = container_1.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = gss_layout
is_variant = lwa_variant
i_save = 'A'
CHANGING
it_outtab = gt_report_list
it_fieldcatalog = gtt_fld_cat.
Regards
Edited by: Anesht on Sep 20, 2010 11:49 PM -
Multiple ALV Grids on the same window.
Hi,
Can someone tell me if it's possible to display multiple ALV grids on the same window.If so how is it done.Please note that I am talking about Grid Display and not List Display.
Regards,
Swathi BalakrishnanHi,
This can be done even i have done a report.
Its very simple create three containers as below.
Just repeat three times if u need to create three containers.
See this sample code using custom container.
START-OF-SELECTION.
Begin of process logic
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS01'.
SET TITLEBAR 'SALESTTL'.
A L V G R I D
IF o_grid_container IS INITIAL.
CREATE OBJECT o_grid_container
EXPORTING
container_name = '<b>CCONTAINER1</b>'.
CREATE OBJECT o_grid
EXPORTING
i_appl_events = 'X'
i_parent = o_grid_container.
<b>FOR first A L V G R I D</b>
PERFORM set_grid_field_catalog
CHANGING i_grid_fcat.
PERFORM modify_grid_fcat_predisplay
CHANGING i_grid_fcat.
PERFORM set_grid_layout_set
CHANGING struct_grid_lset.
PERFORM sort_outtable CHANGING i_sort_fcat.
PERFORM populate_grid_data TABLES i_grid_outs i_grid_outs_pro.
SORT i_grid_outs BY year month.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid_lset
CHANGING
it_outtab = i_grid_outs[]
it_fieldcatalog = i_grid_fcat[]
it_sort = i_sort_fcat. " Period
ENDIF.
IF o_grid1_container IS INITIAL.
CREATE OBJECT o_grid1_container
EXPORTING
container_name = '<b>CCONTAINER2</b>'.
CREATE OBJECT o_grid1
EXPORTING
i_appl_events = 'X'
i_parent = o_grid1_container.
*<b> FOR SECOND ALV GRID</b>
PERFORM set_grid1_field_catalog
CHANGING i_grid1_fcat.
PERFORM modify_grid1_fcat_predisplay
CHANGING i_grid1_fcat.
PERFORM set_grid1_layout_set
CHANGING struct_grid1_lset.
PERFORM sort_outtable1 CHANGING i_sort_fcat1.
PERFORM populate_grid1_data TABLES i_grid1_outs i_grid1_outs_pro.
SORT i_grid1_outs BY year month.
CALL METHOD o_grid1->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid1_lset
CHANGING
it_outtab = i_grid1_outs[]
it_fieldcatalog = i_grid1_fcat[]
it_sort = i_sort_fcat1. " Period
ENDIF.
IF o_grid2_container IS INITIAL.
CREATE OBJECT o_grid2_container
EXPORTING
container_name = '<b>CCONTAINER3</b>'.
CREATE OBJECT o_grid2
EXPORTING
i_appl_events = 'X'
i_parent = o_grid2_container.
<b>FOR THIRD ALV GRID</b>
PERFORM set_grid2_field_catalog
CHANGING i_grid2_fcat.
PERFORM modify_grid2_fcat_predisplay
CHANGING i_grid2_fcat.
PERFORM set_grid2_layout_set
CHANGING struct_grid2_lset.
PERFORM populate_grid2_data TABLES i_grid2_outs i_grid2_outs_pro.
SORT i_grid2_outs BY year month.
PERFORM sort_outtable2 CHANGING i_sort_fcat2.
CALL METHOD o_grid2->set_table_for_first_display
EXPORTING
i_bypassing_buffer = space
is_variant = ws_f_grid_disvar
i_save = ws_c_grid_save
is_layout = struct_grid2_lset
CHANGING
it_outtab = i_grid2_outs[]
it_fieldcatalog = i_grid2_fcat[]
it_sort = i_sort_fcat2. " Period
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
As the events are registered as application events, control is first
passed to the program's PAI. The call 'cl_gui_cfw=>dispatch' will
forward control to ABAP object event handling and the appropriate
event handler will be called (if present). This allows the user to
selectively process events.
DATA: i_return_code TYPE i .
CALL METHOD cl_gui_cfw=>dispatch
IMPORTING return_code = i_return_code.
save_ok = ok_code.
CASE save_ok.
WHEN 'BACK' OR 'END' OR 'CANC'.
PERFORM exit_program.
ENDCASE.
CLEAR save_ok.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form EXIT_PROGRAM
text
FORM exit_program.
CALL METHOD o_grid_container->free.
CALL METHOD o_grid1_container->free.
CALL METHOD o_grid2_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
Error in FLush
ENDIF.
LEAVE TO SCREEN 0.
ENDFORM. " EXIT_PROGRAM
If u want get more idea revert back to me.
Thanks & Regards,
Judith. -
Single Printing for Multiple ALVs in Splitter Containers
Hi,
I am creating multiple ALVs (3 to 4) of CL_GUI_ALV_GRID class in my report. The ALVs are being displayed inside the splitter containers of class CL_GUI_SPLITTER_CONTAINER. My question is how to print all the ALVs inside these multiple containers with a single execution? I've found a close answer to this at this thread but it is using the REUSE_ALV... function.
How to print multiple ALV Grids with only one print dialog?
Is there a way to do this by making use of the CL_GUI_ALV_GRID printing functionality, if there is?
Thanks for your kind attention,
Kamal.-found alternative.
-
What's the coolest, slickest way to present multiple ALV reports?
Greetings and good day, everyone.
Okay, I'm working on an update program, and the users have identified at least three different reports they would like coming out of this thing. One report is a list of transactions that fail internal logic checking, the second report is a list of transactions that pass internal logic checking but fail to update via a BAPI, and a third report is a list of transactions that pass checks and process correctly (i.e. update the database) via the BAPI.
At first, still being a newbie, I was wondering how I was going to create multiple ALV reports. I know I could do this using the WRITE statement, writing each report one after the other, but they have asked for the ALV report so they can do all the ad-hoc manipulating, sorting, etc. that ALV provides.
I came up with these options:
1. Instead of filling my single screen with the container control for an ALV report, as I usually do, this time I could put three containers on the screen. However, I know that cramps space, and I don't know if they'll be able to adjust or move things around other than scrolling.
2. Display a single ALV report on the screen, but have buttons somehow on the top that somehow take the user to other screens for the other reports.
3. First give the user a screen with all the buttons for the reports. They choose one, and the ALV report displays. They can click back to return to this screen, then choose a different report.
Nobody else in the office has done anything like this yet using the ALV, so I've got a chance to break some new ground internally and do something slick. Which option is best, and if so, do you have examples or general guidelines of how I do it? I've not had dialog programming, although I do understand the concepts from VB/Delphi experience over 10 years ago. I think I lean toward option 2, but I figured this couldn't be new ground in the SAP world and surely someone's done exactly this sort of thing.
Please help! ALL helpful responses, as always, are awarded points! Thanks so much!
DaveDave,
These are all good suggestions. I would just remember to keep in mind when designing your report two different things.
1. Can your program be run in foreground or background? If it has to be run in background due to data volumes you will lose all interactive capabilities of ALV. You might also not be able to do three different ALVs on the screen in background.
2. I am not sure if I understand your option 3 but if you are talking about the user selecting the options before the load the data, they might have to attempt to load the data multiple times to get all of the report.
My recommendation ( I think somebody already mentioned this) is to have a single ALV with a column on your report that the user can then sort or filter by. This way you are not limited to a program that has to be run in foreground.
Chris -
How can I add a custom title to multiple ALV reports selected by layout?
Greetings and good day, everyone!
Within the past week or so, I posted a question asking the best way to create a program that would generate multiple ALV reports. I got some great ideas, and I've actually coded up a few simple demos based on your feedback -- thank you!
Here's the issue I'm running into: Many of you suggested that I put all report records into one table, and create a field that I could use to filter on later to determine which fields I want to display for the report. For example, if I have 3 different reports, I put all the fields for all 3 reports into a table. I then add a "report key" field. As I put records into the report table for report 1, I code "01" into the "report key" field. I do the same for reports 2 and 3, assigning each a "report key" of "02" and "03", respectively.
I then set up layouts in the ALV for each of the three reports, using the filter option to only pull records with the "report key" value for that particular report. This all works wonderfully! However, I seem to have lost the ability to show a custom title for each layout. I can create a generic TITLEBAR (like "Reporting Center") but I don't know how to reset the grid's title when a layout is selected. I was hoping that SAP might use the layout description as the title on each page, but it doesn't -- it uses the TITLEBAR text.
Any ideas? I think this might be the best way to program multiple ALV reports, but if I can't display the right report title for a particular layout, I'll probably have to go back to my other alternative of putting each report in its own container/screen, and having a button to access each report from the application toolbar.
Thanks,Srikanth,
I don't have any Selection Screen radio buttons for the user to select a particular report; in my case, they specify some needed criteria by the program in the Selection Screen, the program goes off and does a fair bit of processing/updating, and then displays the ALV reports when finished. They don't want to choose one particular report to view ahead of time; they want to have all 3 (in my case) there to see what processed correctly, what was eligible to process but kicked out with errors, and what failed some matching checks done up front (this layout includes additional fields from the input file so they can see what didn't match up against R/3).
So, while I do like the code example you presented, I don't think it's going to help me in my case. -
Multiple ALV GRID reports on a single page
hi all
I have an urgent requirement where I need to show 2-3 alv grids on a single page. Please let me know if it is possible to do so. If yes how. Sample code would be very helpful.
thanks in advance.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 16, 2008 1:45 PMHI,
Create multiple custom containers and call the method CALL METHOD sap_grid->set_table_for_first_display multiple times.
This will display multiple ALV grids on a single page.
Code Below:
MODULE create_objects OUTPUT.
CREATE OBJECT g_custom_container
EXPORTING
PARENT =
container_name = 'CUST_CRTL'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE e143(z1).
ENDIF.
*Create object for sap grid
CREATE OBJECT sap_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = g_custom_container
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e144(z1).
ENDIF.
CREATE OBJECT g_custom_container1
EXPORTING
PARENT =
container_name = 'CUST_CRTL1'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE e143(z1).
ENDIF.
*Create object for sap grid
CREATE OBJECT sap_grid1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = g_custom_container1
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e144(z1).
ENDIF.
CREATE OBJECT g_custom_container2
EXPORTING
PARENT =
container_name = 'CUST_CRTL2'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE e143(z1).
ENDIF.
*Create object for sap grid
CREATE OBJECT sap_grid2
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = g_custom_container2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e144(z1).
ENDIF.
ENDMODULE. " create_objects OUTPUT
*& Module fill_fcat OUTPUT
text
MODULE fill_fcat OUTPUT.
CONSTANTS : lc_x TYPE c VALUE 'X',
lc_a TYPE c VALUE 'D'.
*Prepare field catalog for all Summary Report
wa_field-fieldname = 'BUKRS'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '12'.
wa_field-col_pos = '1'.
wa_field-coltext = text-002. "'Company Code'.
APPEND wa_field TO fcat.
CLEAR wa_field.
wa_field-fieldname = 'CURR'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '10'.
wa_field-col_pos = '2'.
wa_field-coltext = text-022."'Currency'.
APPEND wa_field TO fcat.
CLEAR wa_field.
wa_field-fieldname = 'KUNNR'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '10'.
wa_field-col_pos = '3'.
wa_field-coltext = text-005."'Customer Number'.
APPEND wa_field TO fcat.
CLEAR wa_field.
wa_field-fieldname = 'NAME1'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '13'.
wa_field-col_pos = '4'.
wa_field-coltext = text-007."'Customer Name'.
APPEND wa_field TO fcat.
CLEAR wa_field.
wa_field-fieldname = 'KLIMK'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '12'.
wa_field-col_pos = '5'.
wa_field-coltext = text-008. " 'Credit Limit'.
APPEND wa_field TO fcat.
CLEAR wa_field.
wa_field-fieldname = 'DMBTR'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '16'.
wa_field-col_pos = '6'.
wa_field-coltext = text-009. "'Current Balance Calculated'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR wa_field.
wa_field-fieldname = 'BLNC'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '23'.
wa_field-col_pos = '7'.
wa_field-coltext = g_bal_date. "'Balance b/f @ (Date taken from Z table) '.
wa_field-fix_column = 'X'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR wa_field.
wa_field-fieldname = 'DATE'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '8'.
wa_field-col_pos = '7'.
wa_field-coltext = text-021. "'Balance b/f Date @ Z Table balance'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR wa_field.
wa_field-fieldname = 'INVOICES'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '13'.
wa_field-col_pos = '8'.
wa_field-coltext = text-012. "'Invoices'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR wa_field.
wa_field-fieldname = 'PAYMENTS'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '13'.
wa_field-col_pos = '9'.
wa_field-coltext = text-013. "'Payments'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR wa_field.
wa_field-fieldname = 'DMBTR'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '23'.
wa_field-col_pos = '10'.
wa_field-coltext = g_bal_date1. "'Balance c/f @ (Date of Lodgement from selection screen)'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR wa_field.
wa_field-fieldname = 'CHECK'.
wa_field-tabname = 'T_BSID_BSAD'.
wa_field-outputlen = '13'.
wa_field-col_pos = '11'.
wa_field-coltext = text-020. "'CHECK'.
APPEND wa_field TO fcat.
CLEAR wa_field.
CLEAR g_layout.
g_layout-zebra = lc_x.
g_layout-sel_mode = lc_a.
*Prepare field catalog for all Invoice Extract
wa_field1-fieldname = 'BUKRS'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '12'.
wa_field1-col_pos = '1'.
wa_field1-coltext = text-002. "'Company Code'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
wa_field1-fieldname = 'KUNNR'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '13'.
wa_field1-col_pos = '2'.
wa_field1-coltext = text-005."'Customer Number'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
wa_field1-fieldname = 'NAME1'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '13'.
wa_field1-col_pos = '3'.
wa_field1-coltext = text-007."'Customer Name'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
wa_field1-fieldname = 'GJAHR'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '7'.
wa_field1-col_pos = '4'.
wa_field1-coltext = text-015. " 'Fiscal Year'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
wa_field1-fieldname = 'BELNR'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '10'.
wa_field1-col_pos = '5'.
wa_field1-coltext = text-016. "'Invoice Number'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
CLEAR wa_field1.
wa_field1-fieldname = 'CURR'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '8'.
wa_field1-col_pos = '6'.
wa_field1-coltext = text-022."'Currency'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
wa_field1-fieldname = 'DMBTR'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '13'.
wa_field1-col_pos = '7'.
wa_field1-coltext = text-017. "'Invoice Amount '.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
CLEAR wa_field1.
wa_field1-fieldname = 'BLDAT'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '12'.
wa_field1-col_pos = '8'.
wa_field1-coltext = text-018. "'Date of Shipment'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
CLEAR wa_field1.
wa_field1-fieldname = 'DUEDT'.
wa_field1-tabname = 'T_INVOICE'.
wa_field1-outputlen = '13'.
wa_field1-col_pos = '9'.
wa_field1-coltext = text-019. "'Due Date Calculated'.
APPEND wa_field1 TO fcat1.
CLEAR wa_field1.
CLEAR g_layout1.
g_layout1-zebra = lc_x.
g_layout-sel_mode = lc_a.
*Prepare field catalog for all Payment Extract
CLEAR wa_field2.
wa_field2-fieldname = 'BUKRS'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '12'.
wa_field2-col_pos = '1'.
wa_field2-coltext = text-002. "'Company Code'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
CLEAR wa_field2.
wa_field2-fieldname = 'KUNNR'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '13'.
wa_field2-col_pos = '2'.
wa_field2-coltext = text-005. "'Customer Number'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
CLEAR wa_field2.
wa_field2-fieldname = 'NAME1'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '13'.
wa_field2-col_pos = '3'.
wa_field2-coltext = text-007. "'Customer Name'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
CLEAR wa_field2.
wa_field2-fieldname = 'GJAHR'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '11'.
wa_field2-col_pos = '4'.
wa_field2-coltext = text-015. "'Fiscal Year'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
CLEAR wa_field2.
wa_field2-fieldname = 'BELNR'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '13'.
wa_field2-col_pos = '5'.
wa_field2-coltext = text-016. "'Invoice Number'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
CLEAR wa_field2.
wa_field2-fieldname = 'CURR'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '11'.
wa_field2-col_pos = '6'.
wa_field2-coltext = text-022."'Currency'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
wa_field2-fieldname = 'DMBTR'.
wa_field2-tabname = 'T_PAYMENT'.
wa_field2-outputlen = '13'.
wa_field2-col_pos = '7'.
wa_field2-coltext = text-017. "'Invoice Amount'.
APPEND wa_field2 TO fcat2.
CLEAR wa_field2.
CLEAR g_layout2.
g_layout2-zebra = lc_x.
g_layout-sel_mode = lc_a.
ENDMODULE. " fill_fcat OUTPUT
*& Module display_data OUTPUT
text
MODULE display_data OUTPUT.
g_layout3-variant = g_save.
CALL METHOD sap_grid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
i_structure_name = 'gt_display'
is_variant = g_layout3
i_save = 'A'
i_default = 'X'
is_layout = g_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = t_bsid_bsad
it_fieldcatalog = fcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE e145(z1).
ENDIF.
g_layout4-variant = g_save1.
CALL METHOD sap_grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
i_structure_name = 'gt_display1'
is_variant = g_layout4
i_save = 'A'
i_default = 'X'
is_layout = g_layout1
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = t_invoice
it_fieldcatalog = fcat1
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE e145(z1).
ENDIF.
g_layout5-variant = g_save2.
CALL METHOD sap_grid2->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
i_structure_name = 'gt_display2'
is_variant = g_layout5
i_save = 'A'
i_default = 'X'
is_layout = g_layout2
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = t_payment
it_fieldcatalog = fcat2
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE e145(z1).
ENDIF.
ENDMODULE. " display_data OUTPUT
*& Module exit INPUT
text
MODULE exit INPUT.
CALL METHOD g_custom_container->free.
CLEAR t_bsid_bsad[].
CALL METHOD g_custom_container1->free.
CLEAR t_invoice[].
CALL METHOD g_custom_container2->free.
CLEAR t_payment[].
LEAVE PROGRAM.
ENDMODULE. " exit INPUT
*& Module user_command_1100 INPUT
text
MODULE user_command_1100 INPUT.
MOVE g_ok_code TO g_saveok_code.
CLEAR g_ok_code.
CASE g_saveok_code.
*on BACK leave program
WHEN 'BACK'.
CALL METHOD g_custom_container->free.
CALL METHOD g_custom_container1->free.
CALL METHOD g_custom_container2->free.
CLEAR: g_custom_container,
g_custom_container1,
g_custom_container2.
LEAVE PROGRAM.
SET SCREEN 1000.
CALL TRANSACTION 'Z5172'.
CALL SELECTION-SCREEN 1000.
set screen 0.
leave screen.
*on CANCEL leave program
WHEN 'EXIT'.
CALL METHOD g_custom_container->free.
CALL METHOD g_custom_container1->free.
CALL METHOD g_custom_container2->free.
LEAVE PROGRAM.
*on CANCEL leave program
WHEN 'CANCEL'.
CALL METHOD g_custom_container->free.
CALL METHOD g_custom_container1->free.
CALL METHOD g_custom_container2->free.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " user_command_1100 INPUT -
Simple code to send ALV display as XLS attachment to SAP inbox
Hi All,
Simple code to send ALV display as XLS attachment to SAP inbox.
Also i need to send only 200 records per attachement. So in this case i need send multiple attachment per mail
Thanks,
LokeshThe following code is used to send the internal table which u pass fo the ALV display to be send as excel sheet attachment
Internal table is it_attach[]
ld_email = po_email.
ld_mtitle = 'Email From Z377_EMAIL_XLS'.
ld_format = 'XLS'.
ld_attdescription = 'filename'.
ld_attfilename = 'Allot'.
ld_sender_address = ' '.
ld_sender_address_type = ' '.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE li_content LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
*IMPORTING
*sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = li_content
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8. -
Multiple ALV Objects in one Report
I have multiple ALV ojbects in one ABAP report (one a grid, and one a tree). When selecting the choose display layout for either object - it returns the layouts for BOTH objects. Is there any way of limiting this to only return the layouts for the appropriate object?
Thanks in advance.Hi Heather,
in methode set_table_for_first_display you can use the parameter is_variant of type DISVARIANT. Use the field HANDLE in this structure to distinguish the two ALV Objects. Fill also field REPORT of the same structure with sy-repid.
Regards Florian -
MMBE - Copy text in ALV display
Hi all,
We are migrating to ECC 6.0 from 4.7. In ECC, transaction MMBE calls a new ALV display (we are aware that the old program can be called via MMBE_OLD).
We have many users who are used to selecting and copying multiple text fields (such as a list of batches) from the old MMBE using ctrl + Y then ctrl + C. In the new display we can select a single field, by simply clicking. However, we cannot find a way to select multiple text fields from the new display. Does anyone have any suggestions?
Thanks & regards,
MarkI feel a little silly answering my own question, but we found the solution:
In the Print Preview, Ctrl + Y & drag can be used to select. -
Writing text above multiple ALV list
Hi,
I have multiple ALV lists and want to add a different text above each one. How can this be achieved? I am using sort to separate the lists. thanks
sort-fieldname = 'MATNR'.
sort-up = 'X'.
sort-group = '*'.
APPEND sort TO it_sort.
CLEAR sort.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = it_sort
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
Edited by: Hin Lai on Jan 7, 2011 9:40 PMWell, why not debug FBL5N and see how that transaction does this?
Hmmm....
Debugging may not help. The separate lists are handled by the display variant. You should be able to do the same thing if all of your lists use the same field catalog and are in the same or can be put in the same table.
Rob
Edited by: Rob Burbank on Jan 7, 2011 5:36 PM -
Multiple ALV reports on one page
How to display multiple ALV reports on one page.
this done by this code....
*& Report ZPR_02
REPORT ZPR_02.
TYPE-POOLS: SLIS.
Tables Declaration.
TABLES: MARA.
*Internal tables and data declaration.
DATA: BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MBRSH LIKE MARA-MBRSH,
END OF IT_MARA,
BEGIN OF IT_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
EKGRP LIKE MARC-EKGRP,
END OF IT_MARC,
BEGIN OF IT_MARD OCCURS 0,
MATNR LIKE MARD-MATNR,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF IT_MARD.
DATA: WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELD_CAT1 TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELD_CAT2 TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELD_CAT3 TYPE SLIS_T_FIELDCAT_ALV,
WA_KEYINFO TYPE SLIS_KEYINFO_ALV,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS1 TYPE SLIS_T_EVENT WITH HEADER LINE,
IT_EVENTS2 TYPE SLIS_T_EVENT WITH HEADER LINE,
IT_EVENTS3 TYPE SLIS_T_EVENT WITH HEADER LINE.
*Selection Screen.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
*Start Of selection.
START-OF-SELECTION.
*Selecting the data.
PERFORM SELECT_DATA.
*Populating the field catelogue.
PERFORM BUILD_FIELD_CAT.
*Displaying the final output.
PERFORM DISPLY_OUTPUT.
*& Form Select_data
Selecting the data.
FORM SELECT_DATA .
SELECT MATNR
MTART
MBRSH FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR.
IF NOT IT_MARA[] IS INITIAL.
SELECT MATNR
WERKS
EKGRP FROM MARC
INTO TABLE IT_MARC
FOR ALL ENTRIES IN IT_MARA
WHERE MATNR EQ IT_MARA-MATNR.
ENDIF.
IF NOT IT_MARC[] IS INITIAL.
SELECT MATNR
WERKS
LGORT
LABST FROM MARD
INTO TABLE IT_MARD
FOR ALL ENTRIES IN IT_MARC
WHERE MATNR = IT_MARC-MATNR
AND WERKS = IT_MARC-WERKS.
ENDIF.
ENDFORM. " Select_data
*& Form Build_field_cat
Populating the field catelogue.
FORM BUILD_FIELD_CAT .
DEFINE M_FIELDCAT1.
WA_FIELD_CAT-TABNAME = &1.
WA_FIELD_CAT-FIELDNAME = &2.
WA_FIELD_CAT-SELTEXT_L = &3.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT1.
END-OF-DEFINITION.
DEFINE M_FIELDCAT2.
WA_FIELD_CAT-TABNAME = &1.
WA_FIELD_CAT-FIELDNAME = &2.
WA_FIELD_CAT-SELTEXT_L = &3.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT2.
END-OF-DEFINITION.
DEFINE M_FIELDCAT3.
WA_FIELD_CAT-TABNAME = &1.
WA_FIELD_CAT-FIELDNAME = &2.
WA_FIELD_CAT-SELTEXT_L = &3.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT3.
END-OF-DEFINITION.
M_FIELDCAT1 'MARA' 'MATNR' 'Material No'.
M_FIELDCAT1 'MARA' 'MTART' 'Material type'.
M_FIELDCAT1 'MARA' 'MBRSH' 'Industry Sector'.
M_FIELDCAT2 'MARC' 'MATNR' 'Material No'.
M_FIELDCAT2 'MARC' 'WERKS' 'Plant'.
M_FIELDCAT2 'MARC' 'EKGRP' 'Purchasing Group'.
M_FIELDCAT3 'MARD' 'MATNR' 'Material No'.
M_FIELDCAT3 'MARD' 'WERKS' 'Plant'.
M_FIELDCAT3 'MARD' 'LGORT' 'Storage Loc'.
M_FIELDCAT3 'MARD' 'LABST' 'Valued Stock'.
IT_EVENTS1-NAME = 'TOP_OF_PAGE'.
IT_EVENTS1-FORM = 'F_TOP_OF_PAGE_ONE'.
APPEND IT_EVENTS1.
CLEAR IT_EVENTS1.
IT_EVENTS2-NAME = 'TOP_OF_PAGE'.
IT_EVENTS2-FORM = 'F_TOP_OF_PAGE_TWO'.
APPEND IT_EVENTS2.
CLEAR IT_EVENTS2.
IT_EVENTS3-NAME = 'TOP_OF_PAGE'.
IT_EVENTS3-FORM = 'F_TOP_OF_PAGE_THREE'.
APPEND IT_EVENTS3.
CLEAR IT_EVENTS3.
ENDFORM. " Build_field_cat
*& Form disply_output
Displaying the final output.
FORM DISPLY_OUTPUT .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT1[]
I_TABNAME = 'IT_MARA'
IT_EVENTS = IT_EVENTS1[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARA .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT2[]
I_TABNAME = 'IT_MARC'
IT_EVENTS = IT_EVENTS2[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARC .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = IT_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT3[]
I_TABNAME = 'IT_MARD'
IT_EVENTS = IT_EVENTS3[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
T_OUTTAB = IT_MARD .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
IS_PRINT = IS_PRINT
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
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. " disply_output
*& Form top_of_page_one
text
FORM F_TOP_OF_PAGE_ONE.
WRITE: / 'Header details (MARA)'.
ENDFORM. "top_of_page_one
*& Form top_of_page_one
text
FORM F_TOP_OF_PAGE_TWO.
WRITE: / 'Item details (MARC)'.
ENDFORM. "top_of_page_one
*& Form top_of_page_one
text
FORM F_TOP_OF_PAGE_THREE.
WRITE: / 'Item details (MARD)'.
ENDFORM. "top_of_page_one
regards,
venkat.
Maybe you are looking for
-
Apps take a long time to open on mac?
I have a June 2012 Macbook pro (15 inch base model-nonretina). Apps take ridiculously long to open in OSX (Mountain Lion). When I use bootcamp to go into Windows 7, however, my computer is fast, apps open quickly, and games run on high. It doesn't ma
-
BAPI_TRIP_CREATE_FROM_DATA Fill in all required entry fields
Dear community, We are trying to use the function "BAPI_TRIP_CREATE_FROM_DATA" for a new customer program to create trips for the employees. When we try and use this function to create trips, it returns an error message saying "Fill in all required e
-
Missing Home Folder in Users Folder
I have a very strange situation where my Home folder (short name "Peter") does not appear in my "Users" Folder. It appears on the Finder sidebar and if i do a search it is found by the finder in the "Users" folder. I can access it from either of thes
-
After Effects and Bridge error message
After Effects error: Can't import file-.unsupported filetype or extension, (0 ::1) this happens when I double click on a text animator in Bridge. Started happening after I upgraded to After Effects 2014, anybody know how to fix this?
-
Could not unmount disk (-10000)
Hello all. Just a quick one... Just tried to verify/repair my External LACIE using Disk Utility, and found that I get this error... Repairing disk for "LACIE HD" Repair attempted on 1 volume 0 HFS volumes repaired 1 volume could not be repaired Repai