ALV grid in Subscreen
Hi all,
I have a subscreen with ALV grid in module pool program.
The main screen has two subscreens (one is header and other is items/reports)
from the main screen, the ALV Grid subscreen can be called in two ways.
1. from application tool bar (show report button) - ALV grid will be displayed in Items/Reports subscreen.
2. In Items/Reports subscreen, while displaying items there is a requirement to display same ALV grid subscreen report on hotspot of particular item.
ALV Grid in subscreen displaying only first come first serve for subscreen, if the subscreen called from application toolbar button then the ALV grid from items hotspot call not displaying and vice versa.
Not sure where i am doing wrong, but if i free the container, alv and re-generate all the objects its working fine but user doesn't like the flickering display of conatiner when it re-generating.
Any suggestions would help.
Regards
Syed
Hi Aruna Kumara,
Thanks for the reply.
I have only one ALV grid instance.
Process Flow from Application toolbar
Main Screen: 100
PBO:
CALL SUBSCREEN C_REPORT INCLUDING SY_REPID '0300'.
SUBSCREEN: 300
PBO:
IF CONTAINER IS NOT BOUND.
CREATE Container. with container name
CREATE ALV_Grid. passing container created
BUILD FIELDCAT.
CREATE EVENTS.
CALL METHOD SET_DISPLAY_TABLE_FIRST.
ELSE.
REFRESH_TABLE_DISPLAY.
FLUSH. "tried with without flush too.
ENDIF.
Process Flow from Items:
Items table is a subscreen 200 in main screen.
When the desired item click thru hotspot, a Modal dialog screen 250 open with subscreen element.
In event hotspot_click.
CALL SCREEN 250 STARTING AT ...ENDING AT.
PBO of 250:
CALL SUBSCREEN C_REPORT INCLUDING SY-REPID '0300'.
SubScreen 0300:
PBO as describe above, as the container already bound next time it refreshes the table display. But i see a blank screen in Popup.
Hope this helps.
Regards
Syed
Similar Messages
-
Placing ALV grid on subscreen-URGENT
Hi,
I have a selection screen in my report program. I have placed a custom container in the selection screen in which I have placed an ALV grid.
Now my requirement is to place this ALV grid on a subscreen and define this subscreen in my selection screen.
I have included the following code in my report and also created a new subscreen 0100.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK sub FOR 197 LINES,
END OF BLOCK sub.
INITIALIZATION.
sub-prog = sy-repid.
sub-dynnr = 100.
Please let me know how do I place the ALV grid on the subscreen.
Thanks & Regards,
Srilakshmi BHi,
1.goto se51.give the module pool name and scrren no.
2.Select the custom container and give name only.
3.use that name in the report.
Regards,
Shiva. -
Hi ,
How can I display ALV grid display in subscreen area that is called in main screen .?
Thanx in advance .Hi Pallavi,
Use these parameters in Alv Fm
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
Hope this will help you.
Regards,
Vijay -
ALV Grid Subscreen to Display Text
Folks,
I am really sorry I am creating a new thread for this because I can see it has been discussed a lot but I am finding it hard to clearly identify what needs to be done from all the posts.
I have an ABAP with a selection screen, it runs and generates an ALV output, on that ALV output I have a column called COMMENT, in the column COMMENT there is a string of text which can be very large. Since I can not change the row height on the ALV grid I am going to implement a work-around where when the user double-clicks on the comment, it pops up a screen displaying the full text.
I presume I need to call a subscreen to get this to happen but I can not see how to do this and any help would be greatly appreciated.
Many Thanks,
Colm
P.S. Here is how I catch the double click.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
DATA: w_ans(1).
CASE r_ucomm. "The users command
WHEN '&IC1'. "Double Click
*Doc drill down
IF rs_selfield-fieldname = 'COMMENT'.
READ TABLE gt_output INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
*Call the screen here displaying the full note text
ENDIF.I feel so foolish, I was trying to re-invent the wheel and didn't think before I asked. Apologies and Thanks.
However, if for some reason I didn't want to use the POPUP_TEXT FM, is there a way I could have called the subscreen?
Here is the code I used if anyone is interested:
DATA: w_ans(1),
lt_text TYPE TABLE OF trtab,
ls_title TYPE c,
crlf(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf.
CASE r_ucomm. "The users command
WHEN '&IC1'. "Double Click
*Doc drill down
IF rs_selfield-fieldname = 'COMMENT'.
READ TABLE gt_output INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
SPLIT gt_output-comment AT crlf INTO TABLE lt_text.
CALL FUNCTION 'LAW_SHOW_POPUP_WITH_TEXT'
EXPORTING
titelbar = ls_title
line_size = 132
TABLES
list_tab = lt_text. -
ALV grid on TABSTRIP- Subscreen
Hi,
How to display ALV grid screen on Tabstrip- Subscreen.
Please send sample code.
Thanks in advance.
-MohanIts not going to be different that what you do on a normal screen. I am assuming that you are using OO ALV control.
Here you do this on the sub screen instead of the main screen. Take a look at my weblog.
/people/ravikumar.allampallam/blog/2005/06/01/alv-reporting-using-controls--part-i
regards,
Ravi
Note :Please close the thread if this resolves the issue -
Hi,
I have a problem with the display of a ALV grid in a subscreen. I am going to try to explain my problem and maybe somebody knows any solution.
In a regular screen I have a subscreen that should show the ALV, I am following all the steps like callling the subscreen, creating the container for the ALV grid, ... but it doesn' show anything.
I have tried some things to check if the calling of the subscreen works, so I just call any other subscreen and it works. Also I have tried to call two alv in the same screen using the custom control and it works.
I have changed the subscreen into screen and I have added the status and so on and by itself it also works.
Does anybody know what can be missing??
Thanks very muchHmm, works fine for me. Below code a litte bit tweaked but working one. Try it:
"ABAP program
DATA: g_custom_container TYPE REF TO cl_gui_custom_container,
g_alv_grid_ref TYPE REF TO cl_gui_alv_grid,
gt_sflight TYPE sflight OCCURS 0.
SELECT * FROM sflight INTO TABLE gt_sflight UP TO 10 ROWS.
CALL SCREEN 0100.
MODULE pbo_0200 OUTPUT.
IF g_custom_container IS INITIAL.
"create custom container
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'CUSTOM_AREA'.
CREATE OBJECT g_alv_grid_ref
EXPORTING
i_parent = g_custom_container.
CALL METHOD g_alv_grid_ref->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
ELSE.
CALL METHOD g_alv_grid_ref->refresh_table_display.
ENDIF.
ENDMODULE. "PBO_0200
"Main screen 0100 - type normal
"here on layout ensure subsreen area called SUB_AREA is placed
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN sub_area INCLUDING sy-repid '0200'.
PROCESS AFTER INPUT.
CALL SUBSCREEN sub_area.
"Subscreen - type subscreen (please check that in attributes)
"here custom control named CUSTOM_AREA was placed in layout
PROCESS BEFORE OUTPUT.
MODULE pbo_0200.
Hope this helps
Marcin -
Hide alv grid PR custom subscreen
Hello All,
I have a custom subscreen on PR ( bulit via screen exit) with ALV grid and some screen elements ( to get input data from user) on it.
In create and change PR mode, I need to get the input ( could be multiple rows with the help of create next icon )from user and update ALV grid with the input values. But in PR display mode, I need to hide the ALV grid.
I tried using desctructor method FREE, but dint work.
Any suggestions?
Thanks,
ChandraI have a similiar problem:
I have a dynpro where there are different possibilities for ALV grids to be shown. I have 10 containers (that's the maximum number of ALV grids that can appear) and want to use the highest first. Now, it might be that I want to show another ALV in a container I have had an ALV before, therefore I must hide / delete / destroy the previous ALV in this container.
I use the FREE( ) method of the alv controls, I clear and free all references, but still, even after leaving and accessing the dynpro again, the ALV is shown. That's why I'd need some help here too...
Thanks in advance, Christopher -
Deactivate buttons in ALV GRID being called in subscreen
Hi,
In a screen, when a specific tab is selected (tab strip), the subscreen area is filled with ALV GRID. I need to deactivate few buttons on the ALV GRID. How can that be done??
Advance ThanksHi Aadarsh,
Check out the following program.
Global data definitions for ALV
To allow the declaration of gr_event_handler before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_handler DEFINITION DEFERRED.
Object reference
ALV Grid instance reference
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid,
Custom container instance reference
gr_ccontainer TYPE REF TO cl_gui_custom_container,
Event class reference
gr_event_handler TYPE REF TO lcl_event_handler. "IC210507+
Internal Table
Field catalog table
DATA: gt_fieldcat TYPE lvc_t_fcat,
Internal table holding list data
gt_list TYPE STANDARD TABLE OF sflight,
Table to be filled up for excluding some of the standard function
buttons
gt_exclude TYPE ui_functions. "IC210507+
Work area
Layout structure
DATA: gs_layout TYPE lvc_s_layo,
Field catalog structure
gs_fcat TYPE lvc_s_fcat,
Exclude button structure
gs_exclude TYPE ui_func, "IC210507+
Structure to add button in the ALV toolbar
gs_toolbar TYPE stb_button. "IC210507+
Variables
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
Name of the custom control added on the screen
gv_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
Begin of IC210507
Local classes
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION.
METHODS:
To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
To implement user commands
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS. "lcl_event_handler DEFINITION
End of IC210507
Calling the screen where ALV output is displayed
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
PBO
MODULE status_0100 OUTPUT.
ALV display
PERFORM display_alv.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
IF save_ok EQ 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form display_alv
ALV display
FORM display_alv.
PERFORM get_data.
PERFORM create_alv.
ENDFORM. " display_alv
*& Form get_data
Fetch data to be displayed in the list
FORM get_data.
SELECT * FROM sflight
INTO TABLE gt_list.
ENDFORM. " get_data
*& Form create_alv
Create and set or Refresh ALV
FORM create_alv.
Checking whether an instance of the container (or ALV Grid) exists.
IF gr_alvgrid IS INITIAL.
If not, creating and setting ALV for the first display.
Creating custom container instance
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = gv_custom_control_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
Creating ALV Grid instance
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
Begin of IC210507
Creating an instance for the event handler
CREATE OBJECT gr_event_handler.
Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid.
End of IC210507
Preparing field catalog.
PERFORM prepare_field_catalog CHANGING gt_fieldcat.
Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout.
Excluding Unwanted Standard Function Buttons
PERFORM exclude_tb_functions CHANGING gt_exclude. "IC210507+
Method to display ALV grid
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
To exclude buttons the exclusion table must be passed to the following
field
it_toolbar_excluding = gt_exclude "IC210507+
CHANGING
it_outtab = gt_list
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
To make ALV show our additional buttons, we must call the method
set_toolbar_interactive for the ALV Grid instance after the instance
is created.
CALL METHOD gr_alvgrid->set_toolbar_interactive. "IC210507+
ELSE.
If an instance of the container (or ALV Grid) exists, refreshing it.
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDIF.
ENDFORM. " create_alv
*& Form prepare_field_catalog
Subroutine to populate field catalog
<--P_GT_FIELDCAT Table to describe the field catalog
FORM prepare_field_catalog CHANGING p_gt_fieldcat TYPE lvc_t_fcat.
Generating the field catalog semi automatically
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = p_gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LOOP AT p_gt_fieldcat INTO gs_fcat.
CASE gs_fcat-fieldname.
WHEN 'CARRID'.
gs_fcat-outputlen = '10'.
gs_fcat-coltext = 'Airline Carrier ID'.
MODIFY p_gt_fieldcat FROM gs_fcat.
WHEN 'FLDATE'.
gs_fcat-just = 'C'.
gs_fcat-hotspot = 'X'.
MODIFY p_gt_fieldcat FROM gs_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. " prepare_field_catalog
*& Form prepare_layout
Preparing layout structure
<--P_GS_LAYOUT Layout structure
FORM prepare_layout CHANGING p_gs_layout TYPE lvc_s_layo.
p_gs_layout-zebra = 'X' .
p_gs_layout-grid_title = 'Flight Info System'.
p_gs_layout-smalltitle = 'X'.
ENDFORM. " prepare_layout
Begin of IC210507
*& Form exclude_tb_functions
Excluding Unwanted Standard Function Buttons
<--P_GT_EXCLUDE Table to be filled up to exclude buttons
FORM exclude_tb_functions CHANGING p_gt_exclude TYPE ui_functions.
MC_FC_ are names for functions directly and the names beginning with
MC_MB_ are for the function menus including some subfunctions as menu
entries.
In this case 'Maximum' and 'Minimum' options under 'Sum' button & 'Print'
button are excluded
gs_exclude = cl_gui_alv_grid=>mc_fc_maximum.
APPEND gs_exclude TO p_gt_exclude.
gs_exclude = cl_gui_alv_grid=>mc_fc_minimum.
APPEND gs_exclude TO p_gt_exclude.
gs_exclude = cl_gui_alv_grid=>mc_fc_print.
APPEND gs_exclude TO p_gt_exclude.
ENDFORM. " exclude_tb_functions
*& Class (Implementation) lcl_event_handler
Event handler for the ALV Grid instance.
CLASS lcl_event_handler IMPLEMENTATION.
Handle Toolbar
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object e_interactive .
ENDMETHOD . "handle_toolbar
Handle User Command
METHOD handle_user_command .
PERFORM handle_user_command USING e_ucomm .
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_handler
*& Form handle_toolbar
Subroutine called from event handler method for event toolbar.
This is to add a new button in the ALV application toolbar
-->P_E_OBJECT
-->P_E_INTERACTIVE
FORM handle_toolbar USING p_e_object TYPE REF TO cl_alv_event_toolbar_set
p_e_interactive.
Begin of 'Adding a new Button'
CLEAR gs_toolbar.
Function code
MOVE 'EXIT' TO gs_toolbar-function.
Button type that will be added to the toolbar
gs_toolbar-butn_type = 0.
Icon for the button
From the type group ICON in SE11, we can get the value to be passed
for icon
gs_toolbar-icon = '@2N@'.
Quick info for the button
MOVE 'Exit' TO gs_toolbar-quickinfo.
Text for the button
MOVE 'Exit' TO gs_toolbar-text.
Adds the button as disabled if set to X
MOVE ' ' TO gs_toolbar-disabled.
Appending the structure to the table attribute mt_toolbar of the object
APPEND gs_toolbar TO p_e_object->mt_toolbar.
End of 'Adding a new Button'
Begin of 'Disabling an existing standard Button'
LOOP AT p_e_object->mt_toolbar
INTO gs_toolbar
Identify which button to disable from the function code
In this case disabling the 'Filter' button
WHERE function = '&MB_FILTER'.
Set the 'DISABLED' field to disable a button
gs_toolbar-disabled = 'X'.
MODIFY p_e_object->mt_toolbar FROM gs_toolbar.
ENDLOOP.
End of 'Disabling an existing standard Button'
ENDFORM. " handle_toolbar
*& Form handle_user_command
Implement any new function
-->P_E_UCOMM text
FORM handle_user_command USING p_e_ucomm TYPE syucomm.
IF p_e_ucomm EQ 'EXIT'.
LEAVE PROGRAM.
ENDIF.
ENDFORM. " handle_user_command
End of IC210507
Award points if found useful.
Regards
Indrajit. -
The Visible attribute on alv grid column is not changed after Change Layout
Setup:
I have a program that displays output in an ALV grid (using cl_salv_table).
The ALV grid is displayed within a custom control on a subscreen.
I have 4 subscreens being used on a tabstrip control. So I have 4 ALV grids total (one on each subscreen).
On each ALV grid, I have set the set_layout_change function to true so that the user can hide and unhide columns etc. on each grid via the button on the alv grid toolbar.
I also allow the user to dowload the contents of all 4 grids to excel. To do this I have a custom button that when clicked goes to each ALV grid - gets the column metadata (via cl_salv_columns_table-get() ) and checks the visibility to determine if the column should be downloaded or not (via cl_salv_column-is_visible() ) to excel.
The Problem:
As I said I have 4 grids being displayed via a tab control. Let's say the user is on tab 1 and unhides some columns on the alv grid 1 via the Change Layout... button. And then the user navigates to tab 2. If they click the download button at that point - when the download code is run and it checks the visibility of the columns on alv grid 1 - the changes that were made via the Change Layout... button have not synchronized yet. When I call is_visible() for a column that was unhid it still comes back as false.
The only way I have found to remedy this is to make the user click on a button on the alv grid's toolbar before navigating to a different tab to force the synchronization between the changes made and the backend column metadata. However, this is not the best option and requires training for the user that they have to do this for the download to work correctly.
The Question:
1) why is the Change Layout... button not automatically synchronizing the changes it made to the back end? Is there a way to make it do this?
2) OR, is there a way that I can force the synchronization within the code and not force the user to click a button on the alv grid? If there is a way to force the synchronization - where do I put that code? As far as I can tell, when I switch between tabs - I am unable to catch that action in my PAI events.
Thanks in advance for any help.I was able to resolve this issue with a satisfactory solution.
In my program I had a local class definition to handle the grids' events. When the synchronization wasn't working I only had two events defined: for link_click and added_functions.
I created another definition for event after_salv_function:
on_after_salv_function for event after_salv_function of cl_salv_events importing e_salv_function
There is no code in the method implementation - but adding this event handler now causes a synchronization to occur after the Change Layout is done. -
Help on ALV GRID display outputting format for 2 internal tables
Hi,
I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
Regards,
MiraHi,
U can try out this code
REPORT zzz_test NO STANDARD PAGE HEADING
MESSAGE-ID zz.
The Data Declarations
INCLUDE zzm_test_alv_data.
The Selection Screen Definition
INCLUDE zzm_test_alv_selscrn.
The definition and implementation of the event reciever class
INCLUDE zzm_test_alv_class.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM f1000_load_itabs.
END-OF-SELECTION
END-OF-SELECTION.
IF NOT cb_disp IS INITIAL.
CALL SCREEN 9001.
ENDIF.
Include for getting data
INCLUDE zzm_test_alv_forms.
Include for PAI and PBO of screen
INCLUDE zzm_test_alv_screen.
INCLUDE ZZM_TEST_ALV_DATA *
This include has all the data declaration defined
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
Table Declarations:
TABLES: mara,
makt.
Internal Tables:
The following structure type must be defined in the data dictionary
DATA: i_fieldcat TYPE lvc_t_fcat,
i_fieldcat1 TYPE lvc_t_fcat,
i_output1 TYPE STANDARD TABLE OF mara,
i_output2 TYPE STANDARD TABLE OF makt,
Work Areas:
w_output1 TYPE STANDARD TABLE OF mara,
w_output2 TYPE STANDARD TABLE OF makt.
Variable:
DATA: lv_repid LIKE sy-repid.
lv_repid = sy-repid.
INCLUDE ZZM_TEST_ALV_SELSCRN *
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP 1.
PARAMETERS: cb_disp AS CHECKBOX.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK b_main.
INCLUDE ZZM_TEST_ALV_CLASS *
This include has all the data declaration defined for ALV
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
INCLUDE <icon>.
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
cont_for_cognos1 TYPE scrfname VALUE 'BCALC_GRID_01_9100',
cont_for_cognos2 TYPE scrfname VALUE 'BCALC_GRID_01_9200',
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
Work Area
w_layout TYPE lvc_s_layo ,
w_variant TYPE disvariant.
Constants
CONSTANTS : c_lay(1) TYPE c VALUE 'A' . " All Layouts
CONSTANTS: BEGIN OF c_main_tab,
tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1', "
tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2', "
END OF c_main_tab.
INCLUDE ZZM_TEST_ALV_FORMS *
This Include has the various forms used in the program
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
*& Form f9001_build_field_cat
To Build Field Catalog
-->P_I_FIELDCAT text
-->P_0021 text
FORM f9001_build_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat
USING value(p_structure).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_structure
CHANGING
ct_fieldcat = p_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
" text-e05.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " f9001_build_field_cat
*& Form f9000_objects_create
For creating Custom Containers
--> p1 text
<-- p2 text
FORM f9000_objects_create.
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_for_cognos1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_for_cognos2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT o_alvgrid1
EXPORTING i_parent = custom_container1.
CREATE OBJECT o_alvgrid2
EXPORTING i_parent = custom_container2.
ENDFORM. " f9000_objects_create
*& Form f9003_layout
To define the layout
-->P_SY_TITLE text
-->P_0030 text
-->P_0031 text
-->P_0032 text
FORM f9003_layout USING value(ptitle)
value(pzebra)
value(pmode)
value(pwidth).
w_layout-grid_title = ptitle.
w_layout-zebra = pzebra.
w_layout-sel_mode = pmode.
w_layout-cwidth_opt = pwidth.
w_variant-report = sy-repid.
ENDFORM. " f9003_layout
*& Form f9006_error_handle
To handle event
-->P_PTEXT text
FORM f9006_error_handle USING value(ptext).
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-e03 " Error Note
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
ENDFORM. " f9006_error_handle
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD custom_container1->free.
CALL METHOD custom_container2->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = lv_repid
txt2 = sy-subrc
txt1 = 'Error in FLush'(500).
ENDIF.
ENDFORM.
*& Form f1000_load_itabs
Select from Database
--> p1 text
<-- p2 text
form f1000_load_itabs.
SELECT * FROM mara
INTO TABLE i_output1
UP TO 50 rows.
SELECT * FROM makt
INTO TABLE i_output2
UP TO 50 rows.
endform. " f1000_load_itabs
INCLUDE ZZM_TEST_ALV_SCREEN *
2/ Description / Include functions
This include contains PBO and PAI events for the screen of report
ZZZJJ_TEST_ALV
3/ Responsibility
Author............: Judith Jessie Selvi
Creation Date.....: 28/03/2005
DATA FOR TABSTRIP 'MAIN_TAB'
CONTROLS: main_tab TYPE TABSTRIP.
DATA: BEGIN OF i_main_tab,
subscreen LIKE sy-dynnr,
prog LIKE sy-repid VALUE
'ZZZ_TEST',
pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
END OF i_main_tab.
*& Module STATUS_9001 OUTPUT
text
MODULE status_9001 OUTPUT.
IF custom_container1 IS INITIAL.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
Creating Object
PERFORM f9000_objects_create.
Building the field catalog
PERFORM f9001_build_field_cat TABLES i_fieldcat
USING 'MARA'.
PERFORM f9001_build_field_cat TABLES i_fieldcat1
USING 'MAKT'.
Modifying the field catalog
PERFORM f9002_modify_field_cat TABLES i_fieldcat.
For Layout
PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
ENDIF.
ENDMODULE. " STATUS_9001 OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET OUTPUT
Call method to display in the output grid
MODULE main_tab_active_tab_set OUTPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
To display report
i_main_tab-subscreen = '9100'.
CALL METHOD o_alvgrid1->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output1[]
it_fieldcatalog = i_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN c_main_tab-tab2.
To display report
i_main_tab-subscreen = '9200'.
CALL METHOD o_alvgrid2->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = c_lay
is_layout = w_layout
CHANGING
it_outtab = i_output2[]
it_fieldcatalog = i_fieldcat1[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i005 WITH text-e06."Error in ALV report display
LEAVE LIST-PROCESSING.
ENDIF.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET OUTPUT
*& Module MAIN_TAB_ACTIVE_TAB_GET INPUT
Check & Process the selected Tab
MODULE main_tab_active_tab_get INPUT.
CASE sy-ucomm.
WHEN c_main_tab-tab1.
i_main_tab-pressed_tab = c_main_tab-tab1.
WHEN c_main_tab-tab2.
i_main_tab-pressed_tab = c_main_tab-tab2.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_GET INPUT
*& Module USER_COMMAND_9001 INPUT
User Command
MODULE user_command_9001 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
PERFORM exit_program.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANC'.
PERFORM exit_program.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. USER_COMMAND_9000 INPUT
*& Module MAIN_TAB_ACTIVE_TAB_SET INPUT
Set sunscreen
MODULE main_tab_active_tab_set INPUT.
main_tab-activetab = i_main_tab-pressed_tab.
CASE i_main_tab-pressed_tab.
WHEN c_main_tab-tab1.
i_main_tab-subscreen = '9100'.
WHEN c_main_tab-tab2.
i_main_tab-subscreen = '9200'.
WHEN OTHERS.
DO NOTHING
ENDCASE.
ENDMODULE. MAIN_TAB_ACTIVE_TAB_SET INPUT
Thanks & Regards,
Judith. -
ALV GRID Display using oops in sub screen in which sub screen is in tab
Hi Mac,
My requirement is to display an ALV Grid with data in a subscreen which is called in tab strip.
Could you please help me the code of how actaully i can call th ALV in the tab.
I want to display one field in editable and remaining 4 fields in display mode.
Does any one had faced the same issue.This is standard program cloning object.
Thanks
Satish Rajuwhat is the question? Callin grid in subscreen is the same as in other screen. Create PBO module for creating the grid, PAI to evaluate comands.
Regards,
Clemens -
ALV grid control in module pool
Hi All,
Below is the problem I am facing, can anyone plz let me know the solution.
I am using ALV grid control on the subscreen.
If I enter material num and press enter on the grid control, it should validate the material num and display the material text.
If I enter wrong material number it should display error on the bottom line of the screen(say task bar). If I use 1) message e112(se), screen is terminated,
2) message i112(se), displaying message in the dialog box which users don't prefer.
3) message s112(se), It is displaying at the bottom, which is perfect, but program execution is not ending. I tried using 'leave screen' but giving error as leave screen cannot be used in subscreens. If I use 'leave program' it is terminating the screen.
Is there any other way to terminate the program flow but should come to the screen again.
Any ideas plz.Hi,
Use 'LEAVE TO SCREEN <screen no>'.
Otherwise go & check the following link,
http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/frameset.htm -
ALV Grid: refresh in sub screens
Hello All,
I have some issues with internal table display in ALV grid.
The following is the scenario.
I am in a wizard which has 2 sub screens (SScreen 1 and sscreen 2).
1)On sscreen 1, i have a input field,where i provide a value and on clicking the next button i get a list of values which i display on sub screen 2 using ALV grid.
2)Now i go back to sscreen1 and change the value in the input field,since i use on-request module, i know the value in the field has changed and now i need to display new set of values on sscreen 2.
In this case i clear the internal table, get new values for internal table and then call set_values_for_first_display().However i still get the old values displayed on SScreen 2!!!!.
Any suggestions on what i might be doing wrong?
Cheers
DevHi Vijay,
Thanks for the info.
I will try refresh_table_display option after getting to work in a couple of hours.
I am initializing the grid and control everytime i change a value on Subscreen 1 in the PBO of Subscreen 2(the screen where the ALV list is displayed).
That is the reason why i call set_table_first_display, whenever there are new values in the internal table and avoid refresh_table_display.
Cheers
Dev -
Can we have two alv grid in the output
Hi
Can we have two alv grid in the output?. If yes how can we do that using oops alv. I think first need to create the container on that two subscreen. is this correct? Thanks.
Regards
Raj>
Rajitha1234 wrote:
> Hi
>
> Can we have two alv grid in the output?. If yes how can we do that using oops alv. I think first need to create the container on that two subscreen. is this correct? Thanks.
>
> Regards
> Raj
Hi Rajitha,
You can have as many as ALV output in the screen By using OOPS.
By using Container you can pass ALV output.
see the sample Program SALV_TEST_TABLE.
Regards,
Prabhudas -
How to make the first row selected before the display of ALV grid
Hello Experts,
I created a ALV grid using custom container in a screen . Now i want do the follwing:
1. i want that, the <b>first line must be selected before the display of ALV.</b>
2. I have selection buttons . But i dont want the multiselect button and the
standard toolbar in the ALV grid.
Could any one please help me regarding the above?
Thanks & Regards
Sudhansucan u pls explain in more details with an example?
I am telling u the scenario.
1. i have a screen(Modal dialog Box) containing ALV grid with selection buttons for each row (top part) and a subscreen(second part).
Now when i click on a selection button, it will display the corresponding values in the subscreen.
When this screen will display for the first time , then first row of the ALV grid should be selected and the corresponding values should be displayed in the subscreen.
i wrote the following code in the PAI. But when i select a record its not triggering the PAI.
DATA:
gi_index_rows TYPE lvc_t_row, " Internal table for indexes of selected rows
g_selected_row LIKE lvc_s_row, " Information about 1 row
l_lines TYPE i.
CLEAR g_wa_vdmeko.
*get selected row
CALL METHOD g_alv_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE g_int_vdmeko INDEX g_selected_row-index INTO g_wa_vdmeko.
SELECT SINGLE *
FROM vdmepov
WHERE bukrs = g_wa_vdmeko-bukrs AND
styp = g_wa_vdmeko-styp AND
sbez = g_wa_vdmeko-sbez AND
svym = g_wa_vdmeko-svym AND
svnr = g_wa_vdmeko-svnr.
ENDLOOP.
I am displayinng the ALV using method "set_alv_for_first_display".
Please help if u have any idea..................
Thanks
Sudhansu
Maybe you are looking for
-
Hi We have scheduled job running a console application daily. For some reason on Sunday's only the scheduler says it ran successfully but no email confirmation, table entries and the normal processing occurs. This happens only on a Sunday and for no
-
Trouble with a downloaded app fom app world
Dear forum members: I've downloaded an app named PHP in 20 demo and it requires verification of my Blackberry ID to buy it but I enter the information and it gives an error of invalid Blackberry ID and I can't buy it. Any help would be appreciated di
-
Why did they take away the "Open In New Tab"option in Top Sites, Bookmarks, and History? This very annoying.
-
How do i fade an instrument in?
Im not sure if this is possible on garageband for ipad, but can you fade in instruments/tracks? The only thing related to fading is to make a general fade out automatically at the end of the song. Otherwise, it seems as though you can only set tracks
-
HOW TO RECOVER MY PASSWORD BACKUP IN ITUNES
HOW TO RECOVER MY PASSWORDBACKUP IN ITUNES .?