10-19-2007 5:44 PM
Hi all
I am using <b>factory methods for my alv grid display.</b>
I have a list of functionalities, for which i am not able to find a correct method..
1) Header of alv(with all the values of the selection-screen) along with labels
2)How to give text to a subtotal(ed) column, i.e. if i subtotal a qty field against a sorted field, i want to display ==> Nett Wt. = 123.00 (for first header entry) and so on for each header entry.
3)how to remove the zeroes from a quantity field?
4) Displaying the cells as blanks where data is 0( for quantity fields if i have a cell with zero value, it should be blank.)
5) double click on a cell to open a transaction with the cell's value.
6) how to have multiple subtotal columns, without disturbing the sort order of grid display
Any help on this would be appreciated.
Points will be rewarded for sure...
Thanks & Regards
Ravish Garg
10-21-2007 1:42 AM
hello ravish,
have you ever had a look on the reuse library? there is some alv reuse stuff. e.g. if you use the function modules you automatically get a header area above the alv grid. the you just have to write a small form routine to write the selection values there.
with changing the zeros to blanks i am not fully sure. have you checked if they disappear automatically if the field datatype domain has the convert exit alpha included?
Rgds.
Roman
10-21-2007 9:36 PM
Hello Ravish
Regarding the handling of the <u>double-click</u> event have a look at sample report <b>ZUS_SDN_CL_SALV_TABLE_INTERACT</b>.
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_CL_SALV_TABLE_INTERACT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zus_sdn_cl_salv_table_interact.
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.
*---------------------------------------------------------------------*
* 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:
lo_table TYPE REF TO cl_salv_table,
lt_orders TYPE STANDARD TABLE OF bapiorders,
ls_knb1 TYPE knb1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX row.
IF ( syst-subrc = 0 ).
CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
EXPORTING
customer_number = ls_knb1-kunnr
sales_organization = '1000'
* MATERIAL =
* DOCUMENT_DATE =
* DOCUMENT_DATE_TO =
* PURCHASE_ORDER =
* TRANSACTION_GROUP = 0
* PURCHASE_ORDER_NUMBER =
* IMPORTING
* RETURN =
TABLES
sales_orders = lt_orders.
* 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 = lo_table
CHANGING
t_table = lt_orders.
CATCH cx_salv_msg .
ENDTRY.
lo_table->display( ).
** 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.
go_table->display( ).
END-OF-SELECTION.
Regards
Uwe