2007 Jul 17 9:14 AM
how to call 2 diff alv reports in 1 custom control dynamically
2007 Jul 18 5:21 AM
my problem is i am having 2 buttons b1 b2 in one sub screen
button start in one sub screen
cust contl in one sub scren 2 field ctalog for 2 alv reports.
if i press button b1 then i am showing b1 related screens, field catalog then if i press start button i am able to show b1 alv report in that cust cntrl .
but when i press button b2 remaining screen every thing changing according to b2 accept alv field catalog b1 field catlog only displaying.
if i press start then i am able to show 2nd alv report and sceond field catlog .
now i want to show second alv field catalog immediately along with b2 screens in that custcontrl area.
Naveen,
Try to free BOTH b1 alv grid and the custom control when button b2 is pressed, and re-create the custom control and the grid.
FREE: grid1,
CUSTOM_CONTROL.
CREATE OBJECT CUSTOM_CONTROL...
...
...
Similarly when b1 is pressed from b2, free b2 grid and custom control.
Regards,
Rao A
2007 Jul 17 11:17 AM
You can use a splitter control and include as many ALV controls as you want:
DATA: cc_main TYPE REF TO cl_gui_custom_container,
cc_splitter TYPE REF TO cl_gui_splitter_container.
CREATE OBJECT cc_main
EXPORTING
container_name = 'CUSTOM_CONTROL'.
Divide the custom control into 2 rows x 1 column
CREATE OBJECT cc_splitter
EXPORTING
parent = cc_main
rows = 2
columns = 1.
Get the first row sub-container
CALL METHOD cc_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = cc_header.
Get the second row sub-container
CALL METHOD cc_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = cc_alv2.
Now you can use cc_alv1 and cc_alv2 to display two ALV grids.
Regards,
Rao A
2007 Jul 18 5:21 AM
my problem is i am having 2 buttons b1 b2 in one sub screen
button start in one sub screen
cust contl in one sub scren 2 field ctalog for 2 alv reports.
if i press button b1 then i am showing b1 related screens, field catalog then if i press start button i am able to show b1 alv report in that cust cntrl .
but when i press button b2 remaining screen every thing changing according to b2 accept alv field catalog b1 field catlog only displaying.
if i press start then i am able to show 2nd alv report and sceond field catlog .
now i want to show second alv field catalog immediately along with b2 screens in that custcontrl area.
2007 Jul 18 5:46 AM
Naveen,
Try to free BOTH b1 alv grid and the custom control when button b2 is pressed, and re-create the custom control and the grid.
FREE: grid1,
CUSTOM_CONTROL.
CREATE OBJECT CUSTOM_CONTROL...
...
...
Similarly when b1 is pressed from b2, free b2 grid and custom control.
Regards,
Rao A
2007 Jul 18 5:31 AM
Hi Naveen,
REPORT ytest .
* Based on: BCALV_GRID_DEMO.
TYPE-POOLS: icon.
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE lvc_emphsz.
TYPES: button2 TYPE lvc_emphsz.
TYPES: button3 TYPE lvc_emphsz.
TYPES: button4 TYPE lvc_emphsz.
TYPES: END OF ty_s_sflight.
DATA:
gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
gt_fcat TYPE lvc_t_fcat.
DATA: ok_code LIKE sy-ucomm,
* gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE BCALV_GRID_DEMO_0100_CONT1′,
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
**
* CLASS lcl_eventhandler DEFINITION
**
*
**
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. lcl_eventhandler DEFINITION
**
* CLASS lcl_eventhandler IMPLEMENTATION
**
*
**
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
FIELD-SYMBOLS:
TYPE ty_s_sflight,
TYPE ANY.
READ TABLE gt_sflight ASSIGNING INDEX es_row_no-row_id.
CHECK ( IS ASSIGNED ).
* Set all radio buttons unselected
-button1 = ICON_CANCEL.
-button2 = ICON_CANCEL.
-button3 = ICON_CANCEL.
-button4 = ICON_CANCEL.
ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE
TO .
IF ( IS ASSIGNED ).
* Set selected radio button selected.
= ICON_OKAY.
ENDIF.
* Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = DUMMY
* IMPORTING
* RC =
.
ENDMETHOD. handle_hotspot_click
ENDCLASS. lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
**
* MAIN *
**
PERFORM select_data.
CALL SCREEN 100.
**
* MODULE PBO OUTPUT *
**
MODULE pbo OUTPUT.
SET PF-STATUS MAIN100′.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
PERFORM build_fieldcatalog.
CALL METHOD grid1->set_table_for_first_display
* EXPORTING
* i_structure_name = SFLIGHT
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
* Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR grid1.
else.
CALL METHOD grid1->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 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.
ENDMODULE. PBO OUTPUT
**
* MODULE PAI INPUT *
**
MODULE pai INPUT.
* to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
* CASE ok_code.
CASE sy-ucomm.
WHEN EXIT.
PERFORM exit_program.
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. PAI INPUT
**
* FORM EXIT_PROGRAM *
**
FORM exit_program.
* CALL METHOD G_CUSTOM_CONTAINER->FREE.
* CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. EXIT_PROGRAM
*&*
*& Form BUILD_FIELDCATALOG
*&*
* text
*-*
* > p1 text
* 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE gt_fcat WHERE ( fieldname EMPHASIZE ).
CALL FUNCTION LVC_FIELDCATALOG_MERGE
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = SFLIGHT
* I_CLIENT_NEVER_DISPLAY = X
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
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.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = EMPHASIZE.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = BUTTON4′.
ls_fcat-icon = X.
ls_fcat-hotspot = X.
INSERT ls_fcat INTO gt_fcat INDEX 4.
*
ls_fcat-fieldname = BUTTON3′.
INSERT ls_fcat INTO gt_fcat INDEX 4.
*
ls_fcat-fieldname = BUTTON2′.
INSERT ls_fcat INTO gt_fcat INDEX 4.
*
ls_fcat-fieldname = BUTTON1′.
INSERT ls_fcat INTO gt_fcat INDEX 4.
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. BUILD_FIELDCATALOG
*&*
*& Form SELECT_DATA
*&*
* text
*-*
* > p1 text
*
Reward pts if found usefull
Regards
Sathish
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |