Build default ALV Layout

Hi,
       I've a selection screen field to select the output ALV layout. Instead of someone manually saving a default layout, i need to write coding to create this default layout and display this default layout name in the selection-screen layout field. Can somebody help me with this? Helpful answers will be honestly rewarded
thanks,
Venky

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
   I_CALLBACK_PROGRAM              =  g_repid
   I_STRUCTURE_NAME                =  'sflight'
   IT_FIELDCAT                     =  gt_fieldcat
   I_DEFAULT                      = 'X'
   I_SAVE                         = 'A'
  IS_VARIANT                     = GX_VARIANT "<<<< pass variant
  TABLES
    T_OUTTAB                       = lt_sflight
EXCEPTIONS
   PROGRAM_ERROR                  = 1
   OTHERS                         = 2
FORM DOWNLOAD_FILE TABLES P_T_LISTE STRUCTURE G_T_LISTE.
  G_R_DISP_VARIANT-REPORT = SY-REPID.
  G_R_DISP_VARIANT-VARIANT = PA_VAR.
  CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
       EXPORTING
            I_DIALOG            = 'N'
            I_USER_SPECIFIC     = 'A'
            I_DEFAULT           = 'X'
            IT_DEFAULT_FIELDCAT = G_T_FIELDCAT
            I_LAYOUT            = G_R_LAYOUT
       IMPORTING
            ET_FIELDCAT         = G_T_FIELDCAT
            ES_LAYOUT           = G_R_LAYOUT
       CHANGING
            CS_VARIANT          = G_R_DISP_VARIANT
       EXCEPTIONS
            ERROR_MESSAGE       = 4
            OTHERS              = 4.
  LOOP AT G_T_FIELDCAT INTO G_R_FIELDCAT WHERE NO_OUT NE 'X'
                                           AND TECH IS INITIAL
                                           AND FIELDNAME NE 'ICON'.
    MOVE-CORRESPONDING G_R_FIELDCAT TO IS_FIELDCAT.
    IS_FIELDCAT-FIELDNAME = G_R_FIELDCAT-FIELDNAME.
    IS_FIELDCAT-INTTYPE   = G_R_FIELDCAT-INTTYPE.
    IS_FIELDCAT-OUTPUTLEN = G_R_FIELDCAT-OUTPUTLEN.
    IS_FIELDCAT-REF_FIELD = G_R_FIELDCAT-FIELDNAME.
    IS_FIELDCAT-REF_TABLE = G_R_FIELDCAT-REF_TABNAME.
    APPEND IS_FIELDCAT TO IT_FIELDCAT.
  ENDLOOP.
  DATA: WA_LISTE LIKE P_T_LISTE.
  CLEAR:IT_OUTTAB.
  REFRESH: IT_OUTTAB.
  LOOP AT P_T_LISTE INTO WA_LISTE.
    WA_OUTTAB-PSPID = WA_LISTE-PSPID .
    WA_OUTTAB-POSID = WA_LISTE-POSID.
    WA_OUTTAB-POST1 = WA_LISTE-POST1.
    WA_OUTTAB-STTXT_INT = WA_LISTE-STTXT_INT.
    WA_OUTTAB-STTXT_EXT = WA_LISTE-STTXT_EXT.
    APPEND WA_OUTTAB TO IT_OUTTAB.
  ENDLOOP.
**dynamic table creation for data
  ASSIGN LT_DATA TO <FS_DATA>.
Create a new Table
  CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
  EXPORTING
        IT_FIELDCATALOG = IT_FIELDCAT
  IMPORTING
        EP_TABLE = <FS_DATA>
  EXCEPTIONS
      GENERATE_SUBPOOL_DIR_FULL = 1
      OTHERS                    = 2.
  IF SY-SUBRC = 0.
    ASSIGN <FS_DATA>->* TO <FS_1>.
    CREATE DATA NEW_LINE LIKE LINE OF <FS_1>.
A field-symbol to access that work area
    ASSIGN NEW_LINE->*  TO <FS_2>.
**MOVE DATA
    LOOP AT IT_OUTTAB INTO WA_OUTTAB.
      CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
           EXPORTING
                INPUT  = WA_OUTTAB-PSPID
           IMPORTING
                OUTPUT = WA_OUTTAB-PSPID.
      CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
           EXPORTING
                INPUT  = WA_OUTTAB-POSID
           IMPORTING
                OUTPUT = WA_OUTTAB-POSID.
      LOOP AT G_T_FIELDCAT INTO G_R_FIELDCAT
                          WHERE NO_OUT IS INITIAL
                            AND TECH IS INITIAL.
        ASSIGN COMPONENT G_R_FIELDCAT-FIELDNAME OF STRUCTURE
                                                WA_OUTTAB TO <FS_5>.
        ASSIGN COMPONENT G_R_FIELDCAT-FIELDNAME OF STRUCTURE
                                                <FS_2> TO <FS_3>.
        <FS_3> = <FS_5>.
      ENDLOOP.
      INSERT <FS_2> INTO TABLE <FS_1>.
    ENDLOOP.
  ELSE.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE.
  IF SY-SUBRC EQ 0.
    LOOP AT <FS_1> ASSIGNING <FS_2>.
      TRANSFER  <FS_2> TO P_FILE.
    ENDLOOP.
  ELSE.
    MESSAGE E041(S9) WITH P_FILE.
  ENDIF.
  CLOSE DATASET P_FILE.
ENDFORM.                    " download_file
002 vsm1kor 13.06.06 - en

Similar Messages

  • How to make Default ALV layout

    Hi,
    I want to make 'STANDARD view' as a default ALV Layout...If anybody execute my ALV Report STARD Layout variant should display by default. Other variant layouts they can select from drill down..
    I know class and method but i don't know how to write code for this with paremeters..Can anybody help on code please..
    CLASS : CL_SALV_WD_C_TABLE
    METHOD : IF_SALV_WD_COMP_TABLE_PERS~SET_STANDARD_VIEW
    My current ALV CODE
      DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      DATA: l_value TYPE REF TO cl_salv_wd_config_table.
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
      l_value = l_ref_interfacecontroller->get_model( ).
    Thanks.,
    Subba

    Hi sarbjeet singh,
    Thanks for your reply...
    I didn't understand your answer...Already this view gone to production system and every USER created his own view..
    Now how can make default standard view to all users..
    If i keep Standard view as Intial view and release transport to production is it effected to all users and display standard view as initial view?
    Thanks,
    Subba

  • 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

  • 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

  • Doubt in alv layout variant.

    hi experts,
    I have a requirement that my selection screen should have 'ALV LAYOUT' as one of my parameter. I am using PNPCE LDB , now my issue is I can get the layout option when f4 is press on the alv layout parameter but the respective layout is not displaying in my output.
    ex: I have  layout A and  B .
    A have only pernr and name
    b have only pernr and address
    my normal alv layout is  pernr name and address. if i choose A in my ALV LAYOUT parameter also its displaying in default layout alv same is happening for while am choosing B. I  not getting the alv output for respective layout I chosen.
    {code}
    FORM GET_VARIANT .
    DATA: lw_variant TYPE disvariant,
       l_exit     TYPE char1.
       lw_variant-report = sy-repid.
       CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
         EXPORTING
           is_variant = lw_variant
           i_save     = 'A'
         IMPORTING
           e_exit     = l_exit
           es_variant = lw_variant
         EXCEPTIONS
           not_found  = 2.
       IF sy-subrc = 2.
         MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ELSE.
         IF l_exit EQ space.
           p_layout = lw_variant-variant.
           IF NOT p_layout IS INITIAL.
             PERFORM get_w_variant.
           ENDIF.
         ENDIF.
       ENDIF.
    ENDFORM.                    " GET_VARIANT
    *&      Form  GET_W_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_W_VARIANT .
       DATA: lw_variant TYPE disvariant.
       lw_variant-report      = sy-repid.
       lw_variant-handle      = space.
       lw_variant-log_group   = space.
       lw_variant-username    = space.
       lw_variant-variant     = p_layout.
       lw_variant-text        = space.
       lw_variant-dependvars  = space.
    ENDFORM.                    " GET_W_VARIANT
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ALV_DISPLAY .
    *  DATA: l_table      TYPE REF TO cl_salv_table.
    *  TRY.
    *  CALL METHOD CL_SALV_TABLE=>FACTORY
    **    EXPORTING
    **      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
    **      R_CONTAINER    =
    **      CONTAINER_NAME =
    *    IMPORTING
    *      R_SALV_TABLE   =  L_TABLE
    *    CHANGING
    *      T_TABLE        = GT_ALV
    *   CATCH CX_SALV_MSG .
    *  ENDTRY.
    *   l_table->display( ).
       DATA: lw_variant TYPE disvariant.
    DATA:I_FIELD TYPE SLIS_T_FIELDCAT_ALV,
          iWA  TYPE SLIS_FIELDCAT_ALV.
       IWA-FIELDNAME = 'PERNR'.
       IWA-SELTEXT_L = 'EMPLOYEE ID'.
       APPEND IWA TO i_FIELD.
       IWA-FIELDNAME = 'NAME'.
       IWA-SELTEXT_L = 'NAME'.
       APPEND IWA TO I_FIELD.
       IWA-FIELDNAME = 'DEPT'.
       IWA-SELTEXT_L = 'DEPT'.
       APPEND IWA TO I_FIELD.
       IWA-FIELDNAME = 'UNION'.
       IWA-SELTEXT_L = 'UNION'.
       APPEND IWA TO I_FIELD.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program      = 'ZTESTPRGFOR20' "Program name
         i_callback_user_command = 'USER_COMMAND'
         it_fieldcat             = i_field
    *    it_sort                 = i_sort
         i_save                  = 'X'
         is_variant              = Lw_variant
       TABLES
         t_outtab                 = GT_ALV                       
       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.                    " ALV_DISPLAY
    {code}

    hi Mohammed Quddus,
    thanks for your reply . but if you look at my code the concept are same as same as that link code.
    am getting all the things right.
    i Can able to change the layout by the button on alv and
    able to save that new layout
    the saved layout are displaying in the my parameter if I press f4. the problem is if I choose the saved layout that layout is not coming in my alv output always its showing default layout.
    if anything you find wrong in my code please let me know.

  • Is it possible to deploy a default Custom Layout template?

    I was asked if we could deploy a Default Custom Layout template for Adobe Profiles .  So that when creating Firm Portfolios they are standardized?  It would be nice if it were defaulted and they didn’t have to choose the Layout.
    Thanks in advance for any info
    Ed

    Hi Chris,
    Looking through the BPEL client API, I think it might be possible to change the process state via java code. I say might, because the documentation is not that splendid. The IBPELProcessHandle interface has a method updateMetaData which allows you to change the state, among other things. I have not tried this yet so the solution a little theoretical.Sorry for that :-\
    Then, when you have your java class working, you can create an Ant task for it and invoke your Ant task in the build.xml, right after the deployment target.
    Kind regards,
    Harm

  • 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

  • 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

  • Dragging one cell value(copy) across columns or across rows in ALV layout

    Hi friends,
    In bps layouts, data is displayed in ALV grid as interface. At plng folder level, can i incorporate excel feature like dragging one cell value across columns or across rows?  Simply if user enter one value in cell of ALV grid, that should be copied automatically across rows/columns while dragging?
    Second question, even i chose in layout builder excel as interface, that layout showed in plng folder as ALV grid layout. Why it happens so. I read documentation in UPSPM of that particular plng folder, it tells same thing(even if u choose excel, it will show in ALV only). So how can i get excel interface in plng folder?
    Regards,
    Kumar

    requested property is not possible at ALV layout level. Provided text document load facility to user. So user can directly load excel to plng folder.
    Issue resolved.

  • 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 default toolbar layout for all users in my system?

    Hi everybody! I am running a local ubuntu server at my office. I can set some defaults preferences (about:config) for all new users in the system by defining those prefs in the /etc/firefox/syspref.js.
    Now, I want to define default toolbar layout in a similar way (maybe not needed but fun), to copy the toolbar layout for my user. Is there a general way to do that?
    thank you in advance!

    You can try to create a default template folder (defaults/profile) in the Firefox and place the file(s) in that folder for newly created profile.
    The only way to customize an existing profile is to copy files directly to it.

  • 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?

  • How to send pdf or excel attachment as saved alv layout in email

    Hi Guru,
    I am developing a report in which, i am sending report as excel attachment after clicking a button on top of alv grid, and pdf attachment after clicking another button on top of alv grid. I am sending mail by two ways they are:
    1) I am populating my internal table value in separate internal table and converting that to string and sending email as excel attachment.
    2) And am converting report as spooljob, and using abapspool 2 pdf function module i am converting spool to pdf, after that am send that pdf as mail attachment.
    Now my requirement is i need to send email attachment as layout which is displayed in the alv screen, even i hide a column and  change the  layout  it is going with all the columns. What should i do for this problem.
    Regards,
    Rithika

    Hi,
    Check if the below steps will solve the problem.
    * Get the run time ALV layout (field catalog) using the below method.
         data: r_grid TYPE REF TO cl_gui_alv_grid.
         CALL METHOD r_grid->get_frontend_fieldcatalog
              IMPORTING
                   et_fieldcatalog = t_fcat.
    * Adjust the download table according to t_fcat.

  • Flash MX: default keyboard layout

    My apologies if this topic had a better place to be posted.
    I'm using Flash MX 2004 7.2. I use both English and Japanese keyboard layouts in my OS.
    Every time I open Flash MX 2004, the default keyboard layout turns to Japanese. This only happens in Flash MX - in Dreamweaver MX and Fireworks MX, the keyboard layout defaults to English no problem.
    Has anyone encountered this issue before?
    Any suggestions would be appreciated.
    TIA

    It sounds like it could be a Flash problem. You might want to also ask your question in the support forums run by the maker of the program:
    http://www.macromedia.com/cfusion/webforums/forum/index.cfm?forumid=15
    You also might want to ask your question in a more appropriate Apple forum, like "Using Mac OS X Tiger." This one is for "Universal Access" questions.

Maybe you are looking for