How can we sort up currency field in alv grid??

Hi GUrus,
Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
Thanks in advance!!!
regards,
Kranthi.

hii,
SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
so u will get the option for sorting in your alv report.
Thanks

Similar Messages

  • How can we sum for the field on alv grid

    Dear Freinds,
                   I am having the field count .....in the ouput (iam using alv grid) .......which dispalys  the id's which are identical .
    i have scneario similar to the below in my ALV Output
    ID                count         total
    4000              3              100
                                          100
                                         200       Can i get count 3 also along with 200 in alv?
    i am using the code as follows for count can any one please let me know.
    my earlier question which i put was confusing.........so i am givin the qustion again
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    =  text-015.  "'Orgunit'.
      ls_fieldcat-key          = 'X'.
      ls_fieldcat-key_sel      = 'X'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'COUNT'.
      ls_fieldcat-seltext_l    = 'H.Count'.
      ls_fieldcat-outputlen    = 4.
      ls_fieldcat-do_sum       = 'X'.
    ls_fieldcat-datatype    = 'NUMC'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname   = 'TOTAL'.
      ls_fieldcat-seltext_m   = 'total'.
      ls_fieldcat-col_pos     = 3.
      ls_fieldcat-outputlen   = 17.
      ls_fieldcat-do_sum      = 'X'.
      ls_fieldcat-datatype    = 'CURR'.
      append ls_fieldcat to fp_i_fieldcat.
    Please let me know how can do if so what is the parameter i have to change for COUNT
    regards
    syamal

    Hi Shamala Kiran.
                          My name is also kiran.I have a develop a code for u.Actually i cant understand your code.But i know ur problem .Plz check that code.In that code i develop a subtotals and grandttotal.Plz observe the FORM "FIELD CATALOG" in that observe the NETWR FIELD and observe the FORM SORTCATALOG then ur problem will be solved.
    Copy the the below code and execute that code and the result.
    If u r Satisfied with the answer plz give the REWARD POINTS.
    CODE:
    Type Pools
    TYPE-POOLS:slis.
    Tables
    TABLES: vbak,vbap.
    Global Variable
    data: w_var type i.
    Global Data
    DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
         wa_fieldcat TYPE slis_fieldcat_alv,
         it_sortcat TYPE slis_t_sortinfo_alv,
         wa_sortcat  LIKE LINE OF it_sortcat.
    Internal Table
    data: BEGIN OF it_salesorder OCCURS 0,
            vbeln LIKE vbak-vbeln,    " Sales Document Number
            posnr like vbap-posnr,    " Sales Doc Item
            netwr like vbap-netwr,    " Net Value
          END OF it_salesorder.
    SELECT OPTIONS
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.   " Sales Document Number.
    SELECTION-SCREEN END OF BLOCK b1.
    Initialization
    INITIALIZATION.
      PERFORM initialization.
    *&      Form  initialization
          text
    -->  p1        text
    <--  p2        text
    form initialization .
      s_vbeln-sign   = 'I'.
      s_vbeln-option = 'BT'.
      s_vbeln-low    = '4969'.
      s_vbeln-high   = '5000'.
      APPEND s_vbeln.
    endform.                    " initialization
    Start Of Selection
    START-OF-SELECTION.
      PERFORM field_catalog.   "For Structure Creation
      PERFORM fetch_data.      "Get the Data From DB Table
      PERFORM sorting USING it_sortcat.
    End Of Selection
    END-OF-SELECTION.
      perform display_data.
    *&      Form  field_catalog
          text
    -->  p1        text
    <--  p2        text
    form field_catalog .
      wa_fieldcat-col_pos       = w_var.          " Column Position Variable
      wa_fieldcat-tabname       = 'IT_SALESORDER'. " Internal Table Name
      wa_fieldcat-fieldname     = 'VBELN'.         " Field Name
      wa_fieldcat-key           = 'X'.             " Blue Color
      wa_fieldcat-ref_tabname   = 'VBAK'.          " Table Name
      wa_fieldcat-ref_fieldname = 'VBELN'.         " Field Name
      wa_fieldcat-seltext_m     = 'Sales Doc No'.  " Display Text In Screen
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      ADD 1 TO w_var.
      wa_fieldcat-col_pos       = w_var.          " Column Position Variable
      wa_fieldcat-tabname       = 'IT_SALESORDER'. " Internal Table Name
      wa_fieldcat-fieldname     = 'POSNR'.         " Field Name
      wa_fieldcat-ref_tabname   = 'VBAP'.          " Table Name
      wa_fieldcat-ref_fieldname = 'POSNR'.         " Field Name
      wa_fieldcat-seltext_m     = 'Sales Doc Item'. " Display Text In Screen
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      ADD 1 TO w_var.
      wa_fieldcat-col_pos       = w_var.          " Column Position Variable
      wa_fieldcat-tabname       = 'IT_SALESORDER'. " Internal Table Name
      wa_fieldcat-fieldname     = 'NETWR'.         " Field Name
      wa_fieldcat-ref_tabname   = 'VBAP'.          " Table Name
      wa_fieldcat-ref_fieldname = 'NETWR'.         " Field Name
      wa_fieldcat-do_sum        = 'X'.             " Sum
      wa_fieldcat-seltext_m     = 'Net Value'.  " Display Text In Screen
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      ADD 1 TO w_var.
    endform.                    " field_catalog
    *&      Form  sorting
          text
         -->P_IT_SORTCAT  text
    form sorting using p_it_sortcat TYPE slis_t_sortinfo_alv.
      wa_sortcat-fieldname = 'VBELN'.
      wa_sortcat-up        ='X'.
      wa_sortcat-subtot    = 'X'.
      APPEND wa_sortcat TO p_it_sortcat.
    endform.                    " sorting
    *&      Form  display_data
          text
    -->  p1        text
    <--  p2        text
    form display_data .
    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          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      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                         =
        IT_FIELDCAT                       = it_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        IT_SORT                           = it_sortcat
      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                          = it_salesorder
    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_data
    *&      Form  fetch_data
          text
    -->  p1        text
    <--  p2        text
    form fetch_data .
    select a~vbeln
           posnr
           b~netwr
      from vbak as a
    inner join vbap as b on  avbeln = bvbeln
      into table it_salesorder
      where a~vbeln in s_vbeln.
    endform.                    " fetch_data

  • How can I concatenate a currency field (eg: 12.25) with numeric values

    Hi,
    I ma working in ECC6.0.
    How can I concatenate a currency field (eg: 12.25) with numeric and character values into a variable.
    I want to concatenate 12.25  with  "+"  and  "0".
    Regard,
    Divya

    Hi,
    I ma working in ECC6.0.
    How can I concatenate a currency field (eg: 12.25) with numeric and character values into a variable.
    I want to concatenate 12.25 with "+" and "0".
    Regard,
    Divya
    ==================================
    data: l_string type string.
    move l_curr_field to l_string.
    condense l_string no-gaps.     "if needed
    concatenate l_string '+' '0' into l_string.
    now your l_string will have all the values.

  • How can I find the currency field of table KOMU

    I need to select data from table KOMU, including field wrbtr. in 'Currency/Quantity Fields' tab, it's defined to use bkpf-waers.
    but how can i find the corresponding record in bkpf? could anyone tell me the relation between these two table?
    or is there another way to get the currency field?
    thank you!

    Hi,
    In that case, please retrieve the currency & store it in variable. Pass the variables to the Function Module.
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
         EXPORTING
              date             = syst-datum
              foreign_amount   = for_amount
              foreign_currency = L_cur1
              local_currency   =  l_cur2
         IMPORTING
              local_amount     = loc_ammount
         EXCEPTIONS
              no_rate_found    = 1
              overflow         = 2
              no_factors_found = 3
              no_spread_found  = 4
              derived_2_times  = 5.
    [Code]
    Best regards,
    Prashant
    [code]

  • How can I use hotspot click in an ALV grid?

    Hello,
    I have a table that is displayed in an ALV grid and I would like to have one of the columns as clickable icons.
    For example:
    Print  |  Doc. Type | Name
    (icon) |   .docx      | first
    (icon) |   .pdf         | second ... and so on.
    I would like to click in the icon (Print column) and execute an action, but no matter what I do I can't set the action.
    I know that is not just setting "fieldcatalog-hotspot='X'", but I don't know how to use a hotspot handler.
    Here's some of the code I have:
    TYPES: BEGIN OF ty_docs,
                        print LIKE ICON-ID,
                        doc_type LIKE table_doc-TYPE,
                        name LIKE table_doc-NAME,
                 END OF ty_docs.
    DATA:  oref_dock TYPE REF TO cl_gui_docking_container,
                oref_alv TYPE REF TO cl_gui_alv_grid,
                i_fieldcat TYPE lvc_t_fcat,
                aux_fieldcat TYPE lvc_s_fcat,
                aux_lay TYPE lvc_s_layo,
                i_exclude TYPE TABLE OF syucomm,
                i_docs TYPE ty_docs,
                t_docs LIKE TABLE OF i_docs.
    AT SELECTION-SCREEN OUTPUT.
       APPEND 'ONLI' TO i_exclude.
       APPEND 'SJOB' TO i_exclude.
       APPEND 'PRIN' TO i_exclude.
       CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
         EXPORTING
           p_status = sy-pfkey
           p_program = sy-repid
         TABLES
           p_exclude = i_exclude.
    AT SELECTION-SCREEN.
       CHECK sy-ucomm = space.
         SELECT
               icon~ID AS print
               doc~TYPE AS doc_type
               doc~NAME as name
                 INTO CORRESPONDING FIELDS OF TABLE t_docs
                 FROM table_doc AS doc
                      INNER JOIN ICON AS icon    
                        ON icon~NAME EQ 'ICON_PRINT'
                 GROUP BY icon~ID doc~TYPE doc~NAME.
       IF sy-subrc = 0.
         IF oref_dock IS NOT BOUND.
           CREATE OBJECT oref_dock
              EXPORTING
                repid = sy-repid
                dynnr = sy-dynnr
                side = cl_gui_docking_container=>dock_at_bottom
                ratio = 90
             EXCEPTIONS
               OTHERS = 1.
         ENDIF.
         IF oref_alv IS NOT BOUND.
           CHECK oref_dock IS BOUND.
           CREATE OBJECT oref_alv
             EXPORTING
               i_parent = oref_dock
             EXCEPTIONS
               OTHERS = 1.
           CHECK oref_alv IS BOUND.
           aux_fieldcat-fieldname = 'PRINT'.
           aux_fieldcat-coltext = 'Print'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-print'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-just = 'C'.
           aux_fieldcat-hotspot = 'X'.
           aux_fieldcat-outputlen = 10.
           aux_fieldcat-col_pos = 0.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_fieldcat-fieldname = 'TYPE'.
           aux_fieldcat-coltext = 'Doc. Type'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-doc_type'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-outputlen = 15.
           aux_fieldcat-col_pos = 1.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_fieldcat-fieldname = 'NAME'.
           aux_fieldcat-coltext = 'Name'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-name'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-outputlen = 12.
           aux_fieldcat-col_pos = 2.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_lay-grid_title = 'Docs'.
           aux_lay-edit = ''.
           CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
             EXPORTING
              i_structure_name = 'ty_docs'
              i_internal_tabname = 't_docs'
            CHANGING
              ct_fieldcat = i_fieldcat
           EXCEPTIONS
             OTHERS = 3.
           CALL METHOD oref_alv->set_table_for_first_display
             EXPORTING
               i_structure_name = 'ty_docs'
               is_layout = aux_lay
             CHANGING
               it_fieldcatalog = i_fieldcat
               it_outtab = t_docs
             EXCEPTIONS
               OTHERS = 1.
         ELSE.
           CALL METHOD oref_alv->refresh_table_display
             EXCEPTIONS
               OTHERS = 1.
         ENDIF.
      ENDIF.
    Thank you so much in advance!

    Hi,
    After creating grid set the even handler for hot spot.
    SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
    Try this code:
    TABLES: mara,t001l.
    DATA: BEGIN OF i_alv OCCURS 0,
           matnr TYPE mara-matnr,
           mtart TYPE mara-mtart,
           matkl TYPE mara-matkl,
           groes TYPE mara-groes,
           maktx TYPE makt-maktx,
           END OF i_alv.
    DATA: wa_alv  LIKE LINE OF i_alv.
    DATA: alv_container  TYPE REF TO cl_gui_docking_container.
    DATA: alv_grid       TYPE REF TO cl_gui_alv_grid.
    DATA: layout    TYPE lvc_s_layo.
    DATA: fieldcat  TYPE lvc_t_fcat.
    DATA: gt_t001l TYPE STANDARD TABLE OF t001l.
    CLASS lcl_event_receiver DEFINITION.
       PUBLIC SECTION.
    *-->Method for User command
         CLASS-METHODS :
         handle_hotspot_click FOR EVENT hotspot_click    OF
                                               cl_gui_alv_grid
                                     IMPORTING E_ROW_ID e_column_id.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS  lcl_event_receiver IMPLEMENTATION.
       METHOD handle_hotspot_click.
         READ TABLE i_alv INTO wa_alv
          INDEX e_row_id-index
           TRANSPORTING matnr.
         SET PARAMETER ID 'MAT' FIELD wa_alv-matnr.
         CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
       ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    PARAMETERS: p_check TYPE matnr.
    INITIALIZATION.
    PERFORM get_data.
    AT SELECTION-SCREEN OUTPUT.
    *  START-OF-SELECTION.
       DATA: variant TYPE  disvariant.
       DATA: repid TYPE sy-repid.
       repid = sy-repid.
       variant-report = sy-repid.
       variant-username = sy-uname.
       layout-zebra = 'X'.
       layout-edit_mode = 'X'.
       CHECK alv_container IS INITIAL.
       CREATE OBJECT alv_container
                   EXPORTING repid     = repid
                             dynnr     = sy-dynnr
                             side      = alv_container->dock_at_right
                             extension = 350.
       CREATE OBJECT alv_grid
              EXPORTING
                    i_parent          =  alv_container.
    * Set event handler
       SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
    *  ALV Specific. Data selection.
    *  Populate Field Catalog
       PERFORM get_fieldcatalog.
       CALL METHOD alv_grid->set_table_for_first_display
         EXPORTING
           is_layout        = layout
           is_variant       = variant
           i_save           = 'U'
           i_structure_name = 'I_ALV'
         CHANGING
           it_outtab        = i_alv[]
           it_fieldcatalog  = fieldcat[].
    START-OF-SELECTION.
    * FORM GET_DATA
    FORM get_data.
       SELECT * INTO CORRESPONDING FIELDS OF TABLE i_alv
             FROM mara
               INNER JOIN makt
                 ON mara~matnr = makt~matnr
                        UP TO 100 ROWS
                    WHERE makt~spras = sy-langu.
       SORT i_alv ASCENDING BY matnr.
    ENDFORM.                    "get_data
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    FORM get_fieldcatalog.
       DATA: ls_fcat TYPE lvc_s_fcat.
       REFRESH: fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Number'.
       ls_fcat-fieldname  = 'MATNR'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '18'.
       ls_fcat-fix_column = 'X'.
       ls_fcat-key        = 'X'.
       ls_fcat-hotspot    = 'X'.
       ls_fcat-col_pos    = '1'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Type'.
       ls_fcat-fieldname  = 'MTART'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '10'.
       ls_fcat-fix_column = 'X'.
       ls_fcat-key        = 'X'.
       ls_fcat-col_pos    = '2'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Group'.
       ls_fcat-fieldname  = 'MATKL'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '12'.
       ls_fcat-col_pos    = '3'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Size'.
       ls_fcat-fieldname  = 'GROES'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '30'.
       ls_fcat-col_pos    = '4'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Description'.
       ls_fcat-fieldname  = 'MAKTX'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '40'.
       ls_fcat-col_pos    = '5'.
       APPEND ls_fcat TO fieldcat.
    ENDFORM.                    "get_fieldcatalog
    Hope this solves your problem....

  • Currency field in alv grid display

    Hi,
    I am using alv grid display.I am having one currency field netprice.I want it to be displayed as blank when i am not passing any value.But it gives 0.00 when it is not having any value.How to make it blank instead of 0.00.
    Points will be rewarded.
    Regards,
    Sowmya.

    HI,
    If itab-curr  = '0.00' .
    itab-curr = ''.
    modify itab.
    endif.

  • Problem of currency field in ALV grid

    Hi,
       Actually I am working on ALV gird editables. I have passed the CURR 17,2 type to the i_fcat table. But when I am trying to edit a new value to this field with a new value. i.e. '12345' it takes its value as '123.45'. and whenever I am entering a value '123.45' it gives error message that decimals 0 place. I am not able to make out this problem.
         Even while I am doing get_cell_value, I am getting its returning 0.00 as e_value.
          Any help in this regard will be helpful to me...
    regards,
    Brijesh Patel

    Hi Brijesh,
    Are you using the FM "REUSE_ALV_GRID_DISPLAY" to populate field catalogue? if so, define this in your field catalogue for that particular field.
    g_t_fieldcat-CFIELDNAME = 'X'
    where <b>g_t_fieldcat</b> is your custom defined field catalogue. CFIELDNAME here refers to that column in the field catalogue as currency field and SAP automatically adjusts the decimal places.
    Hope this helps and let me know if you need more details.
    Regards,
    Vicky
    PS: Award points if helpful

  • How can we add a button on our ALV Grid

    Hello,
    I need to add a button on the ALV Grid and write a code on that button to download a file on the desktop of the user's machine.
    How can we write a code for the same and what would be the syntax of that code.

    Hi,
    you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
    ENTER SAPLKKBL PROGRAM
    STATUS STANDARD.
    exexute.
    select standard  check box. copy to your zprogram and your gui status.
    Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
    then go to se 38 double click on pf status .it goes to me41 screen .
    there you can add your button along with predefined buttons on application toolbar.
    then write code for button using user command event.
    Code:
    Form Set_pf_status
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'.
    ENDFORM. "Set_pf_status
    In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
    3). Create the following report:
    Code:
    Form User_command
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
           Detects whether the icon/button for
           'Return Tag Deletion' has been pressed. If it has then
           detect whether any rows have been highlighted and then
           set the delete flag.
    FORM user_command USING r_ucomm     LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
    DATA: li_count TYPE I.
    IF r_ucomm EQ '%DELETE'.
      LOOP AT %g00 WHERE mark EQ 'X'.
        ADD 1 TO li_count.
      ENDLOOP.
      IF li_count GT 0.
        gc_delete_flag = 'X'.
        r_ucomm = '&F03'. "Back arraow
      ELSE.
        MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
      ENDIF.
    ENDIF.
    ENDFORM.  "User_command
    *reward points if usefull

  • Sign in front of numeric/currency field in ALV grid/list

    Dear all,
    We need to display sign in front for numeric/currency values which will
    use the sub-total functionality. Currently there is no option for doing
    this in ALV output options.
    Is this possible?
    regards
    Nitesh

    Hi,
    Please go throw below links ,
    may be it will solve u r problem
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Regards
    Suresh.d

  • How to handle user command method in module ALV Grid

    HI Experts,
                     I have 3 containers grid. 
                     GR_GRID              TYPE REF TO CL_GUI_ALV_GRID,
                     GR_GRID1              TYPE REF TO CL_GUI_ALV_GRID,
                     GR_GRID2              TYPE REF TO CL_GUI_ALV_GRID.
                     Please advise me how can I insert, save, delete 3 Module ALV Grid in method user command. How can i get which grid button (save, insert, delete) is clicked and how can i control those grid.
                    Thks in advance.
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS :
            HANDLE_TOOLBAR
                  FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                                IMPORTING E_OBJECT E_INTERACTIVE SENDER,
            HANDLE_USER_COMMAND
                  FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                                IMPORTING E_UCOMM,
            HANDLE_DATA_CHANGED
                    FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
                          IMPORTING ER_DATA_CHANGED
                                    E_ONF4
                                    E_ONF4_BEFORE
                                    E_ONF4_AFTER,
            HANDLE_DOUBLE_CLICK
                     FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                     IMPORTING E_ROW
                               E_COLUMN,
            HANDLE_HOTSPOT_CLICK
                      FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                           IMPORTING E_ROW_ID
                                     E_COLUMN_ID
                                     ES_ROW_NO.
    ENDCLASS. "(LCL_EVENT_RECEIVER DEFINITION) 
    METHOD HANDLE_USER_COMMAND.
         CLEAR G_CODE.
        G_CODE = E_UCOMM.
        CASE G_CODE.
          WHEN 'INSERT'.
            MESSAGE 'insert' TYPE 'I'.
           APPEND INITIAL LINE TO GT_MAIN.
          WHEN 'SAVE'.
           MODIFY ZTNBOOK FROM GT_MAIN.
            MESSAGE 'save' TYPE 'I'.
          WHEN 'DELETE'.
           DELETE FROM ZTNBOOK WHERE B_ID EQ GT_ZTBOOK-B_ID.
            MESSAGE 'delete' TYPE 'I'.
        ENDCASE.
        IF NOT G_CODE IS INITIAL.
      PBO, PAI
         CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
           EXPORTING
             NEW_CODE = G_CODE.
         CLEAR G_CODE.
        ENDIF.
      ENDMETHOD.

    Hi,
    Before posting, Search in SDN.
    See the below tread it will help you.
    Re: Get table for cl_gui_alv_grid

  • How can I sort the words in a document into an alphabetical list?

    How can I sort the words in a document into an alphabetical list? Thanks!

    writer888 wrote:
    How can I sort the words in a document into an alphabetical list? Thanks!
    Copy the words to the Mac's clipboard (Edit menu> Copy)
    Paste into TextEdit 
    Next open the Edit > Find > Find window in Text Edit.
    Highlight a space between two words and Edit menu > copy, paste into the Find field
    Next create a return in the middle of your text and copy that and paste into the Replace field
    Click Replace All.
    Now Edit > Select All and Edit > Copy
    Open a Spreadsheet program with Sort ability and paste into the second column cell from the top
    place a "a" into the top column cell, select the entire colum
    Sort desending order
    Now if you need it out of spreadsheet format, then your going to need to copy just the data cells (not the entire column to avoid problems) and Paste "Special" as unformatted text into a word processing program
    If you need to get rid of the Returns, do the opposite you did in Text Edit, replace the Returns with Spaces
    A chore, but it's rare one needs to sort words into alaphabetical order.
    FYI, I used TextEdit and the free LibreOffice (Spreadsheet and Word Processing) for the above effects.

  • HOW to include a reference currency fields in a view ?

    Hello Experts,
    <b>I am having Currency fields error in generic extraction</b>
    I have table where I am trying to extract data to BW via generic extraction. When I tried
    to extract with the TABLE its giving me an error
    <b>Invalid extract structure template RPSCO of DataSource ZBW_REP3_TEST
    You tried to generate an extract structure with the template structure RPSCO. This operation failed, because the template structure quantityfields or currency fields, for example, field WLP00 refer to a differenttable</b>.
    Now I created a view with all the fields same as my table.
    But its still giving me the same error and taking all the fields as a primary keys. I have over 12 currency fields in the table. I am confused how to fix this issue and add a currency field to my view?
    hOW to include a reference currency fields in a view ?
    All inputs are much appreciated.
    Thanks and Regards,
    Harish

    Thank you for your responce,
    Can you please check my view and let me know where I am going wrong     
    View    Table   Field  Dataele  Data
    field                    type                                            0                                                                
    WLP01     RPSCO     WLP01     BP_WPL     CURR     15     Period value in ledger currency
    WLP02     RPSCO     WLP02     BP_WPL     CURR     15     Period value in ledger currency
    WLP03     RPSCO     WLP03     BP_WPL     CURR     15     Period value in ledger currency
    WLP04     RPSCO     WLP04     BP_WPL     CURR     15     Period value in ledger currency
    WLP05     RPSCO     WLP05     BP_WPL     CURR     15     Period value in ledger currency
    WLP06     RPSCO     WLP06     BP_WPL     CURR     15     Period value in ledger currency
    WLP07     RPSCO     WLP07     BP_WPL     CURR     15     Period value in ledger currency
    WLP08     RPSCO     WLP08     BP_WPL     CURR     15     Period value in ledger currency
    WLP09     RPSCO     WLP09     BP_WPL     CURR     15     Period value in ledger currency
    If I add a
    Table TCURC against any field what would be the view field and data element
    Do I need to tick MOD?
    Please suggest.
    Kapadia,
    If I do that its still taking all the fields are a primary keys and bringing 6 lakh records to where I originally have 49 records in a table
    Thanks and Regards,
    Harish

  • Pages:  How can I sort one column of words and not have it affect the other columns?

    How can I sort one column of words and not have it affect the other columns?  I have opened the inspector to the edit columns and rows under Table.  It will sort the column, but then it changes the other colums as well.  I know that if I use Numbers, it will work, but I want to know how to do the same thing in Pages.

    Hi Peter,
    Numbers sorts full rows on values in selected column(s). The technique for sorting a single column is essentially the same as Jerry is describing for Pages tables—separate the (data in the) column to be sorted, sort it, return it to the table.
    In Numbers the actual column may be separated from the original table, sorted, then returned. In Pages, the data must be extracted, sorted, then pasted back in, overwriting the unsorted data (if it was left in the original table).
    iWork tables follow a database model in which each row is a Record, and each column holds a Field within the records.
    As evidenced by the current question (and several similar questions arising in the Numbers community) that model doesn't apply to the way some users, especially some who come in from the MS Excel world, use tables.
    With Excels model—islands of data on a single large table, the ability to sort one or a selected few columns of data makes sense. One 'island' may comprise only cells AA21:AH50. Sorting that small 'table' should be possible without disturbing the rest of rows 21-30, which are probably part of one or more other 'data islands' in the sea that is a MS Excel spreadsheet.
    In Numbers, each of those 'islands' would be a separate Table, and that Table would be sortable without disturbing other Tables in the document.
    Regards,
    Barry

  • How can we sort records in alv, give example

    how can we sort records in alv, give example

    Hi
    <b>Setting Sort Conditions</b>
    It is possible to set sort conditions for the table data. This is achieved by filling an internal table of structure “LVC_T_SORT” which consists of the sort criteria. To have an initial sorting, pass it to the parameter “IT_SORT” of the method “set_table_for_first_display”.
    FORM prepare_sort_table CHANGING pt_sort TYPE lvc_t_sort .
    DATA ls_sort TYPE lvc_s_sort .
    ls_sort-spos = '1' .
    ls_sort-fieldname = 'CARRID' .
    ls_sort-up = 'X' . "A to Z
    ls_sort-down = space .
    APPEND ls_sort TO pt_sort .
    ls_sort-spos = '2' .
    ls_sort-fieldname = 'SEATSOCC' .
    ls_sort-up = space .
    ls_sort-down = 'X' . "Z to A
    APPEND ls_sort TO pt_sort .
    ENDFORM. " prepare_sort_table
    <b>Preparing the table for sorting settings</b>
    We have two important points to tell about this topic. First one is that, be ready for a short dump if any one of the fields given to be sorted is not in the content of the field catalog. Secondly, when you make ALV Grid to sort data, by default it vertically merges fields having the same content. To avoid from this for all of the columns, you can set “no_merging” field of the layout structure to ‘X’. If you want to disable merging for just some columns, set “no_merging” field of the field catalog row corresponding to that column.
    You can get and set sort criteria applied whenever you want by using methods “get_sort_criteria” and “set_sort_criteria”, respectively.
    <b>
    Sort Using FACTORY CLASSES</b>
    <b>Sorts – CL_SALV_SORTS</b>
    we can add some sorting to the ALV grid. Create the object reference variable and receive the object using the GET_SORTS method of the GR_TABLE object. Next, add the sort by calling the ADD_SORT method of the GR_SORTS object.
    report zalvom_demo1.
    data: ispfli type table of spfli.
    data: gr_table type ref to cl_salv_table.
    data: gr_functions type ref to cl_salv_functions.
    data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table.
    data: gr_column type ref to cl_salv_column_table.
    data: gr_sorts type ref to cl_salv_sorts.
    data: color type lvc_s_colo.
    start-of-selection.
    select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table   changing t_table = ispfli ).
    gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ).
    gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ).
    gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ).
    gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'.
    color-int = '1'.
    color-inv = '0'.
    gr_column->set_color( color ).
    gr_sorts = gr_table->get_sorts( ).
    gr_sorts->add_sort 'CITYTO' ).
    gr_table->display( ).
    Regards
    Ravish
    <b><i>
    Reward if useful to you</i></b>
    Message was edited by:
            Ravish Garg

  • How can I sort iCloud contacts by Business Name?

    I'm trying to use my phone for business. How can I sort my phone contacts in iCloud by Business Name, not First/Last or Last/First. Their needs to be selections for the business user.  More fields.  I don't want to bastardize my contact list right from the start. Did I buy the wrong phone?

    The best app out there (to sort by COMPANY NAME) that nobody knows of is  called "EasyContacts". Be sure to search for it was written in the app  store. It is money well spent. Every person I show this app to decides  to buy it. I use Card Scan still to scan business cards and then export  the contacts to Outlook. I then sync my iPhone via iTunes to read my  Outlook contacts. PERFECTION!!

Maybe you are looking for