Hiding zero in ALV(Particular Row/Column alone)

I use ALV Grid  for displaying the output in the tabular form. It has one key field and 4 numeric fields. Always it will have only 7 rows. Now I should not display 0 if the row 4 does not have any values(Since it is a numeric field, by default zero will come). Rest of the rows should contain zero value if there is no value.
If I should not display zero for all the rows, then I can simply pass no_zero = u2018Xu2019 in the field catalog. But this should happen only for the particular row (4th row alone). Please advise me.

Hi Selva,
I am posting a example code, in this some paticular cells of ALV Grid are in editable mode. just analyse this example this may help you..
FORM build_fieldcatalog.
  wa_fieldcat-fieldname   = 'EBELN'.
  wa_fieldcat-scrtext_m   = 'Purchase Order'.
  wa_fieldcat-col_pos     = 0.
  wa_fieldcat-outputlen   = 10.
  wa_fieldcat-emphasize   = 'X'.
  wa_fieldcat-key         = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR  wa_fieldcat.
  wa_fieldcat-fieldname   = 'EBELP'.
  wa_fieldcat-scrtext_m   = 'PO Item'.
  wa_fieldcat-col_pos     = 1.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR  wa_fieldcat.
  wa_fieldcat-fieldname   = 'MEINS'.
  wa_fieldcat-scrtext_m   = 'Order Unit'.
  wa_fieldcat-col_pos     = 6.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR  wa_fieldcat.
  wa_fieldcat-fieldname   = 'NETPR'.
  wa_fieldcat-scrtext_m   = 'Net Price'.
  wa_fieldcat-edit        = 'X'. "sets whole column to be editable
  wa_fieldcat-col_pos     = 7.
  wa_fieldcat-outputlen   = 15.
  wa_fieldcat-datatype     = 'CURR'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR  wa_fieldcat.
  wa_fieldcat-fieldname   = 'PEINH'.
  wa_fieldcat-scrtext_m   = 'Price Unit'.
  wa_fieldcat-col_pos     = 8.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR  wa_fieldcat.
ENDFORM.                    " BUILD_FIELDCATALOG
FORM build_layout.
* Set layout field for field attributes(i.e. input/output)
  gd_layout-stylefname = 'FIELD_STYLE'.
  gd_layout-zebra             = 'X'.
ENDFORM.                    " BUILD_LAYOUT
FORM display_alv_report.
  gd_repid = sy-repid.
*  call function 'REUSE_ALV_GRID_DISPLAY'
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
       EXPORTING
            i_callback_program      = gd_repid
            i_callback_user_command =  USER_COMMAND
            is_layout_lvc               = gd_layout
            it_fieldcat_lvc             = it_fieldcat
            i_save                  = 'X'
       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.
  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 set_specific_field_attributes .
  DATA ls_stylerow TYPE lvc_s_styl .
  DATA lt_styletab TYPE lvc_t_styl .
" Populate style variable (FIELD_STYLE) with style properties
" The NETPR field/column has been set to editable in the fieldcatalog...
" The following code sets it to be disabled(display only) if 'NETPR'
" is gt than 10.
  LOOP AT it_ekko INTO wa_ekko.
    IF wa_ekko-netpr GT 10.
      ls_stylerow-fieldname = 'NETPR' .
      ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                             "set field to disabled
      APPEND ls_stylerow  TO wa_ekko-field_style.
      MODIFY it_ekko FROM wa_ekko.
    ENDIF.
  ENDLOOP.
endform.                    " set_specific_field_attributes
FORM USER_COMMAND.
CASE SY-UCOMM.
   WHEN 'ENTER'.
   ENDCASE.
  ENDFORM.
Regards,
Murthy

Similar Messages

  • Hierarchical ALV - enabling row/column input

    Hello,
    I'm going to incoporate the hierarchical ALV in a report.  Let's say I have 5 item rows for a header row, is it possible to make individiual rows input enabled?  Meaning, of the 5 item rows, I wish to make two of them editable, but not the other three. 
    I've done the standard ALV and made columns input enabled when building the fieldcat, but this applied to all rows, which I don't want in my scenario.
    Any help would be appreciated.
    Thanks

    Hello,
    Input enable is a parameter of fieldcat but you have to specify the internal table that you used in header row or item row.
    You create a data ZHEAD and ZITEM that you transfer in fieldcat data "table"
    Don't forget the clear when youo fill this internal table
    Regards
    sebastien

  • How to alv grid rows&columns

    Hey,
    How to know number of rows and columns in alv grid are used.

    Hi,
    You can count the number of rows , by using describe statemet,
    describe table itab lines v_lines.
    itab is table used to display in ALV
    Thanks & Regards,
    Navneeth K.

  • Change the color of a particular row in a jtable

    I have a jtable and i want to change the color of one particular column and few rows to blue and underline the text depending on some condition. In my view class if a condition is true
    for( count=0;count<grdTest.getRowcount;count++)
    if(some condition true)
    grdTest.getColumnModel().getColumn(0).
    setCellRenderer(new MyTestCellRenderer(count));
    And my cell renderer
    public class MyTestCellRenderer extends DefaultTableCellRenderer {
    int rowIndex=-1;
    public MyTestCellRenderer(int rowcount) {
    super();
    rowIndex=rowcount;
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value,
    isSelected, hasFocus, row, column);
    if(row == rowIndex)
    setText("<html> <u> <font color='blue'>" + value.toString());
    return this;
    This is behaving very wierd . If suppose there are 50 rows and all of them have the condition true then only the last one in the row color is changes.
    However if only one out othe say10 has the condition true then it changes the color and underlines the particular row,column.
    Is there any other way to do this or what i am doing wrong
    Thanks

    if(row == rowIndex)Your code is a shambles because of the lack of tags, but I don't believe I see anything being called when this boolean condition is not true. That would be a problem.                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to disable a particular row in a JTable

    How can a disable only a particular row/column in a JTable.
    I am trying to create an XML Notepad type of application for which I need the row which contains the root element or any element which has a child element to be disabled. How can I achieve this??
    I would be grateful for replies.

    Hi,
    Create your own class which extends TableModel and in that class u override the method
    public boolean isCellEditable( int row, int col)
    As u know the row and col which u want to disable hard code those values in the method.
    Like
    public boolean isCellEditable( int row, int col)
    if( row == 2 and col == 1 )
    return false
    else
    return true
    Hopefully this provides u with a solution.
    Cheers :)
    Nagaraj

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • Hiding a particular row in ALV

    Hi can anyone please tell me how to hide a particular row in ALV grid display depending upon certain value

    Actually iam displaying values of an consignment idoc in the ALV grid but i don't want to display a particular segment of that idoc in ALV.Like i have an idoc with E1MBXYH segment and E1MBXYI segment sometimes this E1MBXYI segment will have ZSADATI segment.In this case i want to hide zsadati segment in ALV but
    i need some values in ZSADATI segment so i just want to hide it.Can you please help me

  • How to delete a particular row in ALV table

    Hi,
    How to delete a particular row in ALV table based on some condition(by checking value for one of the columns in a row)
    Thanks
    Bala Duvvuri

    Hello Bala,
    Can you please be a bit more clear as to how you intend to delete the rows from your ALV? By the way deleting rows from an ALV is no different from deleting rows from a normal table. Suppose you have enabled selection property in ALV & then select multiple rows and click up on a button to delete the rows then below would be the coding: (Also keep in mind that you would have to maintain the Selection property of the context node that you are binding to your ALV to 0..n)
    data : lr_table_settings  TYPE REF TO if_salv_wd_table_settings,
                 lr_config          TYPE REF TO cl_salv_wd_config_table.
      lr_table_settings  ?= lr_config.
    ** Setting the ALV selection to multiple selection with no lead selection
      lr_table_settings->set_selection_mode( value = cl_wd_table=>e_selection_mode-multi_no_lead ).
    Next delete the selected rows in the action triggered by the button:
    METHOD onactiondelete_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             lt_node1 TYPE ig_componentcontroller=>elements_node,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set,
             row_number TYPE i VALUE 0.
      wd_node = wd_context->get_child_node( name = 'NODE' ).
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
      LOOP AT lt_temp INTO wa_temp.
        wd_node->remove_element( EXPORTING element = wa_temp ).
      ENDLOOP.
      CALL METHOD wd_node->get_static_attributes_table
        EXPORTING
          from  = 1
          to    = 2147483647
        IMPORTING
          table = lt_node1.
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.
    If in case this isn't your requirement please do let me know so that I can try come up with another analysis.
    Regards,
    Uday

  • How to print the row  ,column,and particular cell in separate color

    how to print the row  ,column,and particular cell in separate color IN ALV GRID

    HI,
    Here you go good program links
    <a href="http://www.sapfans.com/forums/viewtopic.php?t=52107">How to Set Color to a Cell in AVL</a>
    <a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm">ALV Grid Coloring</a>
    Thanks
    Mahesh

  • Grey out a particular row in ALV based on some condition.

    Hi All,
    How can we grey out the particular row in ALV based on some condition( I am using the function modules and not OOPS).
    Regards
    Ramesh.

    Hello Ramesh
    In this case you need to add a specific field to your structure:
    TYPES: BEGIN OF ty_s_outtab.
    INLCUDE TYPE <my table or structure>.
    TYPES: CELLTAB   TYPE lvc_t_styl.  " name is arbitrary but this one is most frequently used
    TYPES: END OF ty_s_outtab.
    DATA: gt_outtab  TYPE STANDARD TABLE OF ty_s_outtab
                                 WITH DEFAULT KEY.
    You can use the fieldcatalog to make an entire column non-editable (LVC_S_FCAT-EDIT = ' ' ).
    However, in case of rows you need to inactivate all cells of this row. For sample coding please refer to thread:
    How to conditionally set ALV field as hotspot
    Regards
      Uwe

  • Making a particular row input enabled in ALV grid

    I am using set_table_for_first_display Method of class cl_gui_alv_grid in order to display the ALV table control.i want one whole column(flag) to be input enabled all the time.so i have defined in FCAT for that column EDIT as X.Now i have defined a custom toolbar button SAVE using  handle_toolbar. My requirement is when the user inputs M in the flag column of a particular row and press SAVE button that row should be made input enabled. i have used method set_ready_for_input in the handle_user_command  FOR go_grid, but it is not working.Please help.Thanks in advance.

    done..

  • Deactivate the double click/ hot spot for a particular row in alv grid.

    Hello,
       As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
    Regards,
    Saroj

    where u define layout there is a field hotspot.like
    data: var.
    if con is true
    var = 'X'. (show hotspot)
    else.
    var = ' '. (deactive hotspot)
    elseif ws_fieldcat-fieldname = 'DMBTR'
                    AND ws_fieldcat-tabname = 'T_MTAB'.
          ws_fieldcat-do_sum = C_X.
          <b>ws_fieldcat-hotsopts = var.</b>
          MODIFY Wt_fieldcat FROM ws_fieldcat
                  TRANSPORTING   DO_SUM.
    It is helpful for u. if any problen send me ur coding i will change it.
    Regards
    Manish Kumar

  • Updating the particular row and column in a JTable

    Hi,
    I have a JTable which is having fixed number of columns. When i am trying to update a particular cell in the table
    during programm execution i am not able to do it.
    I am getting the row number and column number correctly. But when i am going to set the data it is not setting at the same row. It is setting some other row according to the m_index (according to the sorting).
    i am doing :
    JTableModel model = (JTableModel) m_TablePan.getTableModel();
    model.setValueAt(savedData, row, column);

    See the convertXxxIndexToView and convertXxxIndexToModel methods.
    db
    Edited by: Darryl.Burke -- wrong methods suggested
    Edit2: Evidently lipumama doesn't follow up on many questions posted.
    One for the blacklist.

  • Searching for a string in the xml present in a particular row and column.

    Hi All,
    We have a table in which in one of the column a complete payload xml is getting stored.
    Is there any way to search for a particular string in the stored xml of a particular row?
    Thanks in Advance,
    Bob

    Here is a simple example of what Blu is saying
    I have create a table temp_dept like this
    SQL> desc temp_dept
    Name                          Null?    Type
    DEPTNO                                 NUMBER
    DNAME                                  VARCHAR2(10)
    LOC                                    VARCHAR2(8)
    EMP_XML                                XMLTYPE
    I have loaded employee detail from emp table into emp_xml as xml data. here is a sample
    SQL> select * from temp_dept;
        DEPTNO DNAME      LOC      EMP_XML
            10 ACCOUNTING NEW YORK <?xml version="1.0"?>
                                   <ROWSET>
                                    <ROW>
                                     <EMPNO>7782</EMPNO>
                                     <ENAME>CLARK</ENAM
            20 RESEARCH   DALLAS   <?xml version="1.0"?>
                                   <ROWSET>
                                    <ROW>
                                     <EMPNO>7369</EMPNO>
                                     <ENAME>SMITH</ENAM
            30 SALES      CHICAGO  <?xml version="1.0"?>
                                   <ROWSET>
                                    <ROW>
                                     <EMPNO>7499</EMPNO>
                                     <ENAME>ALLEN</ENAM
    Now i can convert the emp_xml into a table and query like this
    SQL> select d.deptno
      2       , d.dname
      3       , d.loc
      4       , e.*
      5    from temp_dept d
      6       , xmltable
      7         (
      8              '/ROWSET/ROW' passing d.emp_xml
      9              columns empno          number        path 'EMPNO'
    10                    , ename          varchar2(100) path 'ENAME'
    11                    , job            varchar2(100) path 'JOB'
    12                    , mgr            number        path 'MGR'
    13                    , hiredate       varchar2(100) path 'HIREDATE'
    14                    , sal            number        PATH 'SAL'
    15                    , com            number        PATH 'COM'
    16         ) e
    17  /
        DEPTNO DNAME      LOC           EMPNO ENAME      JOB               MGR HIREDATE          SAL     COM
            10 ACCOUNTING NEW YORK       7782 CLARK      MANAGER          7839 09-JUN-81        2450          0
            10 ACCOUNTING NEW YORK       7839 KING       PRESIDENT             17-NOV-81        5000          0
            20 RESEARCH   DALLAS         7369 SMITH      CLERK            7902 02-APR-81        2975          0
            20 RESEARCH   DALLAS         7566 JONES      MANAGER          7839 02-APR-81        2975          0
            20 RESEARCH   DALLAS         7788 SCOTT      ANALYST          7566 19-APR-87        3000          0
            20 RESEARCH   DALLAS         7876 ADAMS      CLERK            7788 23-MAY-87        1100          0
            30 SALES      CHICAGO        7499 ALLEN      SALESMAN         7698 20-FEB-81        1600        300
            30 SALES      CHICAGO        7521 WARD       SALESMAN         7698 22-FEB-81        1250        500
            30 SALES      CHICAGO        7654 MARTIN     SALESMAN         7698 28-SEP-81        1250       1400
            30 SALES      CHICAGO        7698 BLAKE      MANAGER          7839 01-MAY-81        2850          0
            30 SALES      CHICAGO        7844 TURNER     SALESMAN         7698 08-SEP-81        1500          0
    11 rows selected.
    SQL>
    You can apply filter for the necessary value that you are searching.

  • Changing font size(bold) or color of a particular row in ALV Grid Digplay

    Hi Experts ,
    I am having a requirment to highlight some particular rows in ALV Grid Display . To achieve this i need to change font size or make it bold or change color of that row .
    Please give me some inputs .
    Thanks in Advance.
    Vijyeta

    Hi
    Coloring An Entire Row
    Coloring a row is a bit (really a bit) more complicated. , you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row.
    First you have to declaration of our list data table u201Cgt_listu201D.
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA END OF gt_list .
    Adding the field that will contain row color data
    As you guess, you should fill the color code to this field.  But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field u201CINFO_FNAMEu201D of the layout structure.
    e.g.
    ps_layout-info_fname = <field_name_containing_color_codes>. u201Ce.g. u2018ROWCOLORu2019
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    Try this link also:
    Possible functionalities in ALV
    Regards
    Neha

Maybe you are looking for