09-26-2008 7:06 AM
Hi Experts
When i am doing the total records in top-of-page. its picking all the buttons same . how can i do total records for each button in oops concept.please help me and one more thing is when you double click on cell its displaying the secondary list and coming back to first list i am loosing the total expect double click colum.how does it happen.
09-26-2008 8:11 AM
09-26-2008 8:34 AM
Hi Narin
Already i got the top-of-page but total records is not changing when u click on other buttons . its giving the same records
Edited by: reddy on Sep 26, 2008 9:34 AM
09-26-2008 9:32 AM
When you click on the Button , Refresh the TOP of page control , Initialize the topofpage control, again call the Display method with the updated content.
09-26-2008 9:37 AM
Hi,
Everytime after the click before anything happens Refresh the control.
Hope it helps.
Good luck
Narin
09-26-2008 12:23 PM
Hi Vijay Garu
How can i do that . Do u have any sample program with different buttons and different top-of-page please help me and other thing is i am having problem with double click event.its working fine but as soon as i am coming back initial screen its only giving the total one that i click rest of the colums its not giving total.how can i do that.
09-26-2008 1:05 PM
I just Modifed my weblog code. and i set the UPDATE button in the Status on application toolbar.
REPORT z_oo_alv_top_of_page MESSAGE-ID zz .
DATA: it_flight TYPE TABLE OF sflight.
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
DATA:
g_container TYPE scrfname VALUE 'CONTROL',
o_dyndoc_id TYPE REF TO cl_dd_document,
o_splitter TYPE REF TO cl_gui_splitter_container,
o_parent_grid TYPE REF TO cl_gui_container,
o_parent_top TYPE REF TO cl_gui_container,
o_html_cntrl TYPE REF TO cl_gui_html_viewer.
*----------------------------------------------------------------------*
* CLASS LCL_EVENT_HANDLER DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*Event Handler for Top of page
top_of_page FOR EVENT top_of_page
OF cl_gui_alv_grid
IMPORTING e_dyndoc_id.
ENDCLASS. "lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
* CLASS LCL_EVENT_HANDLER IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD top_of_page.
* Top-of-page event
PERFORM event_top_of_page USING o_dyndoc_id.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
DATA: g_custom_container TYPE REF TO cl_gui_custom_container,
g_handler TYPE REF TO lcl_event_handler. "handler
START-OF-SELECTION.
SELECT *
FROM sflight
UP TO 20 ROWS
INTO TABLE it_flight.
END-OF-SELECTION.
IF NOT it_flight[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE i002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*----------------------------------------------------------------------*
* MODULE STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'TITLE'.
IF g_custom_container IS INITIAL.
PERFORM create_and_init_alv.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
* MODULE USER_COMMAND_0100 INPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
when 'UPDATE'.
free o_dyndoc_id.
* Create TOP-Document
CREATE OBJECT o_dyndoc_id
EXPORTING style = 'ALV_GRID'.
* Top-of-page event
PERFORM event_top_of_pageupd USING o_dyndoc_id.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM create_and_init_alv .
DATA: g_grid TYPE REF TO cl_gui_alv_grid.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
* Create TOP-Document
CREATE OBJECT o_dyndoc_id
EXPORTING style = 'ALV_GRID'.
* Create Splitter for custom_container
CREATE OBJECT o_splitter
EXPORTING parent = g_custom_container
rows = 2
columns = 1.
CALL METHOD o_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = o_parent_top.
CALL METHOD o_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = o_parent_grid.
* Set height for g_parent_html
CALL METHOD o_splitter->set_row_height
EXPORTING
id = 1
height = 50.
CREATE OBJECT g_grid
EXPORTING i_parent = o_parent_grid.
CREATE OBJECT g_handler.
SET HANDLER g_handler->top_of_page FOR g_grid.
*Calling the Method for ALV output
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = it_flight[].
*
CALL METHOD o_dyndoc_id->initialize_document
EXPORTING
background_color = cl_dd_area=>col_textarea.
* Processing events
CALL METHOD g_grid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_dyndoc_id.
ENDFORM. "CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
*& Form EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
FORM event_top_of_page USING dg_dyndoc_id TYPE REF TO cl_dd_document.
CALL METHOD dg_dyndoc_id->initialize_document
EXPORTING
background_color = cl_dd_area=>col_tree_level4.
DATA : dl_text(255) TYPE c. "Text
CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = 'Flight Details'
sap_style = cl_dd_area=>heading
sap_fontsize = cl_dd_area=>large
sap_color = cl_dd_area=>list_heading_int.
CALL METHOD dg_dyndoc_id->add_gap
EXPORTING
width = 200.
CALL METHOD o_dyndoc_id->add_picture
EXPORTING
picture_id = 'ENJOYSAP_LOGO'.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
CALL METHOD dg_dyndoc_id->new_line.
CLEAR : dl_text.
* program ID
dl_text = 'Program Name :'.
CALL METHOD dg_dyndoc_id->add_gap.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int.
CLEAR dl_text.
dl_text = sy-repid.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
CLEAR : dl_text.
* program ID
dl_text = 'User Name :'.
CALL METHOD dg_dyndoc_id->add_gap.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int.
CLEAR dl_text.
dl_text = sy-uname.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
CLEAR : dl_text.
* Run Date
dl_text = 'Run Date :'.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int.
CLEAR dl_text.
CALL METHOD dg_dyndoc_id->add_gap exporting WIDTH = 2.
* Move date
WRITE sy-datum TO dl_text.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
CLEAR : dl_text.
*Time
dl_text = 'Time :'.
CALL METHOD dg_dyndoc_id->add_gap.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int.
CLEAR dl_text.
* Move time
WRITE sy-uzeit TO dl_text.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
PERFORM display.
ENDFORM. " EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM display.
* Creating html control
IF o_html_cntrl IS INITIAL.
CREATE OBJECT o_html_cntrl
EXPORTING
parent = o_parent_top.
ENDIF.
CALL METHOD o_dyndoc_id->merge_document.
o_dyndoc_id->html_control = o_html_cntrl.
* Display document
CALL METHOD o_dyndoc_id->display_document
EXPORTING
reuse_control = 'X'
parent = o_parent_top
EXCEPTIONS
html_display_error = 1.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'Error in displaying top-of-page'(036).
ENDIF.
ENDFORM. " display
FORM event_top_of_pageupd USING dg_dyndoc_id TYPE REF TO cl_dd_document.
DATA : dl_text(255) TYPE c. "Text
CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = 'Flight Details'
sap_style = cl_dd_area=>heading
sap_fontsize = cl_dd_area=>large
sap_color = cl_dd_area=>list_heading_int.
CALL METHOD dg_dyndoc_id->add_gap
EXPORTING
width = 200.
* Run Date
dl_text = 'Run Date :'.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_heading_int.
CLEAR dl_text.
CALL METHOD dg_dyndoc_id->add_gap exporting WIDTH = 2.
* Move date
WRITE sy-datum TO dl_text.
CALL METHOD o_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = cl_dd_area=>heading
sap_color = cl_dd_area=>list_negative_inv.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
CLEAR : dl_text.
* Add new-line
CALL METHOD dg_dyndoc_id->new_line.
PERFORM display.
ENDFORM. " EVENT_TOP_OF_PAGE
Flow logic.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
Check it and let me know .
09-26-2008 3:08 PM
09-27-2008 1:33 AM
what is not working..? did you place custom control on the screen and name it 'CONTROL' . and set the status in PBO , Did you add any application toolbar button with function code 'UPDATE'.
are you getting any output..?
10-01-2008 11:20 AM
Hi vijay garu
i did what exactly u explained in above but i am not getting refresh . i am not getting any error . its giving the same total for all the buttons.
i did put the update button on application toolbar.
Edited by: reddy on Oct 1, 2008 12:20 PM
09-29-2008 7:41 AM
Hi vijay Garu
actuvally i am displlaying the ouput on screen200 and in that screen i got 6 buttons . 3rd button got double click event for this one i am using screen 300 .when you double click on cell its displaying the secondary list and coming back to first list i am loosing the total expect double click colum.how does it happen.
Edited by: reddy on Sep 29, 2008 8:43 AM
09-29-2008 8:02 AM
Hi,
There probably is an issue with you Fieldcat can you paste the PBO code of screen 200 and 300.
santhosh
09-29-2008 8:19 AM
PROCESS BEFORE OUTPUT.
MODULE get_absencedata.
MODULE create_object300.
MODULE STATUS_0300.
MODULE get_absencedata.
REFRESH IT_SecAbs.
CLEAR IT_SecAbs.
IF W_PERNR is initial.
Loop at IT_AbsDet.
MOVE-CORRESPONDING IT_AbsDet TO IT_SecAbs.
APPEND IT_SecAbs.
clear IT_SecAbs.
ENDLOOP.
ELSE.
Loop at IT_AbsDet WHERE PERNR = W_PERNR.
MOVE-CORRESPONDING IT_AbsDet TO IT_SecAbs.
APPEND IT_SecAbs.
clear IT_SecAbs.
ENDLOOP.
ENDIF.
endmodule.
MODULE create_object300.
var300-report = sy-repid.
var300_save = 'A'.
clear cont100.
IF cont300 is initial.
Perform build_fcat300.
Create object cont300
Exporting
container_name = 'ALV300'.
create an instance of alv control
Create object grid300
Exporting i_parent = cont300.
Layo300-zebra = 'X'.
Call method grid300->set_table_for_first_display
EXPORTING
is_layout = layo300
is_variant = var300
i_save = var300_save
CHANGING
it_fieldcatalog = fcat300[]
it_outtab = IT_SecAbs[].
ELSE.
call method grid300->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = fcat300[].
call method grid300->refresh_table_display.
call method cl_gui_control=>set_focus
EXPORTING
control = grid300.
call method cl_gui_cfw=>flush.
endif.
endmodule.
MODULE STATUS_0300 OUTPUT.
SET PF-STATUS '0300'.
SET TITLEBAR '300'.
endmodule.
screen 400 is same as above .
alv400
used grid400
cont400
09-29-2008 8:23 AM
Hi,
ELSE.
*call method grid300->set_frontend_fieldcatalog
*EXPORTING
*it_fieldcatalog = fcat300[].
call method grid300->refresh_table_display.
call method cl_gui_control=>set_focus
EXPORTING
comment the set_frontend_fieldcatalog method and try
santhosh
Edited by: Kaluvala Santhosh on Sep 29, 2008 12:53 PM
09-29-2008 8:23 AM
Hi,
How exactly you have done the field catalog ? Are you getting any error ?
Regards
Narin
09-29-2008 8:41 AM
I did try
*call method grid100->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = fcat100[].
still its not working.
09-29-2008 8:48 AM
Hi,
There is some confusion in your screen numbers you have pasted screen 300 PBO your comment shows screen 100 code you are talking abt screen 200 and 300 some times 400..can please clear about the screen numbers and thier PBO's
santhosh
09-29-2008 8:43 AM
I am not getting any error . its displaying ouput only when i am doing double-click event than i am not getting total . its reflecting the all buttons.
09-29-2008 8:58 AM
Hi Santosh garu
screen 100 (Buttons)
screen 200 (to dispay the o/p)
screen 300(to display the o/p button 3rd Doudle click event . 4th colum(each Cells) )
screen 400(to display the o/p button 3rd Double click event 5th colum (each Cells) )
09-29-2008 9:05 AM
09-29-2008 9:07 AM
10-02-2008 9:17 AM