Layout in ALV  problem

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

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 ***********************

Similar Messages

  • How to Keep Default Layout of ALV

    I changed layout of ALV, then pressed button "Enter" but not "Save". But when I entered the screen again, the layout was changed to the setting which I changed last time, not default setting.
    Source code is shown below.
         DATA lt_acc_bal_fcat TYPE lvc_t_fcat.
         DATA lt_trans_dtl_fcat TYPE lvc_t_fcat.
         CLEAR gt_copc_bal.
         APPEND LINES OF it_copc_bal TO gt_copc_bal.
         CLEAR gt_trans_detail.
         APPEND LINES OF it_trans_detail TO gt_trans_detail.
         _adjust_data_for_display( ).
         IF gv_grid_inited NE abap_true.
           CLEAR gs_grid_variant.
           CLEAR gs_grid_variant_detail.
           CLEAR gt_trans_dtl_fcat.
           gs_grid_layout-no_rowmark  = abap_true.
    "      gs_grid_layout-sel_mode    = 'A'.
           gs_grid_layout-stylefname  = 'FLD_STYL'.
           gs_grid_variant-report     = sy-repid.
           gs_grid_variant-username   = sy-uname.
           gs_grid_variant-log_group  = '001'.
           "load account balance data to ALV
           CREATE OBJECT go_acc_bal_container
             EXPORTING
               container_name = 'ACC_BAL_CONTAIN'.
           CREATE OBJECT go_acc_bal_grid
             EXPORTING
               i_appl_events = abap_true
               i_parent      = go_acc_bal_container.
           CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
             EXPORTING
               i_structure_name = 'EPIC_S_COPC_BAL'
             CHANGING
               ct_fieldcat      = lt_acc_bal_fcat.
           DATA lt_acc_bal_fcat_a TYPE lvc_t_fcat.
           _adjust_bal_alv_dsp(
             EXPORTING
               it_fcat = lt_acc_bal_fcat    " Field Catalog for List Viewer Control
             IMPORTING
               et_fcat = lt_acc_bal_fcat_a   " Field Catalog for List Viewer Control
           go_acc_bal_grid->set_table_for_first_display(
             EXPORTING
                 is_layout            = gs_grid_layout
                 is_variant           = gs_grid_variant
                 i_save               = 'A'
               CHANGING
                 it_outtab            = gt_copc_bal
                 it_fieldcatalog      = lt_acc_bal_fcat_a
           "load trasaction detail data to ALV
           CREATE OBJECT go_acc_trans_dtl_container
             EXPORTING
               container_name = 'TRANS_DTL_CONTAIN'.
           CREATE OBJECT go_acc_trans_dtl_grid
             EXPORTING
               i_appl_events = abap_true
               i_parent      = go_acc_trans_dtl_container.
           CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
             EXPORTING
               i_structure_name = 'COPC_S_TRANS_DETAIL'
             CHANGING
               ct_fieldcat      = lt_trans_dtl_fcat.
           DATA lt_trans_dtl_fcat_a TYPE lvc_t_fcat.
           _adjust_detail_alv_dsp(
             EXPORTING
               it_fcat = lt_trans_dtl_fcat    " Field Catalog for List Viewer Control
             IMPORTING
               et_fcat = gt_trans_dtl_fcat   " Field Catalog for List Viewer Control
           gs_grid_variant_detail = gs_grid_variant.
           gs_grid_variant_detail-log_group = '002'.
           go_acc_trans_dtl_grid->set_table_for_first_display(
             EXPORTING
                 is_layout            = gs_grid_layout
                 is_variant           = gs_grid_variant_detail
                 i_save               = 'A'
               CHANGING
                 it_outtab            = gt_trans_detail
                 it_fieldcatalog      = gt_trans_dtl_fcat
           gv_grid_inited = abap_true.
         ENDIF.
         go_acc_bal_grid->refresh_table_display( ).
         go_acc_trans_dtl_grid->refresh_table_display( ).
    I want to keep layout of ALV default setting when I enters screen each time. Please help me solve this problem.

    Hi,
    are you refreshing ALV when pressing enter? maybe you should not refresh when pressing enter, or provide the right variant when refreshing.
    regards
    Stefan Seeburger

  • Sving layout with ALV block list

    1) I am not able to save layout for alv block. How this can be done?
    2) Can this be saved for all blocks if the fields of all blocks are the same?

    Hi,
    1. not possible with the ALV BLOCK list.
    2. No option avaialble for this in case of Block list.
    for normal list you have variant option.
    Regards
    vijay

  • Layout in ALV reports

    Hi everyone, I have created an ALV report, and now I've been ask to upgrade this report putting a parameter in the selection screen where the user can select a layout, and then execute the report so when the data is display appear as the layout already chosen by the user.
    Can anyone tell me how to add this functionality to my alv report.
    Thanks in advanced,
    Fidel

    HI Fidel,
    Here is example program for List and Grid
    whichever u choose that report format will be displayed
    check this once.
    *& Report  ZLAXMI_ALVEXER2                                             *
    *& NAME : VENKATA LAXMI                                                *
    *& DATE : 24-02-2006                                                   *
    *&      PROGRAM TO PRINT THE REPORT IN ALV LIST FORMAT AND GRID FORMAT *
    *&      WITH TRAFFIC LIGHTS                                            *
    REPORT  ZLAXMI_ALVEXER2  MESSAGE-ID ZZ                       .
    *& TABLES DECLARATION                                                  *
    TABLES: VBAK.
    *& TYPE POOLS DECLARATION                                              *
    TYPE-POOLS: SLIS.
    *& INTERNAL TABLE DECLARATION                                          *
    DATA: BEGIN OF ITAB OCCURS 0,
           ICON TYPE ICON-ID,
           VBELN LIKE VBAK-VBELN,
           AUDAT LIKE VBAK-AUDAT,
           VBTYP LIKE VBAK-VBTYP,
           AUART LIKE VBAK-AUART,
           AUGRU LIKE VBAK-AUGRU,
           NETWR LIKE VBAK-NETWR,
           WAERK LIKE VBAK-WAERK,
        END OF ITAB.
    *INTERNAL TABLE FOR FIELD CATALOG
    DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
        IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
               WITH HEADER LINE,
    *INTERNAL TABLE FOR EVENTS
    DATA:    IT_EVENT TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT,
    *INTERNAL TABLE FOR SORTING
          IT_SORT TYPE SLIS_T_SORTINFO_ALV,
          WA_SORT TYPE SLIS_SORTINFO_ALV,
    *INTERNAL TABLE FOR LAYOUT
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    *& VARIABLE DECLARATION                                                *
    DATA : V_REPID TYPE SY-REPID,
           V_PAGNO(4) TYPE N,
           V_DATE(8)  TYPE C.
    *& CONSTANTS                                                           *
    CONSTANTS: C_X TYPE C VALUE 'X'.
    *& SELECTION SCREEN                                                    *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,
                    S_VBTYP FOR VBAK-VBTYP DEFAULT 'C'.
    SELECTION-SCREEN: END OF BLOCK B1.
    SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    *SELECTION-SCREEN : BEGIN OF LINE.
    *SELECTION-SCREEN  COMMENT 1(20) TEXT-003.
    PARAMETERS: P_LIST RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
    *SELECTION-SCREEN : END OF LINE.
    *SELECTION-SCREEN : BEGIN OF LINE.
    *SELECTION-SCREEN COMMENT 1(20) TEXT-004.
    PARAMETERS: P_GRID RADIOBUTTON GROUP RAD1.
    *SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN: END OF BLOCK B2.
    AT SELECTION-SCREEN.
      PERFORM VALIDATE_SCREEN.
    *& START OF SELECTION                                               *
    START-OF-SELECTION.
      CLEAR: ITAB, ITAB[].
    V_REPID = SY-REPID.
      PERFORM GET_DATA.
      PERFORM DISPLAY_DATA.
    *& END OF SELECTION                                                    *
    END-OF-SELECTION.
    *--DO ALV Process
      V_REPID = SY-REPID.
    *--Sort the Output Fields
      PERFORM SORT_FIELDS.
    *--Build Field catalog for the Output fields
    PERFORM BUILD_FIELDCAT.
    *--Set the Layout for ALV
      PERFORM SET_LAYOUT.
    *&      Form  GET_DATA
          text
    TO GET THE DATA FROM TABLES INTO ITAB
    FORM GET_DATA .
      SELECT VBELN
             AUDAT
             VBTYP
             AUART
             AUGRU
             NETWR
             WAERK
             INTO CORRESPONDING FIELDS OF TABLE ITAB
             FROM VBAK
             WHERE VBELN IN S_VBELN AND
             AUDAT > '04.04.2005'
             AND NETWR > 0.
      LOOP AT ITAB.
        IF ITAB-NETWR < 10000.
          ITAB-ICON = '@08@'.
        ELSEIF ITAB-NETWR > 10000 AND ITAB-NETWR < 100000.
          ITAB-ICON = '@09@'.
        ELSEIF ITAB-NETWR > 100000.
          ITAB-ICON = '@0A@'.
        ENDIF.
        MODIFY ITAB INDEX SY-TABIX.
      ENDLOOP.
    ENDFORM.                    " GET_DATA
    *&      Form  sort_fields
    FORM SORT_FIELDS .
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'VBTYP'.
      WA_SORT-SPOS = '1'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'NETWR'.
      WA_SORT-SPOS = '2'.
      WA_SORT-UP = 'X'.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
    ENDFORM.                    " sort_fields
    *&      Form  build_fieldcat
    *FORM BUILD_FIELDCAT .
    IT_FIELDCAT-COL_POS    = '1'.
    IT_FIELDCAT-FIELDNAME  = 'ICON'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '10'.
    IT_FIELDCAT-SELTEXT_L  = 'LIGHT'.
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '2'.
    IT_FIELDCAT-FIELDNAME  = 'VBELN'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '10'.
    IT_FIELDCAT-SELTEXT_L  = 'SALES DOC NUMBER'(009).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '3'.
    IT_FIELDCAT-FIELDNAME  = 'AUDAT'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '4'.
    IT_FIELDCAT-SELTEXT_L  = 'DOCUMENT DATE'(010).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '4'.
    IT_FIELDCAT-FIELDNAME  = 'VBTYP'.
    IT_FIELDCAT-KEY        = 'X'.
    IT_FIELDCAT-OUTPUTLEN  = '4'.
    IT_FIELDCAT-SELTEXT_L  = 'CATEGORY'(011).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '5'.
    IT_FIELDCAT-FIELDNAME  = 'AUART'.
    IT_FIELDCAT-OUTPUTLEN  = '4'.
    IT_FIELDCAT-SELTEXT_L  = 'DOCUMENT TYPE'(012).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '6'.
    IT_FIELDCAT-FIELDNAME  = 'AUGRU'.
    IT_FIELDCAT-OUTPUTLEN  = '12'.
    IT_FIELDCAT-SELTEXT_L  = 'Order reason'(013).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '7'.
    IT_FIELDCAT-FIELDNAME  = 'NETWR'.
    IT_FIELDCAT-OUTPUTLEN  = '12'.
    IT_FIELDCAT-SELTEXT_L  = 'NET VALUE'(014).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    IT_FIELDCAT-COL_POS    = '8'.
    IT_FIELDCAT-FIELDNAME  = 'WAERK'.
    IT_FIELDCAT-OUTPUTLEN  = '12'.
    IT_FIELDCAT-SELTEXT_L  = 'SD DOC CURR'(015).
    APPEND IT_FIELDCAT.
    CLEAR  IT_FIELDCAT.
    *ENDFORM.                    " build_fieldcat
    *&      Form  set_layout
    FORM SET_LAYOUT .
      IF P_LIST = C_X .
        WA_LAYOUT-WINDOW_TITLEBAR = 'LIST DISPLAY'(016).
        WA_LAYOUT-ZEBRA = 'X'.
    *-- ALV LIST DISPLAY
        PERFORM LIST_DISPLAY TABLES ITAB.
    *-- ALV GRID DISPLAY
      ELSEIF P_GRID = C_X.
        WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'(017).
        WA_LAYOUT-ZEBRA = 'X'.
        PERFORM GRID_DISPLAY TABLES ITAB.
      ENDIF.
    ENDFORM.                    " set_layout
    *&      Form  list_display
    FORM LIST_DISPLAY  TABLES   P_ITAB .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = V_REPID
          IS_LAYOUT          = WA_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT[]
          IT_SORT            = IT_SORT[]
          I_SAVE             = 'U'
        TABLES
          T_OUTTAB           = ITAB
        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.
    ENDFORM.                    " list_display
    *&      Form  GRID_DISPLAY
    FORM GRID_DISPLAY  TABLES   P_ITAB .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = V_REPID
          IS_LAYOUT          = WA_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT[]
          IT_SORT            = IT_SORT[]
          IT_EVENTS          = IT_EVENT
        TABLES
          T_OUTTAB           = ITAB
        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.
    ENDFORM.                    " GRID_DISPLAY
    *&      Form  VALIDATE_SCREEN
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE_SCREEN .
      DATA: LV_VBELN LIKE VBAK-VBELN.
      IF NOT S_VBELN IS INITIAL.
        SELECT VBELN
        INTO LV_VBELN
        UP TO 1 ROWS
        FROM VBAK
        WHERE VBELN IN S_VBELN.
        ENDSELECT.
        IF SY-SUBRC <> 0.
          MESSAGE E000 WITH 'INVALID SALES DOC'.
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_SCREEN
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DATA .
      DEFINE M_FIELDCAT.
        ADD 1 TO WA_FIELDCAT-COL_POS.
        WA_FIELDCAT-FIELDNAME   = &1.
        WA_FIELDCAT-REF_TABNAME = 'VBAK'.
        WA_FIELDCAT-DO_SUM      = &2.
        WA_FIELDCAT-CFIELDNAME  = &3.
        APPEND WA_FIELDCAT TO IT_FIELDCAT.
      END-OF-DEFINITION.
    DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv.
      m_fieldcat 'ICON' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'AUDAT' ''  ''.
      m_fieldcat 'VBTYP' ''  ''.
      m_fieldcat 'AUART' ''  ''.
      m_fieldcat 'AUGRU' ''  ''.
      m_fieldcat 'NETWR' 'C' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
    ENDFORM.                    " display_data
    Regards,
    Laxmi

  • Save Layout in ALV Grid

    Hi,
    I have to save layout in ALV grid which should persist every time when i start the transaction.I am able to get save, change and manage option in the grid and also able to set the default layout but this default layout doesnot work.
    please see the code :
      l_repvar  = sy-repid.
      ls_variant = l_repvar.
      l_varient = 'A'.
      ls_variant-variant = l_varient.
      draft_layout-sel_mode = 'D'.
      draft_layout-stylefname = 'CELLPROP'.
      draft_layout-no_f4 = 'X'.
    DISPLAY THE DATA ON THE GRID
      CALL METHOD draft_grid->set_table_for_first_display
        EXPORTING
          i_structure_name     = 'PSHLP_DRAFT_ST'
          is_layout            = draft_layout
          it_toolbar_excluding = g_it_exclude
          is_variant           = ls_variant
          i_save               = 'A'
          i_default            = 'X'
        CHANGING
          it_fieldcatalog      = draft_fieldcat
          it_outtab            = l_draft[].
    i have tried by chaging i_save to 'X' and 'U' but no difference.
    Useful answers will be rewarded.
    Thanks and Regards,
    Harsh

    hi,
    try with this code,
    DATA: wa_disvariant LIKE disvariant.
        wa_disvariant-report = g_repid.
        wa_disvariant-username = sy-uname.
    and pass these values in your function module,
             i_save                      = 'X'
             is_variant                  = wa_disvariant
    thanks and regards,
    muralidhar.

  • Problem in saving layout in ALV's

    Hi all!
         I am getting a strange problem in ALV's .For an ALV report some users are able to save the layouts where as some are not able to save .Why is it happening so? I have mentioned IS_SAVE = 'X' in my func.module REUSE_ALV_GRID_DISPLAY.Please help.

    Hi,
    You Have to call the Fm Reuse_alv_variant_f4
    SELECTION-SCREEN : BEGIN OF BLOCK blk3 WITH FRAME TITLE text-003.
    PARAMETER:p_var TYPE disvariant-variant MODIF ID p2.                    "Variant Part
    SELECTION-SCREEN:END OF BLOCK blk3.
    Data: wa_variant   TYPE   disvariant,
             wa_variant1  TYPE   disvariant.
    CONSTANTS:c_x(1)             TYPE c VALUE'X',
                        lc_a(1)            TYPE c VALUE 'A',
    FORM alv_variant .
      wa_variant-username = sy-uname.
      wa_variant-report = sy-repid.
    *For variant Part
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = wa_variant
          i_save        = lc_a
        IMPORTING
          es_variant    = wa_variant1
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc <> 0.
        p_var = wa_variant-variant.
      ELSE.
        p_var = wa_variant1-variant.
      ENDIF.
    ENDFORM.                       " alv_variant
    After That
    *display variant
      wa_variant-report = sy-repid.
      IF NOT p_var IS INITIAL.
        wa_variant-variant = p_var.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout                = lwa_layout
          it_fieldcat              = gi_fieldcat
          is_variant               = wa_variant
          i_default                = c_x
          i_save                   = lc_a
        TABLES
          t_outtab                 = gi_final
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    Regards
    Sandipan

  • Problem in changing layout of ALV to excel

    Hello everyone,
    I have developed an ALV program, wherein I need to show the graphs for the same.
    For this, I need my data in excel format, so that I can write some macros ,and do the further processing on it(I am using an appraoch I found on SDN, "Report with graph").
    I got to know, that I need <b>SAP R/3: Add On:Interactive Excel</b>.
    I asked the BASIS guys to install it, but even after installing it, I am unable to view the data in Excel layout, when I do Change LAyout->View->Microsoft Excel.
    Could anyone let me know if there is any other setting which is required to view the data in excel?On the excel side, we can change the security level(Tools->Macro->Security) to either low, medium or high.
    Is there any such provision in SAP?
    Kindly suggest your answers, as it is important for me to get the data in excel.
    Points will be rewarded.
    Thanks and regards,
    Prerna

    Hi,
    I have already tried what you have just mentioned.
    I searched the entire SDN, for this, and this was one of the replies   
    But still we don't get the data(Even you didn't get it, right?).
    when we change the layout to excel(Excel Inplace), there are 2 sheets by default:-
    Rawheader and Rawdata.The data comes in RAwheader sheet.
    But there is some setting on the BASIS side, which need to be done, in order for it to work.
    I have asked my BASIS colleagues and some of my senior consultants to look into the same.
    They will let me know.
    I would also suggest you try your program on another PC.
    I will let you know as soon as I get any replies from my colleagues.
    Thanks and regards,
    Prerna

  • Changing layout of ALV to excel and displaying the data there

    Dear All,
    My requirement is that I have to develop an ALV report, and also plot the graphs for the same.
    I need different types of graphs, so I have searched on SDN, and I found out a blg:-
    "Report with a Graph.. An Approach!"
    Here is what the person has done:-
    I developed a simple ABAP report using ALV and just dumped all my data on it.
    After this I downloaded the Standard Excel template available in the ALV.
    Defined my own worksheets in this template, wrote some macros to pick up the data from the “RawHeader” sheet, which is available by default and will contain the ALV data.
    I inserted 1 chart in this Excel template. In this chart I used the same chart type as was being used by the user for his graph. Just right clicked on the Graph area and made the changes in the source data and made it point to the sheet containing the final data.
    That’s it my job is almost done.
    After this uploaded this template back into the report output through
    the layout settings->Change Layout Tab.
    Save it as a variant and made it a default. (Do not default it if you have more than 1 user and more than 1 template…. Select the appropriate variant for the appropriate user and then display)
    Well, this also was not that easy as I had thought. I landed up into 1 trouble.
    In my report the number of columns displayed was not constant and kept changing based on the input. This fact was taken care by designing a variable field catalogue. But now I had gone past the simple ALV display and was giving the output in an Excel sheet using a pre-defined template. Well, I immediately found a solution to this with the set_frontend_fieldcatalogue method of CL_GUI_ALV_GRID class and fixed the field catalogue every time after calling the set_table_for_first_display method. This solved most of my problems, which were not many though.
    Now here are my issues:-
    I have developed the ALV report, and I have also changed the layout to excel.
    But, I am unable to get the ALV Report data in the RawHeader Sheet, which is available by default.
    Could anyone please guide me through this method??
    It is urgent.
    Points are assured for helpful answers.
    Thanks and regards,
    Prerna

    Hi Satya Priya,
    Do I have to create my own template, or the Standard ones available will do?
    HEre is what I do:-
    Once I get my ALV output, I goto Change LAyout->View tab.->Prefered view->Microsoft Excel.
    Here I get a list of available excel templates There are 2:-
    sap_mm.xls, and sap_om.xls
    I select one of these, and the excel spreadsheet is displayed on the ALV screen.
    But the re is another button, "Upload Document to BDS".
    Do I have to upload one of the above templated to BDS?
    And please tell me in detail, what is BDS???
    Thanks for your help, and waiting for reply,
    Prerna

  • ALV problems, trying to click Back button, Filtering, download (Excel)

    Hi
    When I try to click Back button, Filtering or download (Excel) on ALV grid this dumps appear:
    Runtime Error          MOVE_TO_LIT_NOTALLOWED_NODATA
    Error analysis
        The program tried to assign a new value to the field "<L_BOX>" even though
        it is protected against changes.
        The following objects are protected:
        - Character or numeric literals
        - Constants (CONSTANTS)
        - Parameters of the category IMPORTING REFERENCE for functions
          and methods
        - Untyped field symbols to which a field has not yet been assigned
          using ASSIGN
        - TABLES parameters if the corresponding actual parameter is protected
          against changes
        - USING reference parameters and CHANGING parameters for FORMs if
          the actual parameter for this is protected against changes
        - Field symbols if the field assigned using ASSIGN or ASSIGNING
          is protected against changes
        - External write accesses to READ-ONLY attributes
        - Key components of lines in internal tables of the type HASHED or
          SORTED TABLE
          SORTED TABLE.
    Line  SourceCde
    681 * set/unset <box> of all items
    682     if l_ucomm eq '&SAL' or l_ucomm eq '&ALL'.
    683       if l_ucomm eq '&SAL'.
    684         loop at t_outtab.
    685           l_tabix = l_tabix + 1.
    ->>>           <l_box> = ' '.
    687           modify t_outtab index l_tabix.
    688         endloop.
    689       endif.
    690       if l_ucomm eq '&ALL'.
    691         loop at t_outtab.
    692           l_tabix = l_tabix + 1.
    693           <l_box> = 'X'.
    694           modify t_outtab index l_tabix.
    695         endloop.
    696       endif.
    What I must check on my ALV settings:
    ch_alv_layout-zebra          = 'X'.
      ch_alv_layout-box_fieldname  = 'SELE'.
      ch_alv_layout-box_tabname    = v_nametab.
      ch_alv_layout-reprep         = 'X'.
      ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
      ch_alv_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = sy-repid
          is_layout          = ch_alv_layout
          it_fieldcat        = ch_alv_fieldcat
          it_sort            = ch_alv_sortinfo
          i_save             = 'X'
          it_events          = ch_slis_event
        TABLES
          t_outtab           = p_control
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    Thanks in advance.

    ch_alv_layout-info_fieldname = 'COLOR'. "infofield for listoutput
      ch_alv_layout-colwidth_optimize = 'X'.
    try commenting the above values.and also check the Fieldcatlog.
    Check the issue similar issue was resolve by checking catalog and layout:
    [ALV Issue solution|Re: Problem when export ALV.]
    Regards,
    Gurpreet

  • Save layout in ALV-GRID OO

    Hi
    i'm using ALV-GRID OO and i have problems with
    saving my own layout.
    In the output-liste i have a button to chage the output, but i'm missig
    a button to save the new layout.
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
       EXPORTING
                 IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
                 IS_LAYOUT                       = GS_LAYOUT
                 I_SAVE                             = 'A'
       CHANGING
                 IT_FIELDCATALOG            = GT_FIELDCAT
                 IT_OUTTAB                       = ITAB.
    Any idea?
    Regards, Dieter

    Make sure that you pass the variant also.
      data: variant type  disvariant.
      variant-report = sy-repid.
      variant-username = sy-uname.
    CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
    IS_LAYOUT = GS_LAYOUT
    is_variant             = variant
    I_SAVE = 'A'
    CHANGING
    IT_FIELDCATALOG = GT_FIELDCAT
    IT_OUTTAB = ITAB.
    Regards,
    Rich Heilman

  • Manipulate Layout on ALV Grid with dynamic table

    Dear all
    i'm generating a dynamic table depending of a date selection. That means that I show columns for weeks and the quantity of weeky migh change.
    Now the users wants to have a specific layout of the ALV grid with totals. When he saves the layout, only the weeks at this selection will show the next time he runs the programm with a larger selection.
    a) Is it possible to modify the layout during runtime by programming?
    b) Do you have any other ideas how to solve this problem?
    Thank you

    You don't know the names of your columns? hmm you do, because before you created dynamic table you had to create field catalog, so the structure and column names of newly (dynamically) created table will be the same like defined in the field catalog.
    The last loop also does not look good, in my opinion should be something like:
    LOOP AT lt_datatable +(my first table)+ ASSIGNING <ls_data4>.
        AT NEW pernr.
          APPEND initial line to <fs_1> assigning <fs_2>.
          <fs_2>-pernr = <ls_data4>-pernr.
        ENDAT.
        ASSIGN COMPONENT <ls_data4>-wage_type OF STRUCTURE <fs_2> TO <fs_5>.
        <fs_5> = <ls_data4>-amount.
    ENDLOOP.
    also keep in mind that number of calls of method cl_alv_table_create=>create_dynamic_table is limited to 36 (?) calls within one program session because it uses dynamic subroutine pool behind so you will have short dump if you will execute that 37 times.

  • Create Change Layout in ALV list report

    Hi,
    i have create my own change layout button at my alv list report, my problem is i don't know what coding can be used to activate the change layout function in my own button. Who have sample programming for this function please share it....
    tq.

    Hi,
    By default if you're using the ALV List Display function module, there's no need for you to code the 'Change Layout' function, the standard function will be there, unless there's something you want and the standard 'Change Layout' function could not provide.
    Go to Abap Editor and look for program with 'BALV*'. You'll get a whole list of DEMO program on ALV.

  • ALV problems

    hey guys
    I am facing a small problem:
    i written a code in to display the output in alv format.
    In that i have two tables in nested format. That is during declaration i have two tables see the sample of field-catalog declaration.
      fieldcat-tabname = 'IITEM'.
      fieldcat-fieldname = 'KUNNR'.
      fieldcat-ref_fieldname ='KUNNR'.
      fieldcat-ref_tabname ='ZVBRKVBRP'.
      fieldcat-col_pos       = '1'.
      fieldcat-seltext_m = 'Billing Doc'.
      fieldcat-seltext_l = 'Billing Doc'.
      fieldcat-seltext_s = 'Billing Doc'.
      APPEND fieldcat TO fieldtab.
      CLEAR fieldcat.
      fieldcat-tabname = 'IVBELN'.
      fieldcat-fieldname = 'POSNR'.
      fieldcat-col_pos       = '2'.
      fieldcat-seltext_m = 'Billing Item'.
      fieldcat-seltext_l = 'Billing Item'.
      fieldcat-seltext_s = 'Billing Item'.
      APPEND fieldcat TO fieldtab.
      CLEAR fieldcat.
    here IITEM is outer internal table and
    IVBELN is inner internal table.
    Although my final output of the program is working fine, but the problem is:
    i cant able to do subtotal (ctlshiftf6) according to inner internal table. is there any problem in settings or it should be hard-coded.
    I am using TYPE-POOLS : SLIS.
    Pls help me.
    Deepak

    Hi Depaak,
    I am going to assume you are using the basic function module REUSE_ALV_LIST_DISPLAY, have you tried to use the function module REUSE_ALV_HIERSEQ_LIST_DISPLAY instead? This FM allows you to define 2 internal tables with a "header" and "item" relationship.
    Here is some code demonstrating how to use this FM. You can sort and do totaling and subtotaling the usual way. Let me know if you get any problems.
    Cheers,
    Pat
    *& Report  ZPAT2                                                       *
    Modification History
    Date      | Author    | Chg Req #     | Description
    15.08.2001| Pat Yee   | $TMP          | Program Creation
    This program is an example of how the ALV Hierarchy Display works.
    It will display a sales order and it's associated line items
    REPORT  zpat2.
    Types
    TYPE-POOLS: kkblo.
    Database Tables
    TABLES: vbak, vbap.
    Structures
    DATA: st_fieldcat TYPE slis_fieldcat_alv.
    DATA: st_keyinfo TYPE slis_keyinfo_alv.
    DATA: st_sort TYPE slis_sortinfo_alv.
    DATA: st_layout TYPE slis_layout_alv.
    Internal tables
    DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: tbl_sort TYPE slis_t_sortinfo_alv.
    DATA: BEGIN OF tbl_header OCCURS 0.
            INCLUDE STRUCTURE vbak.
    DATA: END OF tbl_header.
    DATA: BEGIN OF tbl_item OCCURS 0.
            INCLUDE STRUCTURE vbap.
    DATA: END OF tbl_item.
    Constants
    CONSTANTS: c_y VALUE 'X'. "Yes
    CONSTANTS: c_n VALUE ' '. "No
    Simple Variables
    DATA: field_name(30) TYPE c,
          g_repid        like sy-repid.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK sel_options WITH FRAME TITLE text-tt1.
    SELECT-OPTIONS s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN END OF BLOCK sel_options.
    Start of Selection
    START-OF-SELECTION.
    Get the Report ID
      g_repid = sy-repid.
    Select data from the Sales Document Header Table
      SELECT * FROM vbak INTO TABLE tbl_header
        WHERE vbeln IN s_vbeln.
    Select the relevant Sales Document Item data
      SELECT * FROM vbap INTO TABLE tbl_item
        FOR ALL ENTRIES IN tbl_header
        WHERE vbeln = tbl_header-vbeln.
    End of Selection
    END-OF-SELECTION.
      PERFORM get_keyinfo.
      PERFORM get_layout.
      PERFORM get_sort.
      PERFORM get_fieldcat.
      PERFORM create_report.
    *&      Form  get_fieldcat
          text
    FORM get_fieldcat.
    Here the field catalog is created. To display more fields simply
    'uncomment' the additional lines and add the field name. Also note
    that the field catalog is much more powerful than this. You can
    intensify fields, change the colour, assign reference fields, etc.
    Look at type slis_fieldcat_alv for more options.
    Header
      PERFORM write_fieldcat USING 'VBELN' 'TBL_HEADER' 'VBAK' c_y 1
                                   c_n c_y c_n c_n.
      PERFORM write_fieldcat USING 'ERDAT' 'TBL_HEADER' 'VBAK' c_n 2
                                   c_n c_n c_n c_y.
      PERFORM write_fieldcat USING 'AUDAT' 'TBL_HEADER' 'VBAK' c_n 3
                                   c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'VBTYP' 'TBL_HEADER' 'VBAK' c_n 4
                                   c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'WAERK' 'TBL_HEADER' 'VBAK' c_n 5
                                     c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'VKBUR' 'TBL_HEADER' 'VBAK' c_n 6
                                     c_n c_n c_n c_y.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 7.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 8.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 9.
    perform write_fieldcat using '     ' 'TBL_HEADER' 'VBAK' ' ' 10.
    Item
      PERFORM write_fieldcat USING 'POSNR' 'TBL_ITEM' 'VBAP' c_y 1
                                     c_n c_n c_n c_n.
      PERFORM write_fieldcat USING 'MATNR' 'TBL_ITEM' 'VBAP' c_n 2
                                     'C411' c_n c_n c_n.
      PERFORM write_fieldcat USING 'NETPR' 'TBL_ITEM' 'VBAP' c_n 3
                                     'C300' c_n c_y c_n.
      PERFORM write_fieldcat USING 'PRCTR' 'TBL_ITEM' 'VBAP' c_n 4
                                     c_n c_n c_n 'X'.
      PERFORM write_fieldcat USING 'GSBER' 'TBL_ITEM' 'VBAP' c_n 5
                                     c_n c_n c_n 'X'.
      PERFORM write_fieldcat USING 'WERKS' 'TBL_ITEM' 'VBAP' c_n 6
                                     c_n c_n c_n 'X'.
      PERFORM write_fieldcat USING 'AUFNR' 'TBL_ITEM' 'VBAP' c_n 7
                                     'C611' c_n c_n c_n.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 8.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 9.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 10.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 11.
    perform write_fieldcat using '     ' 'TBL_ITEM' 'VBAP' ' ' 12.
    ENDFORM.                    " get_fieldcat
    *&      Form  write_fieldcat
          text
         -->name   Field name
         -->tab    Table name
         -->st     Structure Name
         -->key    Is this field a Key?
         -->pos    Position Number
         -->emp    Emphasize
         -->hot    Hotspot
         -->sum    Do_sum
         -->hide   No_out
    FORM write_fieldcat USING    name tab st key pos emp hot sum hide.
      st_fieldcat-fieldname = name.
      st_fieldcat-tabname = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key = key.
      st_fieldcat-col_pos = pos.
      st_fieldcat-emphasize = emp.
      st_fieldcat-hotspot = hot.
      st_fieldcat-do_sum = sum.
      st_fieldcat-no_out = hide.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                    " write_fieldcat
    *&      Form  create_report
          Hummmm I wonder what this subroutine does?
    FORM create_report.
    Here we call the Function Module to create the Hierarchical
    Sequential List
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
         i_interface_check              = ' '
         i_callback_program             = g_repid
         i_callback_user_command        = 'PROCESS_USER_COMMANDS'
         is_layout                      = st_layout
         it_fieldcat                    = tbl_fieldcat
         it_sort                        = tbl_sort
         i_default                      = 'X'
         i_save                         = 'A'
         is_variant                     = ' '
          i_tabname_header               = 'TBL_HEADER'
          i_tabname_item                 = 'TBL_ITEM'
          is_keyinfo                     = st_keyinfo
        TABLES
          t_outtab_header                = tbl_header
          t_outtab_item                  = tbl_item
       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.
    ENDFORM.                    " create_report
    *&      Form  get_keyinfo
          text
    FORM get_keyinfo.
    This defines the "link" between the "header" and "item" tables
      st_keyinfo-header01 = 'VBELN'.
    ENDFORM.                    " get_keyinfo
    *&      Form  get_sort
          text
    FORM get_sort.
    Here we sort the report by the Document Number...why not?
      REFRESH tbl_sort.
      CLEAR st_sort.
      st_sort-spos = 1.
      st_sort-fieldname = 'VBELN'.
      st_sort-up = 'X'.
      APPEND st_sort TO tbl_sort.
    ENDFORM.                    " get_sort
          FORM process_user_commands                                    *
          Interactive Reporting commands
    -->  SYST-UCOMM                                                    *
    -->  SELFIELD                                                      *
    FORM process_user_commands USING syst-ucomm LIKE syst-ucomm
                                     selfield TYPE slis_selfield.
    This subroutine is called when there is user interaction in the output
    In this case if the user double clicks the Document Number then the
    program will call transaction VA03 and display the Sales Document
      CASE syst-ucomm.
        WHEN '&IC1'.
          GET CURSOR FIELD field_name.
          IF field_name = 'TBL_HEADER-VBELN'.
            READ TABLE tbl_header INDEX selfield-tabindex.
            CHECK tbl_header-vbeln NE 0.
            SET PARAMETER ID 'AUN' FIELD tbl_header-vbeln.
            CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                  "process_user_commands
    *&      Form  get_layout
          text
    FORM get_layout.
    Here we manipulate the layout of the list. In this instance we are
    giving the list a 'zebra' format. Once again like the field catalog
    there are many more options available. Look at type slis_layout_alv
    for more options.
      CLEAR st_layout.
      st_layout-zebra = 'X'.
    ENDFORM.                    " get_layout

  • Control ALV: Problem with Fieldcat buffer

    I have developed an ALV report using grid controls.
    However when i change the fieldcatalog(moving coloumns order and so....) and run again i dont see the effect on the list. I tried logging off and in but still same problem. Also is passed below buffer parameters also.
    What could be the issue with controls?
    Any hint/ideas greatly appreciated.
    Thanks.
        CALL METHOD GRID_100->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            I_BYPASSING_BUFFER            = 'X'
            I_BUFFER_ACTIVE               = ' '
            IS_VARIANT                    = gv_variant
            I_SAVE                        = gv_save
            IS_LAYOUT                     = x_layout
          CHANGING
            IT_OUTTAB                     = <gt_table>
            IT_FIELDCATALOG               = it_fieldcat[]
            IT_SORT                       = it_sortcat[]
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            others                        = 4

    I just wanna let everyone know that <b>today</b> i suffered the same and exactly issue like in this entry. It was really causing me to bang my head -> wall like Rich....
    I couldn't see my result after i insert a new column and move a column...
    yeah, guys out there, when you move your ALV fieldcat... make sure you check your layout management tooo...
    otherwise you go around the world to look what's going on!....
    phew... thanks to this post... oh god!
    william wilstroth

  • How to save layout with ALV Pivot format

    Hi
    In ALV report I have  25 fields but I want to use 10 fields out of 25 fields in Pivot Table. My problem is how to save this layout with Pivot format for on going use. At every time execution of report I need not required to set  Pivot Table.
    Please help me.
    -Sanjay

    Hi,
    Are you using FM REUSE_ALV_GRID_DISPLAY? If yes, then pass 'X' to the parameter I_SAVE while calling the fm.
    if you are using Object Oriented ALV, then call the below method before calling the method for display
    DATA : gr_layout TYPE REF TO cl_salv_layout,
           gr_layout_key TYPE salv_s_layout_key.
    CALL METHOD gr_functions->set_all
      EXPORTING
        value  = IF_SALV_C_BOOL_SAP=>TRUE.
      MOVE sy-repid TO gr_layout_key-report.
      CALL METHOD gr_table->get_layout
        RECEIVING
          value = gr_layout.
      CALL METHOD gr_layout->set_key
        EXPORTING
          value = gr_layout_key.
      CALL METHOD gr_layout->set_save_restriction
        EXPORTING
          value = if_salv_c_layout=>restrict_none.
      CALL METHOD gr_layout->set_default
        EXPORTING
          value = if_salv_c_bool_sap=>true.
    Regards
    Vinod
    Edited by: Vinod Kumar on Jul 2, 2010 3:40 PM
    Edited by: Vinod Kumar on Jul 2, 2010 4:43 PM

Maybe you are looking for

  • Anyone else's iPhone 4s speaker not working after update to iOS 6.1?

    My speaker does not work after updating the software to iOS 6.1. No sound for incoming calls or texts, no speakerphone, no siri, no music or any sounds played from apps. Headphones still work as does anything plugged into the headphone jack. I've che

  • Poor image quality using iMovie 8 or iDVD after importing DV file via FW

    Hello, i am a complete newby and asking for help. I have bought a Panasonic NV-GS320EG-S miniDV Camcorder. First i connected it via S-Video to my Pioneer Plasma which worked fine. I have connected the camcorder via Firewire to my iMac 20/2,4 GHz, cam

  • Links stop working

    I created a link in a PDF to open a file and it worked just fine. Now after several Adobe updates they stopped working both using Acrobat 8 Pro and Reader 9. I checked the link and in the link it points to the correct location of the file on the hard

  • Search a string in file

    I want to search for a string in file. I can do it reading the file in line by line and search each line but that would be more expensive. Is there are any api/freeware library, which can help me to search for a string in file? - R

  • HT3702 is there a number to call about fraudulent purchases?

    My bank account statement shows two purchases from the itunes store, and then my bank card was placed on hold and i was unable to purchase anything with my bank card. this purchase was not done by me. is there a number to call to find out who actuall