2007 Aug 01 5:05 PM
hi experts, in my ALV report, layout selected from select-options(F4) is not displaying, after the initial list dispaly if i select from the layouts then it is comming, pls help me,
i did all the required things like i_save = 'X' ,is_variant = alv_variant, in FM reuse_alv_grid_display,
i also use the FM in this order
1)INITIALIZATION -> REUSE_ALV_VARIANT_DEFAULT_GET
2)AT SELECTION-SCREEN ON VALUE-REQUEST FOR -
>REUSE_ALV_VARIANT_F4
3)AT SELECTION-SCREEN---->REUSE_ALV_VARIANT_DEFAULT_GET
4)start-of-selection.
perform f001-data_retrieval.
perform f002-build_fieldcatalog.
perform f003-build_layout.
perform f004-display_alv_report.
thanks & regards
2007 Aug 02 5:26 AM
Hello Anilkumar
Have a look at the following SAP documentation:
<a href="http://help.sap.com/saphelp_47x200/helpdata/en/0a/b5533cd30911d2b467006094192fe3/content.htm">ALV Grid - method SET_TABLE_FOR_FIRST_DISPLAY</a>
and search for <b>I_DEFAULT</b>. There you will find the following remarks:
This parameter determines if the user is allowed to define default layouts:
* 'X': Default layouts allowed (default setting)
* SPACE: Default layouts not allowed
If default layouts are allowed and if such a layout exists and no other layout is specified
in IS_VARIANT , the default layout is automatically loaded when this method is called.Please note that you will find the same parameter in function module REUSE_ALV_GRID_DISPLAY (or preferrably REUSE_ALV_GRID_DISPLAY_LVC).
Regards
Uwe
Hello Anilkumar
Have a look at the following SAP documentation:
<a href="http://help.sap.com/saphelp_47x200/helpdata/en/0a/b5533cd30911d2b467006094192fe3/content.htm">ALV Grid - method SET_TABLE_FOR_FIRST_DISPLAY</a>
and search for <b>I_DEFAULT</b>. There you will find the following remarks:
This parameter determines if the user is allowed to define default layouts:
* 'X': Default layouts allowed (default setting)
* SPACE: Default layouts not allowed
If default layouts are allowed and if such a layout exists and no other layout is specified
in IS_VARIANT , the default layout is automatically loaded when this method is called.Please note that you will find the same parameter in function module REUSE_ALV_GRID_DISPLAY (or preferrably REUSE_ALV_GRID_DISPLAY_LVC).
Regards
Uwe
2007 Aug 02 5:26 AM
Hello Anilkumar
Have a look at the following SAP documentation:
<a href="http://help.sap.com/saphelp_47x200/helpdata/en/0a/b5533cd30911d2b467006094192fe3/content.htm">ALV Grid - method SET_TABLE_FOR_FIRST_DISPLAY</a>
and search for <b>I_DEFAULT</b>. There you will find the following remarks:
This parameter determines if the user is allowed to define default layouts:
* 'X': Default layouts allowed (default setting)
* SPACE: Default layouts not allowed
If default layouts are allowed and if such a layout exists and no other layout is specified
in IS_VARIANT , the default layout is automatically loaded when this method is called.Please note that you will find the same parameter in function module REUSE_ALV_GRID_DISPLAY (or preferrably REUSE_ALV_GRID_DISPLAY_LVC).
Regards
Uwe
2007 Aug 02 5:30 AM
REPORT z_demo_alv_event_exit_1.
>********************************************************************
This report reads and displays data from table TRDIR, *
using the FM : REUSE_ALV_LIST_DISPLAY *
The columns are displayed in the same order than the Sort Order *
There is an underline if the sort is by UNAM or UDAT *
----
Author : Michel PIOUD *
Email : [email protected] HomePage : http://www.geocities.com/mpioud *
***********************************************************************
SELECTION-SCREEN :
BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(3) TYPE n DEFAULT '99' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
TYPE-POOLS slis. " ALV Global Types
----
TYPES:
BEGIN OF ty_trdir,
name TYPE trdir-name, " ABAP program name
cnam TYPE trdir-cnam, " Created by
cdat TYPE trdir-cdat, " Created on
unam TYPE trdir-unam, " Last changed by
udat TYPE trdir-udat, " Last changed on
END OF ty_trdir.
----
DATA:
gt_trdir TYPE TABLE OF ty_trdir. " Data displayed
----
INITIALIZATION.
v_1 = 'Maximum of records to read'.
----
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
----
Form f_read_data
----
FORM f_read_data.
SELECT name cnam cdat unam udat
INTO TABLE gt_trdir
UP TO p_max ROWS
FROM trdir
WHERE name LIKE 'Z%'.
ENDFORM. " F_READ_DATA
----
Form f_display_data
----
FORM f_display_data.
Macro definition
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'TRDIR'.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_event_exit.
clear ls_event_exit.
ls_event_exit-ucomm = &1.
ls_event_exit-after = 'X'.
append ls_event_exit to lt_event_exit.
END-OF-DEFINITION.
DATA :
ls_layout TYPE slis_layout_alv,
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
Build Field Catalog
m_fieldcat 'NAME'.
m_fieldcat 'CNAM'.
m_fieldcat 'CDAT'.
m_fieldcat 'UNAM'.
m_fieldcat 'UDAT'.
Build Event Exit Table
m_event_exit '&OUP'. " Sort up
m_event_exit '&ODN'. " Sort Down
ls_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_event_exit = lt_event_exit
TABLES
t_outtab = gt_trdir.
ENDFORM. " F_DISPLAY_DATA
----
FORM USER_COMMAND *
----
FORM user_command USING u_ucomm TYPE syucomm
us_selfield TYPE slis_selfield. "#EC CALLED
CASE u_ucomm.
WHEN '&OUP' OR '&ODN'. " Sort
PERFORM f_modif_fieldcat.
us_selfield-refresh = 'X'.
ENDCASE.
ENDFORM. " USER_COMMAND
----
Form F_MODIF_FIELDCAT
----
FORM f_modif_fieldcat.
DATA:
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv.
FIELD-SYMBOLS :
<sort> TYPE slis_sortinfo_alv,
<fieldcat> TYPE slis_fieldcat_alv.
Read current ALV list information
CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
IMPORTING
et_fieldcat = lt_fieldcat
et_sort = lt_sort
EXCEPTIONS
no_infos = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
EXIT.
ENDIF.
CHECK NOT lt_sort[] IS INITIAL.
Fieldcat modification
DESCRIBE TABLE lt_fieldcat.
LOOP AT lt_fieldcat ASSIGNING <fieldcat>.
<fieldcat>-col_pos = <fieldcat>-col_pos + sy-tfill.
ENDLOOP.
LOOP AT lt_fieldcat ASSIGNING <fieldcat>.
READ TABLE lt_sort ASSIGNING <sort>
WITH KEY fieldname = <fieldcat>-fieldname.
CHECK sy-subrc EQ 0.
<fieldcat>-col_pos = <sort>-spos.
ENDLOOP.
SORT lt_fieldcat BY col_pos.
LOOP AT lt_fieldcat ASSIGNING <fieldcat>.
<fieldcat>-col_pos = sy-tabix.
ENDLOOP.
Underline if the sort is by UNAM or UDAT
READ TABLE lt_sort ASSIGNING <sort> INDEX 1.
IF <sort>-fieldname = 'UNAM' OR
<sort>-fieldname = 'UDAT'.
<sort>-group = 'UL'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_SET'
EXPORTING
it_sort = lt_sort
it_fieldcat = lt_fieldcat.
ENDFORM. " F_MODIF_FIELDCAT
END OF PROGRAM Z_DEMO_ALV_EVENT_EXIT_1 ***********************
2007 Aug 24 6:32 AM
thanks floks, i had spotted the problem with my layout selection, "iam sending a SORTINFO internal table to ALV FM that is the reason it is not taking the layout i selected from the selection screen." (if there is any other reasons please let me know).
thanks & regards
Anil
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |