‎2007 Nov 22 9:30 AM
Hi Experts,
Can anybody update me how to come back to 12 list when we are in 20 list in case inteactive reports.
Please send some piece of code for this.
And how create buttons in ALV reports and how to devlop Interactive reports by using ALV's.
I will be happy if some sort of code will send.
Advanced thanks for observing these quere and expecting solutio
JP.
‎2007 Nov 22 9:36 AM
Hi,
You can set the field SY-LSIND to move to previous list.
http://help.sap.com/saphelp_46c/helpdata/en/9f/dba2eb35c111d1829f0000e829fbfe/content.htm
You can set your own status for the ALV List and add your buttons on it. Try searching the Forum/Google you might find some Sample Code also for that.
Regards,
Abhishek
‎2007 Nov 22 9:37 AM
Hi Prakash,
This code will help for u,
Here also having set button in menu bar (For Call a script)
TYPE-POOLS : SLIS.
TABLES : VBAK.
Internal Table for Sales Document Header Data.
DATA : BEGIN OF I_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERNAM LIKE VBAK-ERNAM,
AUDAT LIKE VBAK-AUDAT,
NETWR LIKE VBAK-NETWR,
VKORG LIKE VBAK-VKORG,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
END OF I_VBAK.
Internal Table for Sales Document Item Data.
DATA : BEGIN OF I_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MANTR LIKE VBAP-MATNR,
NETWR LIKE VBAP-NETWR,
LGORT LIKE VBAP-LGORT,
END OF I_VBAP.
For Fieldcatalog, Top of Page, and Layout.
DATA : FIELD TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
FIELD1 TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
TOP TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
TOP1 TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV.
Selection screen Declarations.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
Initialization event
INITIALIZATION.
Assign Values to top page internal tables.
TOP-TYP = 'H'.
TOP-INFO = 'Sales Document Details'.
APPEND TOP.
CLEAR TOP.
TOP1-TYP = 'H'.
TOP1-INFO = 'Sales Document Item Details'.
APPEND TOP1.
CLEAR TOP1.
Start of selection Event.
START-OF-SELECTION.
SELECT VBELN
ERNAM
AUDAT
NETWR
VKORG
VTWEG
SPART FROM VBAK INTO TABLE I_VBAK
WHERE VBELN IN S_VBELN.
To call field, Layout, Display Subroutines.
PERFORM FIELD.
PERFORM LAYOUT.
PERFORM DISPLAY.
Definition for top subroutine.
FORM TOP.
To call REUSE_ALV_COMMENTARY_WITE function module,
and Pass the top internal table and logo name.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = TOP[]
I_LOGO = 'LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
ENDFORM.
&----
*& Form LAYOUT
&----
text
----
--> p1 text
<-- p2 text
----
Definition for Layout subroutines.
form LAYOUT .
Enable the Layout field Zebra.
LAYOUT-ZEBRA = 'X'.
endform. " LAYOUT
&----
*& Form FIELD
&----
text
----
--> p1 text
<-- p2 text
----
Definition for Field Subroutine.
form FIELD .
To call a REUSE_ALV_FIELDCATALOG_MERGE function module, and Pass
Program name, Internal table name, and Include name, and get
fieldcatalog internal table.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'I_VBAK'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = FIELD[]
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.
endform. " FIELD
&----
*& Form DISPLAY
&----
text
----
--> p1 text
<-- p2 text
----
Definition for Display subroutine.
form DISPLAY .
To call a REUSE_ALV_GRID_DISPLAY function module, Pass
callback_program, pf_status subroutine, user_command sobroutine, top-of-page subroutine,
layout, and Field catalog internal tables, and get
Sales document Header Data details.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZCLASS_VBAK01'
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'SECOND'
I_CALLBACK_TOP_OF_PAGE = 'TOP'
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 = LAYOUT
IT_FIELDCAT = FIELD[]
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 = I_VBAK[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY
Definition for Status subroutine.
FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
Set pf status value.
SET PF-STATUS 'SALES' EXCLUDING EXTAB.
ENDFORM.
Definition for secondary list subroutine.
FORM SECOND USING OK_CODE LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
Check the function code using case statement.
CASE OK_CODE.
WHEN '&IC1'.
DATA : V_VBELN TYPE VBELN_VA.
IF SELFIELD-FIELDNAME = 'VBELN'.
V_VBELN = SELFIELD-VALUE.
SELECT VBELN
POSNR
MATNR
NETWR FROM VBAP INTO CORRESPONDING FIELDS OF TABLE I_VBAP
WHERE VBELN = V_VBELN.
IF SY-SUBRC = 0.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'I_VBAP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = FIELD1[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZCLASS_VBAK01'
I_CALLBACK_PF_STATUS_SET = 'STANDARD'
I_CALLBACK_USER_COMMAND = 'SCRIPT'
I_CALLBACK_TOP_OF_PAGE = 'TOP1'
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 = LAYOUT
IT_FIELDCAT = FIELD1[]
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 = I_VBAP[]
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.
ENDIF.
ENDCASE.
ENDFORM.
FORM TOP1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = TOP1[]
I_LOGO = 'LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
ENDFORM.
FORM STANDARD USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD_FULLSCREEN' EXCLUDING 'EXTAB'.
ENDFORM.
FORM SCRIPT USING OK_CODE TYPE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
CASE OK_CODE.
WHEN '&PRINT'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZCLASS_VBAK01'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_VBAP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'SAMPLE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDCASE.
ENDFORM.
If u have doubt reply me...
Regards,
Vijay
‎2007 Nov 22 9:43 AM
hI
When you want to move from 5th list to 1st list.. subract sy-lsind accordingly.
sy-lsind = sylsind - 5.
value = sy-index - 5
leave to screen value
Try these: FOR BUTTON
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproABAP-ALVControllingStandard+Buttons&
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_pfstatus.htm
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm
ALSO
also refer to this standard program
PROGRAM BCALV_GRID_05.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Purpose:
~~~~~~~~
Demonstrate the creation of an own toolbar button.
*----
-
To check program behavior
~~~~~~~~~~~~~~~~~~~~~~~~~
The report shows a list of flights of one airline.
Select one or more lines and press the 'Detail'-Button to popup
a dialog window with related bookings.
*----
-
Essential steps (Search for '§')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.Apply steps for event handling for events TOOLBAR and
USER_COMMAND (see example for print events)
2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
INCLUDE .
*********
Predefine a local class for event handling to allow the
declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.
*
*********
DATA: ok_code LIKE sy-ucomm,
gt_sflight TYPE TABLE OF sflight,
gt_sbook TYPE TABLE OF sbook,
g_repid LIKE sy-repid,
g_max type i value 100,
gs_layout TYPE lvc_s_layo,
cont_on_main TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver.
Set initial dynpro
SET SCREEN 100.
****************************************************************
LOCAL CLASSES: Definition
****************************************************************
*===============================================================
class lcl_event_receiver: local class to
define and handle own functions.
*
Definition:
~~~~~~~~~~~
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.
*
lcl_event_receiver (Definition)
*===============================================================
****************************************************************
LOCAL CLASSES: Implementation
****************************************************************
*===============================================================
class lcl_event_receiver (Implementation)
*
*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA: ls_toolbar TYPE stb_button.
*....................................................................
E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
This class has got one attribute, namly MT_TOOLBAR, which
is a table of type TTB_BUTTON. One line of this table is
defined by the Structure STB_BUTTON (see data deklaration above).
*
A remark to the flag E_INTERACTIVE:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'e_interactive' is set, if this event is raised due to
the call of 'set_toolbar_interactive' by the user.
You can distinguish this way if the event was raised
by yourself or by ALV
(e.g. in method 'refresh_table_display').
An application of this feature is still unknown...
append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
append an icon to show booking table
CLEAR ls_toolbar.
MOVE 'BOOKINGS' TO ls_toolbar-function.
MOVE icon_employee TO ls_toolbar-icon.
MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo.
MOVE 'Detail'(112) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
*----
-
METHOD handle_user_command.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: lt_rows TYPE lvc_t_row.
CASE e_ucomm.
WHEN 'BOOKINGS'.
CALL METHOD grid1->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
else.
perform show_booking_table tables lt_rows.
ENDIF.
ENDCASE.
ENDMETHOD. "handle_user_command
*----
-
ENDCLASS.
*
lcl_event_receiver (Implementation)
*===================================================================
*----
*
FORM EXIT_PROGRAM *
*----
*
FORM exit_program.
The instance grid2 is freed not until the program exits from the
main screen.
(It is created only once during the first selection of SBOOK,
no matter how many times the second window is called).
*
CALL METHOD custom_container1->free.
IF not custom_container2 is initial.
CALL METHOD custom_container2->free.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LEAVE PROGRAM.
ENDFORM.
*&----
*
*& Module PBO_100 OUTPUT
*&----
*
text
*----
*
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
g_repid = sy-repid.
IF custom_container1 is initial.
select data from table SFLIGHT
PERFORM select_table_sflight CHANGING gt_sflight.
create a custom container control for our ALV Control
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_on_main
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 = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
create an instance of alv control
CREATE OBJECT grid1
EXPORTING i_parent = custom_container1.
*
Set a titlebar for the grid control
*
gs_layout-grid_title = 'Flights'(100).
allow to select multiple lines
gs_layout-sel_mode = 'A'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gt_sflight.
********
->Create Object to receive events and link them to handler methods.
When the ALV Control raises the event for the specified instance
the corresponding method is automatically called.
*
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR grid1.
SET HANDLER event_receiver->handle_toolbar FOR grid1.
*
********
§ 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD grid1->set_toolbar_interactive.
ENDIF. "IF grid1 IS INITIAL
CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
ENDMODULE. " PBO_100 OUTPUT
*&----
*
*& Module PAI_100 INPUT
*&----
*
text
*----
*
MODULE pai_100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " PAI_100 INPUT
*&----
*
*& Module PBO_0101 OUTPUT
*&----
*
text
*----
*
MODULE pbo_0101 OUTPUT.
IF custom_container2 is initial.
(the data from sbook is already selected)
create a custom container control for our ALV Control
CREATE OBJECT custom_container2
EXPORTING
container_name = cont_on_dialog
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 = g_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
create an instance of alv control
CREATE OBJECT grid2
EXPORTING i_parent = custom_container2.
*
change title
*
gs_layout-grid_title = 'Bookings'(101).
gs_layout-sel_mode = ' '.
CALL METHOD grid2->set_table_for_first_display
EXPORTING i_structure_name = 'SBOOK'
is_layout = gs_layout
CHANGING it_outtab = gt_sbook.
ELSE.
CALL METHOD grid2->refresh_table_display.
ENDIF. "IF custom_container2 IS INITIAL.
CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid2.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
ENDMODULE. " PBO_0101 OUTPUT
*&----
*
*& Form SELECT_TABLE_SFLIGHT
*&----
*
text
*----
*
<--P_GT_SFLIGHT text
*----
*
FORM select_table_sflight CHANGING p_gt_sflight LIKE gt_sflight[].
SELECT * FROM sflight INTO TABLE p_gt_sflight up to g_max rows.
ENDFORM. " SELECT_TABLE_SFLIGHT
*&----
*
*& Form SELECT_TABLE_SBOOK
*&----
*
text
*----
*
-->P_LS_SFLIGHT text
<--P_GT_SBOOK text
*----
*
FORM select_table_sbook USING p_ls_sflight LIKE LINE OF gt_sflight
CHANGING p_gt_sbook LIKE gt_sbook[].
DATA: lt_sbook LIKE gt_sbook[].
Select data from sbook according to a line of sflight
and append that data to table p_gt_sbook
*
SELECT * FROM sbook INTO TABLE lt_sbook
WHERE carrid = p_ls_sflight-carrid
AND connid = p_ls_sflight-connid
AND fldate = p_ls_sflight-fldate.
APPEND LINES OF lt_sbook TO p_gt_sbook.
ENDFORM. " SELECT_TABLE_SBOOK
*&----
*
*& Module PAI_0101 INPUT
*&----
*
text
*----
*
MODULE pai_0101 INPUT.
CASE ok_code.
WHEN 'RETURN'.
LEAVE TO SCREEN 0.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " PAI_0101 INPUT
*&----
*
*& Form show_booking_table
*&----
*
text
*----
*
-->P_ET_INDEX_ROWS text
*----
*
FORM show_booking_table TABLES p_et_index_rows
STRUCTURE lvc_s_row.
DATA: ls_selected_line LIKE lvc_s_row,
lf_row_index TYPE lvc_index,
ls_sflight LIKE LINE OF gt_sflight.
CLEAR gt_sbook[].
LOOP AT p_et_index_rows INTO ls_selected_line.
lf_row_index = ls_selected_line-index.
read selected row from internal table gt_sflight
READ TABLE gt_sflight INDEX lf_row_index INTO ls_sflight.
select corresponding lines of table sbook
and append new lines to global table
PERFORM select_table_sbook USING ls_sflight
CHANGING gt_sbook.
ENDLOOP.
call dialog screen and display new alv control
CALL SCREEN 101 STARTING AT 10 5.
ENDFORM. " show_booking_table
‎2010 Dec 09 3:53 AM