Totalling the columns in ALV Grid

Hello All,
I have a output with amount and currencies. The problem i am facing is, the amount is in USD and in GBP and it is giving me single value. It is not splitting the USD amount from the GBP amount.
Also, I am doing a subtotal based on material. This is the most important requirement.
Can anybody help me out in this.
Thanks,
Salil
I am giving the below piece of code if you want to refer it.
  DATA: gr_alv        TYPE REF TO cl_salv_table,
        lr_display    TYPE REF TO cl_salv_display_settings,
        lr_columns    TYPE REF TO cl_salv_columns_table,
        lr_column     TYPE REF TO cl_salv_column_table,
        lr_functions  TYPE REF TO cl_salv_functions_list,
        lr_sorts      TYPE REF TO cl_salv_sorts,
        lr_print      TYPE REF TO cl_salv_print,
        lr_column_f   TYPE REF TO cl_salv_columns,
        gr_error      TYPE REF TO cx_salv_not_found ,
        lr_layout     TYPE REF TO cl_salv_layout.
  DATA: key     TYPE salv_s_layout_key,
        gr_msg  TYPE string.
  IF NOT lt_output[] IS INITIAL.
    TRY.
* Create ALV instance - use CALL METHOD since this is a static method
        CALL METHOD cl_salv_table=>factory
          IMPORTING
            r_salv_table = gr_alv
          CHANGING
            t_table      = lt_output.
        lr_display = gr_alv->get_display_settings( ).
        lr_display->set_list_header( text-ttl ).
* Get functions object and then set all the functions to be allowed
        lr_functions = gr_alv->get_functions( ).
        lr_functions->set_all( ).
        DATA: lv_field TYPE lvc_fname.
* Get column settings object and then optimize the column widths to the
* data
        lr_columns = gr_alv->get_columns( ).
        lr_columns->set_optimize( ).
*--- set column header for custom field Difference in Qty
        TRY.
            lr_column ?= lr_columns->get_column( 'BUCHM2' ).
            lr_column->set_output_length('12').
            lr_column->set_long_text( 'Diff Qty' ).
            lr_column->set_short_text( 'Diff Qty' ).
            lr_column->set_medium_text( 'Diff Qty' ).
          CATCH cx_salv_not_found INTO gr_error.
            gr_msg = gr_error->get_text( ).
            MESSAGE gr_msg TYPE 'I'.
        ENDTRY.
*--- set column header for custom field Difference in Qty Abs
        TRY.
            lr_column ?= lr_columns->get_column( 'BUCHM3' ).
            lr_column->set_output_length('13').
            lr_column->set_long_text( 'Diff Qty(Abs)' ).
            lr_column->set_medium_text( 'Diff Qty(Abs)' ).
*            lr_column->set_short_text( 'Diff Qty(Abs)' ).
          CATCH cx_salv_not_found INTO gr_error.
            gr_msg = gr_error->get_text( ).
            MESSAGE gr_msg TYPE 'I'.
        ENDTRY.
*--- set column header for custom field Difference in Value
        TRY.
            lr_column ?= lr_columns->get_column( 'VALUE' ).
            lr_column->set_output_length('15').
            lr_column->set_long_text( 'Value Diff' ).
            lr_column->set_medium_text( 'Value Diff' ).
            lr_column->set_short_text( 'Value Diff' ).
          CATCH cx_salv_not_found INTO gr_error.
            gr_msg = gr_error->get_text( ).
            MESSAGE gr_msg TYPE 'I'.
        ENDTRY.
*--- set column header for custom field Difference in Value Abs
        TRY.
            lr_column ?= lr_columns->get_column( 'VALUE_ABS' ).
            lr_column->set_output_length('15').
            lr_column->set_long_text( 'Value Diff(Abs)' ).
            lr_column->set_medium_text( 'Value Diff(Abs)' ).
          CATCH cx_salv_not_found INTO gr_error.
            gr_msg = gr_error->get_text( ).
            MESSAGE gr_msg TYPE 'I'.
        ENDTRY.
*--- set column header for custom field Status
        TRY.
            lr_column ?= lr_columns->get_column( 'STATUS' ).
            lr_column->set_output_length('15').
            lr_column->set_long_text( 'PI Item Status' ).
            lr_column->set_medium_text( 'PI Item Status' ).
          CATCH cx_salv_not_found INTO gr_error.
            gr_msg = gr_error->get_text( ).
            MESSAGE gr_msg TYPE 'I'.
        ENDTRY.
*--- set column header for custom field Status
        TRY.
            lr_column ?= lr_columns->get_column( 'TOTAL' ).
            lr_column->set_output_length('15').
            lr_column->set_long_text( 'Total Value Diff' ).
            lr_column->set_medium_text( 'Total Value Diff' ).
          CATCH cx_salv_not_found INTO gr_error.
            gr_msg = gr_error->get_text( ).
            MESSAGE gr_msg TYPE 'I'.
        ENDTRY.
* Optimize the column widths for printing.
        lr_print = gr_alv->get_print( ).
        lr_print->set_print_parameters_enabled( value = 'X' ).
        lr_print->set_column_optimization( value = 'X' ).
*--- This code is to get the layout,save the layout and display the
*    layout
        lr_layout = gr_alv->get_layout( ).
        lr_layout->set_default( cl_salv_layout=>true ).  " allow default
        key-report = sy-repid.
        lr_layout->set_key( key ).
       lr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
        DATA: init_layout TYPE slis_vari.
        init_layout = p_layout.
        lr_layout->set_initial_layout( init_layout ).
*--- display report
        gr_alv->display( ).
      CATCH cx_salv_msg.
        WRITE: 'Error displaying grid! - cx_salv_msg'.
      CATCH cx_salv_not_found.
        WRITE: 'Error displaying grid! - cx_salv_not_found'.
      CATCH cx_salv_data_error.
        WRITE: 'Error displaying grid! - cx_salv_data_error'.
      CATCH cx_salv_existing.
        WRITE: 'Error displaying grid! - cx_salv_existing'.
    ENDTRY.
  ELSE.
    MESSAGE s004.
  ENDIF.

Can you use something like function module CONVERT_CURRENCY_BY_RATE to convert one set of currencies so all amounts are in the same currency before you display them in the ALV?
- April King

Similar Messages

  • How to align text {center/left/right} in  the column of ALV grid

    Hai all,
    I am displaying one check box in the ALV grid, but default it is coming left align in the column,
    how can i assign it to the center of the column.
    Thanks,
    SREEVATHSAVA.G
    Edited by: SREE on Aug 14, 2009 7:53 AM

    Hi,
    DATA:
      lr_model type ref to cl_salv_wd_config_table,
      lr_col type ref to cl_salv_wd_column.
    lr_col = lr_model->if_salv_wd_column_settings->get_column( 'EMPID' ).
    lr_col->SET_H_ALIGN(value = CL_WD_TABLE_COLUMN=>E_H_ALIGN- CENTER).
          AUTO TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '00', " TableColumnHAlign.auto
          CENTER TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '01', " TableColumnHAlign.center
          FORCED_LEFT TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '04', " TableColumnHAlign.forcedLeft
          END_OF_LINE TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '05', " TableColumnHAlign.endOfLine
          FORCED_RIGHT TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '06', " TableColumnHAlign.forcedRight
          BEGIN_OF_LINE TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '07', " TableColumnHAlign.beginOfLine
    Regards,
    Lekha.

  • How to insert the checkbox as a separate column  in alv grid display

    Hi
    How to insert the checkboxes as a separate column  in alv grid display with using the reuse_alv_fieldcatlog_mege.
    example
    matnr    maktx  ersda                 checkbox
    10        books  28/03/2009          checkbox
    Thanks
    chinnu

    Hi,
        Check the following code.
    TYPE-POOLS: slis.
    TYPES:
          BEGIN OF ty_output,
          chk TYPE c,
          number TYPE i,
          name(20) TYPE c,
          END OF ty_output.
    DATA: gt_output TYPE STANDARD TABLE OF ty_output,
          gs_output TYPE ty_output.
    DATA: wa_layout           TYPE slis_layout_alv.
    DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
    After you populate the data, build the field catlog like shown below.
    wa_fieldcatalog TYPE slis_fieldcat_alv.
    wa_fieldcatalog-fieldname = 'CHK'.
      wa_fieldcatalog-outputlen = '3'.
      wa_fieldcatalog-col_pos = '1'.
      wa_fieldcatalog-seltext_m   = 'CHK'.
      wa_fieldcatalog-checkbox = 'X'.
      wa_fieldcatalog-edit = 'X'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
    wa_fieldcatalog-fieldname = 'NUMBER'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '2'.
      wa_fieldcatalog-seltext_m   = 'NUMBER'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
      CLEAR  wa_fieldcatalog.
      wa_fieldcatalog-fieldname = 'NAME'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '3'.
      wa_fieldcatalog-seltext_m   = 'NAME'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
      CLEAR  wa_fieldcatalog.
      wa_layout-box_fieldname     = 'CHK' .
      wa_layout-box_tabname       = 'GT_OUTPUT' .
    Now call the FM
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = sy-repid
          i_callback_pf_status_set          = 'PF_STATUS'
          i_callback_user_command           = 'USER_COMMAND_GRID'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
          is_layout                         = wa_layout
          it_fieldcat                       = it_fieldcatalog
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = gt_output
    * 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.

  • Selecting a row in the output of alv grid

    hi,
    how do i select a row in the output of alv grid?plz help...
    regards,
    sheeba.

    Hi,
    Please refer the code below:
    *& Report  ZDEMO_ALVGRID_SELROW                                        *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display capture each row a user has *
    *& selected                                                            *
    REPORT  zdemo_alvgrid_selrow                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      SEl,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-box_fieldname     = 'SEL'.
                                     "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
    *            IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into corresponding fields of table it_ekko.
    endform.                    " DATA_RETRIEVAL
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
        WHEN '&DATA_SAVE'.  "user presses SAVE
        loop at it_ekko into wa_ekko.
          if wa_ekko-sel EQ 'X'.
    *       Process records that have been selected
          endif.
        endloop.
      ENDCASE.
    ENDFORM.
    Thanks,
    Sriram Ponna.

  • Maximum number of character we can print in a column uing ALV grid display

    Hi frnds,
    My requirment is to print 500 charcter data in a column using ALV grid display.
    Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
    Regards,
    Sandipan

    Hi Sandipan,
    refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
    857823 - ALV grid: Strings with a maximum of 128 characters
    Symptom
    Entries in cells of the type CHAR or string are truncated after 128
    characters in the SAP GUI.
    also refer,
    ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
    (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
    Cause and Prerequisites
    The data table that is sent to the front end only allows character values
    with the length 128.
    Solution
    This is the standard system behavior and cannot be changed.

  • Hide a Column in ALV Grid Output

    Hi,
    I want to hide a column in ALV Grid Output through program.
    I am using   lwa_fieldcat-NO_OUT = 'X'. to hide the column in output but it is not working, column in not hided in the output.
    Kindly suggest.

    It should work..
    see the code :
    d_fieldcat_wa-fieldname = 'MATNR'.
    d_fieldcat_wa-seltext_l = 'material number'.
    d_fieldcat_wa-no_out = 'X'. * hide particular field
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    if not please paste your code here.
    Thanks
    Seshu

  • Want to display more than 300 charcters in a column using ALV grid display

    Hi Guru's,
    I am trying to display more than 500 charcters in a column using alv grid display but it in the output it is showing only 128 characters. Can you help me to display all the characters in particular column Or is there any limitation in maximum of no of charcters for a column?
    Thanks,
    Radha.

    Hi Paurl,
    Define a work area say
    wa_layout type slis_layout_alv.
    then fill this work area as
    wa_layout-zebra = X
    wa_layout-colwidth_optimize = X.
    wa_layout-max_linesize = 300.
    Then in FM 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    is_layout = wa_layout
    etc.
    you provided this for the field which is displayed in alv grid will have more than 128 characters.
    from this code i want,how it refers to particular field.
    when i mentioned field catalog-OUTPUTLEN = '300'.
    it is not displayed the field morethan 128 characters.
    it only displays 128 characters.
    please provide me clear and breif information with suitable code.
    i am trying what your sending but it is not displayed more than 128 characters.
    if you don't mind please spend for me some time for this and
    give me clear and breif information with suitable code.
    Thanks & Regards,
    Radhakrishna.

  • How to Display Sub-Columns using ALV Grid

    Hi ,
      Could someone tell me how to display sub-columns under a parent column using ALV Grid. Do we have any standard Program which has this scenario. Please let me know.
    Thanks,
    Abaper.
    Message was edited by:
            ABAP'er

    you can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
    check below
    BCALV_DND_01                   Drag ALV Row to Tree Folder
    BCALV_DND_02                   Drag Icons from Tree to Rows of the Grid
    BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
    BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
    BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
    Rewards if useful............
    Minal

  • Hide column in alv grid

    Hi Everyone,
    I would like to know how to hide a column in alv grid. Is there any specific field to set in the field catalog.
    Thanks in advance,
    Prabs.

    Hello friends,
    I am using the following lines of code, but invisible of my column ( message ) is not working, would be nice if some one can give me any tip.
    Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
      LOOP AT pt_fieldcat ASSIGNING <lfs_fieldcat>.
        CASE <lfs_fieldcat>-fieldname.
          WHEN 'DUMMY'.
            <lfs_fieldcat>-coltext = 'Message'.
            <lfs_fieldcat>-no_out = 'X'.
        ENDCASE.
      ENDLOOP.
    I have also set the field catalog to no_out = 'X'.
    PS: Do I need to append the field catalog to internal table ??
    I am using the function
    CALL METHOD lalv->SET_TABLE_FOR_FIRST_DISPLAY
             EXPORTING I_STRUCTURE_NAME =  'abc'
                       IS_LAYOUT        = ps_layout
             CHANGING  IT_OUTTAB        = xyz.
    Do I have to implicit set the field catalog in ps_layout ??

  • Disable re-order columns in ALV Grid

    Hi,
    I want to disable the option of move/re-order of columns in ALV grid.
    Ex: My grid is displaying 5 fields in the order F1, F2, F3, F4 & F5. I can move the columns by dragging then on their header so I can change the fields order to F2, F3, F1, F4 & F5. I want to disable this option of re-arranging the columns in the ALV grid.
    Its not related FIX_COLUMN in field catalog.
    Thanks & Regards,
    Adithya M.

    Hi Hima,
    FIX_COLUMN is is used to fix the respective columns from moving when horizontal scroll bar is moved.
    I want to disable re-arranging of columns, i.e, after displaying the grid the user should not be able to re-arrange/drag the column from one position to other.
    Thanks & Regards,
    Adithya M

  • How to hide selection column from alv grid

    hi
    i want to hide selection columns form alv grid.. how can i do it.. Is there any fm for that?
    regards
    palak

    Hi,
    the ALV Grid Control allows you to directly hide key columns with NO_OUT (field KEY_SEL is not used).
    Field name:NO_OUT
    Comp. type:LVC_NOOUT
    Dtype(length):Char(1)
    SPACE, 'X'
    If you set this field, you hide the relevant column in the list. Nevertheless, the column is available in the field selection and can be interactively selected by the user as a display field. The ALV displays the contents of hidden fields on the detail screen for a row in the grid control.
    Regards,
    Neenu.
    Edited by: Neenu Jose on Oct 21, 2008 10:46 AM

  • Do not allow to sort some columns in Alv Grid

    Dear friends,
    Please help me.
    I want to tell to the method set_table_for_first_display - make one of the columns not sortable.  Let's say the column name is "My Icon".
    What I mean with that is:
    when User will highlight column "My icon" and then click on sort buttons in the toolbar - no sort will happen on this column.
    I was trying to identify a field in lvc_s_sort which would say "do not sort this column".  Is there any?
    Or the only way to accomplish my task is to make sort buttons in the toolbar disable if column "My Icon" is clicked?
    gt_sort      TYPE lvc_t_sort.
        CALL  METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'IT'
                       is_layout        = gs_layout
                       is_print         = gs_print
             CHANGING  it_outtab        = it
                       it_fieldcatalog  = gt_fcat
                       it_sort = gt_sort
    Thank you,
    Tatyana.

    Got a solution for ya, but you have to handle it thru coding.   So you will need to handle an event from your ALV grid. 
    First thing is that you need a local class as your event handler,  copy and paste this code.  Here we are using the name ALV_GRID for your alv object
    data: alv_grid       type ref to cl_gui_alv_grid.
    *       CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      public section.
        methods handle_user_command
          for event before_user_command of cl_gui_alv_grid
          importing e_ucomm.
      private section.
    endclass.
    *       CLASS lCL_EVENT_RECEIVER IMPLEMENTATION
    class lcl_event_receiver implementation.
      method handle_user_command.
        data: icols type lvc_t_col,
              xcols like line of icols.
    * Get the currently selected column
        call method alv_grid->get_selected_columns
           importing
             et_index_columns = icols.
        read table icols into xcols index 1.
    * If the selected column is not one that should be sorted
        check xcols-fieldname = 'MATNR'.    "<-- Whatever columns that you don't want to allow sorting on.
    * Now check the function code, if sort ascending or descending, then give message
        check e_ucomm = cl_gui_alv_grid=>mc_fc_sort_asc
          or  e_ucomm =  cl_gui_alv_grid=>mc_fc_sort_dsc.
        message i001(00) with 'Can not sort on this column'.
    * Now set the UCOMM as if the user didn't click anything.
        call method alv_grid->set_user_command( space ).
      endmethod.
    endclass.
    data: event_receiver type ref to lcl_event_receiver.
    Also, you will need to set the event hanlder after calling the SET_TABLE_FOR_FIRST_DISPLAY.
      call method alv_grid->set_table_for_first_display
          changing
               it_outtab       = i_alv[]
               it_fieldcatalog = ifc[].
    *  Set the handler for ALV grid
      create object event_receiver.
      set handler event_receiver->handle_user_command for alv_grid.
    Just tested this, and works quite well.
    Regards,
    Rich Heilman

  • Facing a Problem while downloading the data from ALV Grid to Excel Sheet

    Hi Friends,
    Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
       I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
    Can any one help me out in this case.

    hi...
    if this problems happens dont display the same internal as u finally got.
    just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
    for eg.
    ur final internal int table for disp,
         data : begin of itab occur 0,
                        matnr like mara-matnr,
                   end of itab.
    create new like this,
               data : begin of itab occur 0,
                        matnr(12) type N,
                   end of itab.

  • Problem in placing the background in ALV Grid display

    I have created one image of the business flow, and it have to be displayed in the background of ALV grid display.
    For this I have gone to T.Code –<b>OAER</b> , Given class name as <b>PICTURES</b> , Class type as <b>OT</b> , Object Key <b>BACKGROUND</b>, clicked on the triangle of Standard Doc , then double click on screen, and finally uploaded the background into SAP.
    In the function module <b>‘REUSE_ALV_GRID_DISPLAY’</b> I passed this background to the parameter I_BACKGROUND_ID.
    It is working fine, and I was able to see the back ground in my program.
    (developed in IDES)
    But the same is not working in my development client, will some one suggest be the reason for the problem. Please kindly help me out from this problem.

    hello Dinesh,
    I have created the object key in the development client itself and used in the grid display of the same client. i am not understanding where the problem is, any how thank you very much for your responce. if you have any other solution please let me know.
    Thank you

  • Wan to add push button in the output of ALV Grid display.

    Hi Friends,
    I wan to add a Push button in the output of ALV GRID display with STANDARD ikons.
    How to copy standard ikons of GRID output.
    How to apply the copied status into my code.
    Regards,
    Viji

    Hi,
    Goto SE41, create a pf-status for your alv report program.
    On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
    Delete the unwanted buttons and also you can add new buttons if reqd.
    Activate pf-status --> and apply in alv program.
    Now to apply this pf-status in your alv report follow code:-
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
         it_sort                           = it_sort        " sort info
        TABLES
          t_outtab                          = it_final      " internal table
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *&      Form  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    *       -->RT_EXTAB
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_STAT'. "<--pass pf-status name here
    ENDFORM.                    "pf
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
        WHEN '<function_code>'. "<--to handle user actions
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Hope this helps you.
    Regards,
    Tarun

Maybe you are looking for

  • Problem using docking station with ipod 5th generation

    just bought an ipod touch, 5th generation, with the Lightening connector. Bought an Acoustic solutions docking station with the same small lightening connector but when I dock I can only charge the ipod and not play music through the docking station.

  • Running Photoshop Elements (1) on Windows 8

    I'm sure folks by now know that older Photoshop Elements doesn't install on Windows 8.  (I think it's version 1, as no version is given on the package, and I bought it a long time ago from the Adobe store via a friend at Adobe who is not  longer arou

  • Related to MySql

    data in mysql table is getting cleared when i am using getResultList through toplink

  • RoboHelp 7 Server Support

    Hi, When we purchased RoboHelp 7 Server, we just purchased Maintenance support, not Server Support, as it was indicated that Server support would be over $9,000 and was optional. We did purchase support for the RoboHelp software, but we are running i

  • Can not I develop InDesign CS3 plug-in on MAC OS X 10.6?

    I notice that InDesign CS3 requires xCode 2.4.1. However, i can not install xCode 2.4.1 on MAC OS X 10.6, it requires 10.4.