2007 Feb 28 4:12 AM
Hi Experts,
Is there any other classes available for display settings in ALV other than the below mentioned.The following classes doesn't works in SAP 5.0.
Is this belongs to NetWeaver family?
cl_salv_table
cl_salv_functions
cl_salv_display_settings
Can any one pls help it out to do the same in abap objects?
Regards,
User
Hi Experts,
Is there any other classes available for display settings in ALV other than the below mentioned.The following classes doesn't works in SAP 5.0.
Is this belongs to NetWeaver family?
cl_salv_table
cl_salv_functions
cl_salv_display_settings
Can any one pls help it out to do the same in abap objects?
Regards,
User
2007 Feb 28 9:17 AM
Hello Raj
If you are indeed working on an ECC 5.0 system then I do not see where the problem is. The following sample report <b>ZUS_SDN_CL_SALV_TABLE_DISPLAY</b> demonstrates how to adjust the layout of the ALV list. In addition, you see the coding for <i>event handling</i> and <i>column adjustment</i>.
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_CL_SALV_TABLE_DISPLAY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zus_sdn_cl_salv_table_display.
TYPE-POOLS: abap.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
DATA:
go_table TYPE REF TO cl_salv_table,
go_events TYPE REF TO cl_salv_events_table,
*
go_columns TYPE REF TO cl_salv_columns_table,
go_column TYPE REF TO cl_salv_column,
*
go_display TYPE REF TO cl_salv_display_settings.
PARAMETERS:
p_outlen TYPE lvc_outlen DEFAULT '20',
p_title TYPE lvc_title DEFAULT 'New Grid Title'.
*---------------------------------------------------------------------*
* CLASS lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT
if_salv_events_actions_table~double_click
OF cl_salv_events_table
IMPORTING
row
column.
ENDCLASS. "lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX row.
IF ( syst-subrc = 0 ).
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDIF.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
* Create ALV grid instance
TRY.
CALL METHOD cl_salv_table=>factory
* EXPORTING
* LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
* R_CONTAINER =
* CONTAINER_NAME =
IMPORTING
r_salv_table = go_table
CHANGING
t_table = gt_knb1.
CATCH cx_salv_msg .
ENDTRY.
* Create event instance
go_events = go_table->get_event( ).
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_events.
PERFORM adjust_column.
PERFORM adjust_display.
go_table->display( ).
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form ADJUST_COLUMN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM adjust_column .
CHECK ( p_outlen > 0 ). " In this case use default output length
* Get columns instance
go_columns = go_table->get_columns( ).
* Get single column instance
TRY.
go_column = go_columns->get_column( 'LOEVM' ). " delete flag
go_column->set_output_length( p_outlen ).
CATCH cx_root.
ENDTRY.
ENDFORM. " ADJUST_COLUMN
*&---------------------------------------------------------------------*
*& Form ADJUST_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM adjust_display .
go_display = go_table->get_display_settings( ).
go_display->set_striped_pattern( abap_true ).
go_display->set_list_header( p_title ).
ENDFORM. " ADJUST_DISPLAYRegards
Uwe
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |