2009 Apr 03 12:09 PM
Hi,
I have written code to display the alv report but i need the contents of the table present in the report for further processing.I dont want to the report to be displayed.How to perform hiding of the report?
2009 Apr 03 12:11 PM
The report will be dispalyed only if u call the FM 'REUSE_ALV_GRID_DISPLAY' or using OO 'SET_TABLE_FIRST_DISPLAY'.
dont call this methods or FM. you will have data in ALV and can use it for further processing.
Hi,
I have written code to display the alv report but i need the contents of the table present in the report for further processing.I dont want to the report to be displayed.How to perform hiding of the report?
2009 Apr 03 12:11 PM
The report will be dispalyed only if u call the FM 'REUSE_ALV_GRID_DISPLAY' or using OO 'SET_TABLE_FIRST_DISPLAY'.
dont call this methods or FM. you will have data in ALV and can use it for further processing.
2009 Apr 03 12:28 PM
How to use 'SET_TABLE_FIRST_DISPLAY'?Can you please send a sample code.Whats the use of this.Plz help
2009 Apr 13 6:12 AM
'SET_TABLE_FOR_FIRST_DISPLAY' is used to ALV in case of Object Oriented ABAP where normal FM like REUSE_ALV_GRID_DISPLAY cannot be used.
Sample Code :
REPORT sy-repid.
*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Internal tables
*&---------------------------------------------------------------------*
DATA : g_t_ybcalv_mofq_tab TYPE TABLE OF ybcalv_mofq_tab INITIAL SIZE 0,
g_wa_ybcalv_mofq_tab TYPE ybcalv_mofq_tab.
*&---------------------------------------------------------------------*
*& Data Declarations
*&---------------------------------------------------------------------*
DATA : ok_code TYPE sy-ucomm.
*&---------------------------------------------------------------------*
*& Data Declarations for the ALV
*&---------------------------------------------------------------------*
*--- ALV Grid instance reference
DATA g_alvgrid TYPE REF TO cl_gui_alv_grid .
*--- Name of the custom control added on the screen
DATA gc_custom_control_name TYPE scrfname VALUE 'OO_ALV_CC'.
*--- Custom container instance reference
DATA g_container TYPE REF TO cl_gui_custom_container .
*--- Field catalog table
DATA : g_t_fieldcat TYPE lvc_t_fcat,
g_wa_fieldcat TYPE lvc_s_fcat.
*--- Layout structure
DATA gs_layout TYPE lvc_s_layo .
*&---------------------------------------------------------------------*
*& SELECTION-SCREEN
*&---------------------------------------------------------------------*
PARAMETERS : p_dtfrm TYPE laeda,
p_dtto TYPE laeda.
*&---------------------------------------------------------------------*
*& INITIALIZATION
*&---------------------------------------------------------------------*
INITIALIZATION.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
SELECT * FROM ybcalv_mofq_tab
INTO TABLE g_t_ybcalv_mofq_tab
WHERE laeda BETWEEN p_dtfrm AND p_dtto.
*&---------------------------------------------------------------------*
*& END-OF-SELECTION
*&---------------------------------------------------------------------*
END-OF-SELECTION.
CALL SCREEN 100. " ALV screen
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'Y100'.
* SET TITLEBAR 'xxx'.
PERFORM display_alv_output.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'SAVE'.
MODIFY ybcalv_mofq_tab FROM g_wa_ybcalv_mofq_tab.
WHEN 'DELE'.
WHEN 'INSE'.
DATA : l_rnum TYPE lvc_t_roid.
CALL METHOD g_alvgrid->get_selected_rows
IMPORTING
et_row_no = l_rnum.
WHEN 'BACK'.
LEAVE SCREEN.
WHEN 'CANCEL'.
LEAVE SCREEN.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM display_alv_output.
*-- Check if the ALVgrid is initial
IF g_alvgrid IS INITIAL.
*----Creating custom container instance
CREATE OBJECT g_container
EXPORTING
container_name = gc_custom_control_name
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.
*--Exception handling
ENDIF.
*----Creating ALV Grid instance
CREATE OBJECT g_alvgrid
EXPORTING
i_parent = g_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*----Preparing field catalog.
PERFORM prepare_fieldcat CHANGING g_t_fieldcat.
*----Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
IF g_t_ybcalv_mofq_tab IS NOT INITIAL.
CALL METHOD g_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = g_t_ybcalv_mofq_tab[]
it_fieldcatalog = g_t_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF.
*--If the grid is not initial
ELSE.
CALL METHOD g_alvgrid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
* EXCEPTIONS
* FINISHED = 1
* others = 2
.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF.
ENDFORM. "display_alv_output
*&---------------------------------------------------------------------*
*& Form prepare_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->G_T_FIELDCAT text
*----------------------------------------------------------------------*
FORM prepare_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
*
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'YBCALV_MOFQ_TAB'
CHANGING
ct_fieldcat = pt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*-- Modify the Fieldcat for certain columns as per requirement
LOOP AT pt_fieldcat INTO g_wa_fieldcat.
IF g_wa_fieldcat-fieldname = 'MATNR'.
g_wa_fieldcat-edit = 'X'.
MODIFY pt_fieldcat FROM g_wa_fieldcat.
ENDIF.
IF g_wa_fieldcat-fieldname = 'ERNAM'.
g_wa_fieldcat-emphasize = 'X'.
MODIFY pt_fieldcat FROM g_wa_fieldcat.
ENDIF.
IF g_wa_fieldcat-fieldname = 'BRGEW'.
g_wa_fieldcat-edit = 'X'.
g_wa_fieldcat-do_sum = 'X'.
MODIFY pt_fieldcat FROM g_wa_fieldcat.
ENDIF.
ENDLOOP.
*-- Set the Fieldcat
CALL METHOD g_alvgrid->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = pt_fieldcat[].
ENDFORM. "prepare_fieldcat
*&---------------------------------------------------------------------*
*& Form prepare_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->GS_LAYOUT text
*----------------------------------------------------------------------*
FORM prepare_layout CHANGING gs_layout TYPE lvc_s_layo.
CALL METHOD g_alvgrid->get_frontend_layout
IMPORTING
es_layout = gs_layout.
gs_layout-grid_title = 'OO ALV Concepts - Editable' .
CALL METHOD g_alvgrid->set_frontend_layout
EXPORTING
is_layout = gs_layout.
gs_layout-zebra = 'X'.
ENDFORM. "prepare_layout
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |