Set ALV Layout

Hi,
I use a ALV on my WD4A. Now I have following problem. I can define Layout
settings and save them and so on... But it's just user-depending (drop-down provides me just 1 entrie assigment "USER"). But I want to create layouts for
all users.
I found a class CL_SALV_DISPLAY_SETTINGS who should change this but I'm not sure how to reference on it.
Thanks
Matthias
Message was edited by:
        Matthias Böttger

just add ?sap-config-mode=X into URL and it works...

Similar Messages

  • Setting alv layout  as defualt for all usres

    Hi,
    Is it possible to set the webdynpro alv layout set as default for all users.
    I need your input if this is possible in WD ABAP ALV setting.
    Thanks in advance !
    Alok

    I found the answer to my question on my own by just digging into the options available  in ALV.
    Thanks,
    Alok

  • Webdynpro ABAP -- ALV  Layout setting

    Dear all,
    In my development with ALV in Webdynpro ABAP, I want to save the ALV layout via Setting. but it seems that the layout only can be saved as user-specific, is it any possible to use it as the gobal one?
    Please kindly provide me some hints. Thanks in Advance.
    Best Regards,

    Hi,
    Yes you can make it global in administrative level.
    1.In SE80 ,Double click on the name of  your Web Dynpro Application .
    2.Select Web Dynpro Application  Menu .
    3.Select Test->-> Execute in Administrative Mode from the menu.
    Your application opens in administrative mode .
    Go to the ALV settings make the changes and save it as some variant.
    This layout will be default and global to all the users.
    Regards
    John Paul

  • Resolved:how to set default LAYOUT for ALV list display

    hey guys,
      In my alv report there are 20 cloumns.
    after display i usualy choose 12 of them from CHOOSE LAYOUT option and then give it to print...
    how to set this LAYOUT as default
    sorry guys i figured it out..
    but can we give it programiticlay?
    Edited by: kumar gaurav on May 27, 2008 8:15 AM

    hi,
    you can do it.
    after declaring the catlog table you will give as
    wa_catlog-seltext_l = 'material'.
    wa_catlog-datatype = 'char'.
    wa_catlog-outputlen = 18.
    wa_catlog-fieldname = 'matnr'.
    append wa_catlog to i_catlog.
    clear wa_catlog.
    wa_catlog-seltext_l = 'plantl'.
    wa_catlog-datatype = 'char'.
    wa_catlog-outputlen = 4.
    wa_catlog-fieldname = 'werks'.
    append wa_catlog to i_catlog.
    clear wa_catlog.
    similarly what sequence you give here i.e. material  ,  plant  etc. you get the output in the same oder you can even give only the fields you want in the output.
    rewards points if useful.
    siri

  • How to set default layout for ALV grid ?

    Dear all,
    When execute ALV reports, the user customize the layout for their own purpose. But each time they run that report, they must choose again their layout. Is there any way to set the layout as default ?
    Thank you very much,
    Sylvecat.

    Hi,'
    After you have created a layout just follow the steps listed below for making it as default layout:
    1. Click (Save Layout).
    2. Enter a name in the Save Layout field. The name must begin with a letter.
    3. Type in a description for the layout in the Name field.
    4. Select the Default Setting check box if you want this layout to be the default layout every time you run
    the report.
    5. Click (Continue).
    Note: A warning message will appear if you are trying to save over an existing layout. Close the box by
    selecting the X in the upper right hand corner or choose Yes to overwrite the layout.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • ALV layout variant missing in background job.

    hi guys,
    Having problem on getting the default ALV layout variant when run the job in backgorund. Please advise any correction needed in the following code.
    Thanks.
    *&  Include           Z_MM_KBR_AGSUBCONINV_MOD2                        *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS '100'.
      SET TITLEBAR '100'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  display_data  OUTPUT
          text
    MODULE display_data OUTPUT.
    IF sy-batch IS INITIAL. "Foreground
      IF w_container IS INITIAL.
        IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    *Creating the container
          CREATE OBJECT w_container
            EXPORTING
              container_name              = c_container
            EXCEPTIONS
              cntl_error                  = 1
              cntl_system_error           = 2
              create_error                = 3
              lifetime_error              = 4
              lifetime_dynpro_dynpro_link = 5
              OTHERS                      = 6.
          IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDIF.
    *Creating the ALV GRID
        CREATE OBJECT w_grid
          EXPORTING
            i_parent          = w_container
            i_appl_events     = c_check
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        else.
         exit.
        ENDIF.
      ELSE.
    *Creating the ALV GRID
        CREATE OBJECT w_grid
          EXPORTING
            i_parent          = go_dock_container
            i_appl_events     = c_check
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          WRITE:/ 'Error in grid'.
        ENDIF.
         CREATE OBJECT w_grid
          EXPORTING  i_parent = go_dock_container.
      ENDIF.
    *getting the variant option
        wa_variant-report     = sy-repid.
        wa_variant-username   = sy-uname.
        wa_layout-grid_title  = sy-title.
        wa_layout-cwidth_opt  = c_check.
        wa_layout-zebra       = c_check.
        wa_layout-no_f4       = c_check.
        wa_layout-sel_mode    = 'D'.
    *Excluding the unwanted buttons
         PERFORM exclude_toolbar_buttons.
    build field catalog.
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = c_check
            i_structure_name       = c_fcat_str
            i_bypassing_buffer     = c_check
          CHANGING
            ct_fieldcat            = t_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        loop at t_fieldcat into w_fieldcat.
         if w_fieldcat-FIELDNAME = 'AGING1'.
          W_FIELDCAT-NO_ZERO = 'X'.
          MODIFY t_fieldcat FROM W_FIELDCAT INDEX SY-TABIX.
         ENDIF.
        endloop.
    Generate sort critria
        PERFORM generate_sort.
    Create object of class lcl_event_receiver.
        CREATE OBJECT w_event.
    Handler for events.
       SET HANDLER w_event->handle_top_of_page       FOR w_grid.
       SET HANDLER w_event->handle_print_top_of_page FOR w_grid.
       SET HANDLER w_event->handle_print_end_of_list FOR w_grid.
        SET HANDLER w_event->handle_hotspot_click     FOR w_grid.
    *Displaying the alv
       IF NOT sy-batch IS INITIAL.
         PERFORM create_snp.
       ENDIF.
    t_data = i_final.
        CALL METHOD w_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'A'
            is_layout                     = wa_layout
            is_variant                    = wa_variant
          CHANGING
            it_outtab                     = t_data
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        ENDIF.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " display_data  OUTPUT
    *&      Module  user_command_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      DATA: lt_rows TYPE lvc_t_row,
             w_rows TYPE lvc_s_row.
      CASE sy-ucomm.
        WHEN c_back.
          LEAVE TO SCREEN 0.
        WHEN c_exit.
          LEAVE TO SCREEN 0.
        WHEN c_cancel.
          LEAVE TO SCREEN 0.
       WHEN 'BILDET'.
         CALL METHOD w_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CALL METHOD cl_gui_cfw=>flush.
         IF sy-subrc EQ 0.
           READ TABLE lt_rows INTO w_rows INDEX 1.
           READ TABLE i_vbfa INTO w_vbfa INDEX w_rows-index.
           IF sy-subrc EQ 0.
             CLEAR i_zbw_br_nf4.
             LOOP AT i_zbw_br_nf3 INTO w_zbw_br_nf3 WHERE
                         refkey = w_vbfa-v_vbeln.
               APPEND w_zbw_br_nf3 TO i_zbw_br_nf4.
             ENDLOOP.
    call dialog screen and display new alv control
             CALL SCREEN 101 STARTING AT 10 5.
           ENDIF.
         ENDIF.
         WHEN 'NOTAF'.
         CALL METHOD w_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CALL METHOD cl_gui_cfw=>flush.
         IF sy-subrc EQ 0.
           READ TABLE lt_rows INTO w_rows INDEX 1.
           READ TABLE i_zbw_br_nf3 INTO w_zbw_br_nf3 INDEX w_rows-index.
           DATA docnum LIKE j_1bdydoc-docnum.
           docnum = w_zbw_br_nf3-docnum.
           SET PARAMETER ID 'JEF' FIELD docnum.
           CALL TRANSACTION 'J1B3N' AND SKIP FIRST SCREEN.
         ENDIF.
      ENDCASE.
      ENDMODULE.                 " user_command_0100  INPUT
    *&      Form  modify_col_name
          text
         -->P_<FCAT>  text
         -->P_TEXT_H01  text
    FORM modify_col_name  USING  pwa_fcat TYPE lvc_s_fcat
                                 value(pw_text) TYPE any.
      pwa_fcat-coltext   = pw_text.
      pwa_fcat-scrtext_l = pw_text.
      pwa_fcat-scrtext_m = pw_text.
      pwa_fcat-scrtext_s = pw_text.
    ENDFORM.                    " modify_col_name
          FORM display_hotspot                                          *
    FORM display_hotspot USING pw_row_id    TYPE lvc_s_row
                               pw_column_id TYPE lvc_s_col.
      FIELD-SYMBOLS <l_data> TYPE zbrforecast.
    READ TABLE t_br_nf_acum ASSIGNING <l_data> INDEX pw_row_id-index.
    CHECK sy-subrc = 0.
    IF pw_column_id = ' '.
    ENDIF.
    ENDFORM.                    "display_hotspot
    *&      Form  generate_sort
          Genereate Sort criteria
    FORM generate_sort.
    Local variables
    DATA: wal_sort TYPE lvc_s_sort,
           wl_pos   TYPE numc2.
    wl_pos = 01.
    sort ORDER
    wal_sort-spos      = wl_pos.
    wal_sort-fieldname = c_aufnr.
    wal_sort-up        = c_check.
    APPEND wal_sort TO t_sort.
    ENDFORM.                    "generate_sort
    *&      Form  f4_variant
          text
         <--PW_VARI  text
    FORM f4_variant CHANGING pw_vari TYPE disvariant-variant.
    wa_variant-report = sy-cprog.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = wa_variant
          i_save        = c_u
        IMPORTING
          es_variant    = wa_variant
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc IS INITIAL.
        pw_vari = wa_variant-variant.
      ELSE.
        MESSAGE s208(00) WITH text-t04.
      ENDIF.
    ENDFORM.                    " f4_variant
    *&      Form  validate_layout
    *This subroutine is to validate the layout
    No parameters are passed to this subroutine
    FORM validate_layout.
    IF NOT p_layout IS INITIAL.
      Check Layout
       wa_variant-report   = sy-repid.
       wa_variant-username = sy-uname.
       wa_variant-variant  = p_layout.
       CALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK'
         EXPORTING
           i_save     = c_u
         CHANGING
           cs_variant = wa_variant
         EXCEPTIONS
           OTHERS     = 01.
       IF NOT sy-subrc IS INITIAL.
         SET CURSOR FIELD 'P_LAYOUT'.
         MESSAGE s001(00) WITH text-t06 p_layout.
         STOP.
       ENDIF.
    ELSE.
      clear wa_variant.
    ENDIF.
    ENDFORM.                    " validate_layout
    *&      Form  validate_data
          text
    FORM validate_data .
    PERFORM validate_layout.
    ENDFORM.                    " validate_data

    Hi,
    Before the call to method set_table_for_first_display, populate
    wa_variant-report = sy-repid.
    Best regards,
    Prashant

  • ALV Layout.

    Hi,
    i really can't figure out what is wrong. i can't steer alv gird in a way to have possibility to set/change layout. I can olny get icon, which opens window where i can choose saved layout (couse i'm not able to save layouts so i can't choose any layout). What i have is:
    setting alv grid for first display
        CALL METHOD gr_alv_grid->set_table_for_first_display
          EXPORTING
          is_variant                    = ls_variant
            i_save                        = 'A'
            i_default                     = 'X'
          is_layout                     = ls_layout
          it_toolbar_excluding          = lt_exclude_butt
          CHANGING
            it_outtab                     = gt_prestduso_alv
            it_fieldcatalog               = lt_fieldcatalog
            it_sort                       = lt_sort
    I you'll have any ideas please help me.
    Thanks
    Juzio

    Hello.
    check the sample program
    REPORT  Zreprt.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          ms_row     TYPE lvc_s_row.
        CLASS-METHODS:
          handle_context_menu_request
            FOR EVENT context_menu_request OF cl_gui_alv_grid
            IMPORTING
              e_object  " type ref to cl_ctmenu
              sender,
           handle_user_command
             FOR EVENT user_command OF cl_gui_alv_grid
             IMPORTING
               e_ucomm
               sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_user_command.
      define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   TYPE lvc_s_col.
        CHECK ( e_ucomm = 'XD03' ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX ms_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
        SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
        CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
      ENDMETHOD.                    "handle_user_command
      METHOD handle_context_menu_request.
      define local data
        DATA:
          lt_rows    TYPE lvc_t_row.
        CLEAR: ms_row.
        CALL METHOD go_grid1->get_selected_rows
          IMPORTING
            et_index_rows = lt_rows.
        READ TABLE lt_rows INTO ms_row INDEX 1.
        e_object->add_separator( ).
        CALL METHOD e_object->add_function
          EXPORTING
            fcode       = 'XD03'
            text        = 'Display Customer'
           ICON        =
           FTYPE       =
           DISABLED    =
           HIDDEN      =
           CHECKED     =
           ACCELERATOR =
      ENDMETHOD.                    "handle_context_menu_request
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_user_command         FOR go_grid1,
        lcl_eventhandler=>handle_context_menu_request for go_grid1.
    Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          OTHERS          = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
         CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    NOTE: no dynpro elements on screen. Flow logic as shown below:
    *PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatalog_knb1 .
    define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    LOOP AT gt_fcat INTO ls_fcat
             WHERE ( fieldname = 'KUNNR'  OR
                     fieldname = 'ERNAM' ).
       ls_fcat-hotspot = abap_true.
       MODIFY gt_fcat FROM ls_fcat.
    ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1

  • Specific ALV layout for FBL1N

    Hi Guys,
    Any ideas how can I set the specific ALV layout fo FBL1N report in the way, that special group of users see only one/few specific document types (not all of them) for the certain supplier. I don't want to do that in ABAP.
    Regards
    Adam

    hi Adam,
    you can assign authorization to each single document type in transaction OBA7. You also have to maintain the user profiles as well (the respective auth object is F_BKPF_BLA). Of course this will be valid in the whole system, but it does not make much sense that users have limited authorization in one specific transaction only.
    hope this helps
    ec

  • Custom message(low stock) on alv layout cell(plng folder)

    hi friends,
    in plng folder(alv layout), can system displays message dynamically on a particular cell(row & col combination). eg: "low stock" via fox code. Simply i 'm deriving one cell value based on fox code (formula).  If stock > 0, show stock value, else in that cell i want "low stock".
    In excel , this facility is availble using "IF', formula on particular cell.
    thanks

    Hi Raju,
    what you could do is:
    - define a new calculated keyfigure which takes the stock value if it is > 0 and the value 0 in all other cases.
    - define your query setting View->Properties->Value Display->Zero value display->show zero values to "low stock".
    This has a similar effect. All value which are 0 in the query are displayed as text "low stock". Another option to highlight "low stock" material would be using exceptions.
    Maybe this fulfills your requierement. Binding messages raised in planning function to certain cells in excel is not possible.
    Regards Matthias Nutt
    SAP Consulting Switzerland

  • Alv layout problem ?

    Hi everyone,
    I generating 2 alv reports within a program.In the selection screen there are 2 radio buttons for different alv reports. First i selected the 1st radio button and executed the prog to get a alv report.Then i went to change layout and selected the required columns from the columns set and then saved the layout as the default layout.
    Then I came back to the selection screen again.In the selection screen, in the parameter p_var there is default variant,so i cleared the parameter with no layout variant selected.then i selected the 2nd radio button and executed the program.Here the program is again taking the default layout (even though i cleared it in the selection screen )and generating the alv report according to that.But i don't want to use the default layout when i select the 2nd radio button,unless i select it from the variant list.How can i do that?
    Any suggestions please?

    Hi Hymavathi,
    Thanks for the reply.Below is my code for the layout.If u can see any problem in the code please tell me the changes.Thank you.
    PARAMETERS: P_VAR LIKE DISVARIANT-VARIANT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VAR.
      PERFORM GET_VARIANT CHANGING P_VAR.               " ALV Layout
    FORM GET_VARIANT CHANGING X_VAR.
      PERFORM F4_ALV_LAYOUT(PPIO_ENTRY) USING I_GRID-PROGRAM
                                     CHANGING X_VAR.
    ENDFORM.
    perform alv_display.
    FORM ALV_DISPLAY.
      DATA: I_GRID-LAYOUT TYPE SLIS_LAYOUT_ALV.
      SORT I_HEADER BY PLNBEZ AUFNR.
    Define layout.
      CLEAR I_GRID-LAYOUT.
      I_GRID-LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    Set up Variant
      I_GRID-VARIANT-VARIANT = P_VAR.     " Variant
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM             = I_GRID-PROGRAM
        IS_LAYOUT                      = I_GRID-LAYOUT
        IT_FIELDCAT                    = I_GRID-FIELDCAT
        I_SAVE                         = 'A'
        IS_VARIANT                     = I_GRID-VARIANT
      TABLES
         T_OUTTAB                      = I_HEADER
       EXCEPTIONS
        PROGRAM_ERROR                  = 1
        OTHERS                         = 2.
    ALV Failed.
      IF SY-SUBRC <> 0.
        WRITE: / 'Failed with',SY-SUBRC.
      ENDIF.
    ENDFORM.
    PERFORM ALV_DISPLAY_2.
    FORM ALV_DISPLAY_2.
      DATA: I_GRID-LAYOUT TYPE SLIS_LAYOUT_ALV.
      SORT I_HEADER BY PLNBEZ AUFNR.
    Define layout.
      CLEAR I_GRID-LAYOUT.
      I_GRID-LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    Set up Variant
    I_GRID-VARIANT-VARIANT = P_VAR.     " Variant
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM             = I_GRID-PROGRAM
        I_CALLBACK_PF_STATUS_SET       = I_GRID-PF_STATUS_SET
        I_CALLBACK_USER_COMMAND        = I_GRID-USER_COMMAND
        IS_LAYOUT                      = i_grid-layout
        IT_FIELDCAT                    = I_GRID-FIELDCAT
       I_SAVE                         = 'A'
       IS_VARIANT                     = I_GRID-VARIANT
       TABLES
         T_OUTTAB                      = I_HEADER
       EXCEPTIONS
        PROGRAM_ERROR                  = 1
        OTHERS                         = 2.
    ALV Failed.
      IF SY-SUBRC <> 0.
        WRITE: / 'Failed with',SY-SUBRC.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY_2

  • Get Fields equalent to ALV Layout Fields

    I have an ALV report that have ALV layout selected by user. My requirement is i need to get same set of fields from the layout selected. and using this i need to create the internal table at runtime
    Any info on this appreciated.

    Hi,
    <li>Check the below sample code how you have to get build internal table at run time.
    *       Form  GET_FIELDCAT_FROM_VARIANT
    *       Retrieve the fieldcatalog stored for the variant
    form get_fieldcat_from_variant using disvar    like disvariant
                                         itab_head type c
                                         itab_item type c.
      data: fieldcat_new type kkblo_t_fieldcat.
      call function 'REUSE_ALV_TRANSFER_DATA'
           exporting
                it_fieldcat = fieldcat
                is_layout   = layout
           importing
                et_fieldcat = fieldcat_kkb
                es_layout   = layout_kkb.
      call function 'LT_VARIANT_LOAD'
           exporting
                i_tabname           = itab_head
                i_tabname_slave     = itab_item
                i_dialog            = space
                i_user_specific     = 'X'
           importing
                et_fieldcat         = fieldcat_new
           changing
                ct_default_fieldcat = fieldcat_kkb
                cs_layout           = layout_kkb
                cs_variant          = disvar
           exceptions
                wrong_input         = 1
                fc_not_complete     = 2
                not_found           = 3
                others              = 4.
      if sy-subrc = 0.
        refresh fieldcat.
        call function 'REUSE_ALV_TRANSFER_DATA_BACK'
             exporting
                  it_fieldcat = fieldcat_new
             importing
                  et_fieldcat = fieldcat.
        clear: fieldcat_ln.
        modify fieldcat from fieldcat_ln transporting no_out
          where no_out <> 'X'.
      endif.
    endform.                               " GET_FIELDCAT_FROM_VARIANT
    Thanks
    Venkat.O

  • There's a way to transport a request for alv layout  ?

    I have an alv grid. The top-user created layout for alv.
    Now, how can i transport request for the layout
    of the top-user.

    It looks like I could be close. Below is a sample of the code.
    When in debugger, "g_layout" is empty.
    Perhaps this is a stupid question, but at what point should "g_layout" be populated?
    At the same time as "g_layout-grid_title"? Where would it be populated from?
        CREATE OBJECT g_custom_container
               EXPORTING container_name = 'GRID1'.
    Create ALV Grid in container
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
    Set up variant so the users can save their layouts
        g_variant-report = sy-repid.
    Set up layout, sets grid title and color
        g_layout-grid_title =
             'Display/Change Inspection Relevance of Material Attachments'.
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
            i_save     = 'A'   "all-user and global
            is_variant = g_variant
            i_default  = 'X'
            is_layout  = g_layout
          CHANGING
            it_outtab       = itab[]
            it_fieldcatalog = gt_fieldcat[].

  • How to display long text in SAP Query ALV layout? It only show 129 char now

    I have a SAP Query which show a remark field(Max length more than 500 char), but it only show max length 129 char now. In fact, the lenght of remark field text is more than 300, and i had debug the source code, the field text value do is correct, its length do is 376.
    Do anybody can help me solve the issue, let the query ALV layout can show the long text field value?
    thanks very much in addvance.

    Hi,
    ALV can show only a restrict value length around 128 characters, many experts said that we can not extend. many suggestions is split text into some column.
    Regards,

  • How can i set a layout for MIGO screen

    Hello all,
    How can i set a layout for MIGO screen. & make that layout default. Like i want to drag Requistioner column next to quantity in MIgo screen. temporarily I can drag but is there a way to save as layout & save it.

    Hi
    First you arrange however you want and then go to table settings which is there in the right corner of the item details and create a variant and save.
    Find a button with blue yellow and white at the top end above the vertical drag bar when put the cursor it will show you as Configuration.
    After creating the variant tick the check box use as standard setting below the variant
    Hope it helps
    Edited by: Girish  Adaviswamy on Mar 3, 2010 1:27 PM

  • Need to add Excel as option on SAP report view (currently only ALV layout)

    Some users currently have the option to view a report in either the standard ALV layout view or as Excel (example output - transaction VA05).  They also have the Excel icon on their toolbar.  Our issue is that not all users have this option in their GUI.  What do we need to do to add the Excel icon/view option to either their account or their GUI?

    Hello Ryan,
    The export option is coded into the application.
    Can you advise if all users are using the same application VA*?
    Do all users have the same Gui patch and version?

Maybe you are looking for