2009 Mar 13 7:20 AM
Hi ,
I have some issue with using alv grid disply.i have created alv report for delivery material as per date priority. My alv report shows all material related fields with delivery date .delivery date is editable .
User will change the date as per requirement .user want to sort the output as per date with out
selecting sort options when click the save button.
otherwise how can u below events .
list_modify
after_line_output
before_line_output.
can u help for this ?
regards.
raja
2009 Mar 13 7:29 AM
Hi,
When SAVE Button is Clicked.Sort the the Internal table in Dynamic Subroutine.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
When 'SAVE'.
Sort ITAB.
ENDCASE.
ENDFORM.Or
If it is a Class-->
When The Save button is clicked.
In the Method
1) Sort the table
2) Refresh the Grid -
>(REFRESH_TABLE_DISPLAY)
3) Display the grid ---> (SET_TABLE_FOR_FIRST_DISPLAY)
Regards,
Gurpreet
Hi ,
I have some issue with using alv grid disply.i have created alv report for delivery material as per date priority. My alv report shows all material related fields with delivery date .delivery date is editable .
User will change the date as per requirement .user want to sort the output as per date with out
selecting sort options when click the save button.
otherwise how can u below events .
list_modify
after_line_output
before_line_output.
can u help for this ?
regards.
raja
2009 Mar 13 7:29 AM
Hi,
When SAVE Button is Clicked.Sort the the Internal table in Dynamic Subroutine.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
When 'SAVE'.
Sort ITAB.
ENDCASE.
ENDFORM.Or
If it is a Class-->
When The Save button is clicked.
In the Method
1) Sort the table
2) Refresh the Grid -
>(REFRESH_TABLE_DISPLAY)
3) Display the grid ---> (SET_TABLE_FOR_FIRST_DISPLAY)
Regards,
Gurpreet
2009 Mar 13 7:32 AM
Hi,
Refer this program:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal table
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.
*&---------------------------------------------------------------------*
*& Form pf
*&---------------------------------------------------------------------*
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
* -->RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZPF_STAT'.
ENDFORM. "pf
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is SAVE then process the selected records
WHEN 'SAVE'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
"now at this time you have modified internal table
SORT it_final BY <date>. "sort by date ascending after modifying
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
"alv output is refreshed as per changes in internal table
ENDCASE.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun
2009 Mar 13 8:46 AM
Hi guys ,
thanks a lot.
one more doubt .i have passed peramerters for shorting(default) .
after this i want to generate the serial no for output record so i have to modify the table value before output after sorting ?.
i dont want to short paricular colomn and no color for particular coloumn
is it possible ..
thanks,
viji
Edited by: Rajviji on Mar 13, 2009 9:47 AM
2009 Mar 13 9:34 AM
Hi,
No, you cant add a new field in alv display when you click DELETE button using classical alv (using FM REUSE_ALV_GRID_DISPLAY) i.e., add a new field dynamically into ALV grid.
But this can be done using Object Oriented Approach in ALV.
Hope this helps you.
Regards,
Tarun
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |