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

Similar Messages

  • Grey out(disable) a row in ALV grid

    Hi,
    I want to know how to grey out(disable) row wise in ALV grid display.
    i..e.. Few rows in ALV grid display shoud be editable and few rows non editable based on certain condition.
    How do we do that....Please help.
    Thanks in advance.

    Hi,
    Since fieldcatalog is used to modify coloum and not the row, the fieldcatalog would not solve the problem.
    Thankyou.

  • Edit One Cell In Alvs Based On Some Condition

    Hi Experts,
          My Requirement Is  :
    Has To *Edit one cell using alv grid *, for ex: If  Netpr > 100(value). that should be in editable mode,rest of the cells  in non-editable mode. pls let me know how to do it,
    best answer rewarded
    Reagrds,
    Fareedas.

    Hi Fareedas,
    The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10). Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this field with style attribute and adding an entry to layout control table. Also from the previous examples used on this website you will also need to change the data type of the fieldcatalog, the layout and use a different function module for displaying the report
    *& Report  ZDEMO_ALVGRID_EDIT                                          *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display specific fields as          *
    *& editable depending on field value                                   *
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      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,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    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.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    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   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      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
    *       Build layout for ALV grid report
    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
    *       Display report using ALV grid
    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
    *       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  set_specific_field_attributes
    *       populate FIELD_STYLE table with specific field attributes
    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
    Check the above code.
    For a sample code using ABAP OO check the program BCALV_EDIT_02.
    Hope this helps.
    Rwd points if helpful.
    Thanks,
    Balaji

  • 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

  • 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

  • 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

  • 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

  • Greying out the particular field of active group

    hi guru's
    we have requirement of greying out a particular field of active screen group
    say for eg:
    LOOP AT SCREEN.
        if screen-group1 EQ 'PUR' OR screen-group1 EQ 'SAL' OR screen-group1 EQ 'FIN'.
          screen-input = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
      if rb_md EQ 'X'.
        LOOP AT SCREEN.
          if screen-group1 EQ 'PUR' OR screen-group1 EQ 'SAL' OR screen-group1 EQ 'FIN'.
            screen-input = 0.
          ELSEIF screen-group1 EQ 'MAS'.
            screen-input = 1.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ELSEIF rb_td EQ 'X'.
        LOOP AT SCREEN.
          If screen-group1 EQ 'MAS'.
            screen-input = 0.
          Endif.
          MODIFY SCREEN.
        ENDLOOP.
        if rb_pur EQ 'X'.
          LOOP AT SCREEN.
            if screen-group1 EQ 'SAL' OR screen-group1 EQ 'FIN'.
              screen-input = 0.
            ELSEIF screen-group1 EQ 'PUR'.
              screen-input = 1.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ELSEif rb_sal EQ 'X'.
          LOOP AT SCREEN.
            if screen-group1 EQ 'PUR' OR screen-group1 EQ 'FIN'.
              screen-input = 0.
            ELSEIF screen-group1 EQ 'SAL'.
              screen-input = 1.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ELSEif rb_fin EQ 'X'.
          LOOP AT SCREEN.
            if screen-group1 EQ 'SAL' OR screen-group1 EQ 'PUR'.
              screen-input = 0.
            ELSEIF screen-group1 EQ 'FIN'.
              screen-input = 1.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ENDIF.
      ENDIF.
    in the above code
    say for eg: the active group is 'SAL' in which i want to grey out one field say as parameter p_doc as invisible always
    what i need to do
    with regards
    s.janagar

    hi
    may be this code can help you:
    selection-screen begin of block b1 with frame title text-001.
    parameters : p1  radiobutton group r1 default 'X' user-command ac,
                         p2  radiobutton group r1,
    selection-screen end of block b1 .
    selection-screen begin of block b2 with frame title text-002.
    select-options : p_eg for mara-matnr modif id SAL
    parameters : p_doc  like mara-matnr modif id PUR.
    selection-screen end of block b2.
    at selection-screen output.
      if p1 = 'X'.
        loop at screen.
          if screen-group1    = 'SAL'.
            screen-input     = '0'.
            screen-invisible = '1'.
            modify screen.
          endif.
        endloop.
      elseif p2 = 'X'.
        loop at screen.
          if screen-group1    = 'PUR.
            screen-input     = '0'.
            screen-invisible = '1'.
            modify screen.
          endif.
        endloop.
      endif.

  • I buy extension from adobe online, i installed it correctly but then the extension menu was greyed out and i can't click it. Some help please.

    I buy extension from adobe online, i installed it correctly but then the extension menu was greyed out and i can't click it. Some help please.

    hello ptbruce, you probably only selected to open (not save) the video which will download it into windows temporary folder where it gets deleted again after it has been used. <br>you could try to right-click the entry in the firefox download manager and copy the link of the source file and try if you can download it through this url again. otherwise you'll have to contact the vendor of the video to find a solution...

  • HT1695 Wi Fi option greys out in my new I phone 4s or some times my phone cannot scan for wi fi . How can I rectify it?

    Wi Fi option greys out in my new I phone 4s or some times my phone cannot scan for wi fi . How can I rectify it?

    read http://support.apple.com/kb/ts1559

  • Display Image(which set as behind text)   based on some condition.

    hi all
    I have developed a xml report and in that rtf am displaying a static image (which is set as behin text).
    But i need to display the image based on some condition
    for example i have a field as ORG_ID
    if org_id=87 then image should display for that purpose am planning to use <?if:ORG_ID=87?> condition but where to place this condition for the image.
    kindly help me
    thanks for all in advance.

    that too not working because
    on image am displaying some other fields.
    see i think you didn't get my point.
    in my out put page am displaying item details ,quantity,and cost and customer details just like invoice copy .
    behind this data am displaying my company logo which will capture whole page size..
    if i place the image in table then fields will be automatically in table so i cant restrict image in this way.
    Kindly suggest any other way that works only for image which is behind text. i mean condition should be applicable only for image and leaving all other fileds in rtf.
    or
    help on this how to set a dynamic image as behind the text.
    Edited by: maddy on Nov 28, 2012 7:32 AM
    Edited by: maddy on Nov 28, 2012 7:35 AM

  • Display an exception based on some condition

    HI..
    how to run a exception based on some condition i.e
    i want to highlight the sales(key figure) which r less than the  average sales..
    where sales and average sales r keyfigures...

    Hi!
    welcome to SDN.
    create a calculated key figure which will be 1 if the sales is less then the average sales.
    create exception based on this calculated key figure.
    with regard
    ashwin
    <i>PS n: Assigning point to the helpful answers is the way of saying thanks in SDN.  you can assign points by clicking on the appropriate radio button displayed next to the answers for your question. yellow for 2, green for 6 points(2)and blue for 10 points and to close the question and marked as problem solved. closing the threads which has a solution will help the members to deal with open issues with out wasting time on problems which has a solution and also to the people who encounter the same porblem in future. This is just to give you information as you are a new user.</i>

  • How to dynamically add/remove a button from the ribbon based on some condition? (Ribbon XML)

    Hi,
    I have a ribbon (done using ribbon XML) with menu options. I need to remove few buttons from the menu dynamically based on some condition. Also, I want to change the label of another button. How to achieve this programmatically? (C#)
    Thanks in advance.
    Thanks Prasad

    Hello Prasad,
    Use callbacks for populating Ribbon controls such as menu, dropDown, gallery and etc. Then you can use the
    Invalidate or
    InvalidateControl methods of the
    IRibbonUI interface to get your callbacks invoked when required. Thus, you will be able to delete the required item(s).
    You will find the following articles in MSDN helpful:
    Chapter 11: Creating Dynamic Ribbon Customizations (1 of 2)
    Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)
    To change the label of your controls at runtime you need to use the getLabel callback and call the Invalidate or InvalidateControl methods of the IRibbonUI interface. The following series of articles describe the Fluent UI in depth:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

  • How to make a region mandatory based on some conditions using CO Extension?

    Dear All,
    I want to make Attachments region in a seeded page mandatory, based on some conditions. I am able to make fields mandatory using CO Extension, but i am not able to make the attachments region mandatory. Please help.
    Thanks
    Raj

    Raj,
    I have not tried but check if you could get the rowcount which shows how many attachment are upload or not. Then by checking this throw exception if the rowcount is o.
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • Calling a window in sapscript based on some conditions

    Hi all,
    I want to call a window in SAPScript based on some conditions.Plz suggest how could i do that.
    Regards,
    Chinmay.

    Hi,
    Use a text element in that window.
    ie..
    /E  TEXT
    &VBAK-VBELN&
    in ur driver program
    if vbak-vbeln is not initial. ( your condition)
    call function 'write_form'
    element = 'TEXT'
    window = 'WINDOW_NAME'
    Endif.
    hope this helps
    santhosh

Maybe you are looking for

  • Getting all mail from a gmail account

    I am trying to download all my old emails from an gmail account via thunderbird. The main reason is for backup. The problem is that each time I push on GET MESSAGES it only downloads a few mails. I need to wait till it ends and then click again and s

  • How to assgn charge head with GL and Sales order

    Dear Exparts' I am a new user of SD module .I have created a charge head but stuck in GL assignment and Assign the charge head with Sales order.(sales order is already created) Can any one tell me any direct transaction code or SPRO for the said prob

  • Best practice for OSB to OSB communication

    Cross posting this message: I am currently in a project where we have two OSB that have to communicate. The OSBs are located in different security zones ("internal" and "secure"). All communication on a network level must be initiated from the secure

  • BATCH JOB GETTING FAILED DUE TO WARNING MESSAGE

    Hi, Our background job is getting failed if we are having warning meesage , why it is happening , could any one provide inputs . In bacground it's considering Warning message as Error message .

  • [Solved]fbpanel won't read the right profile

    I created a new user in my system named larry and wanted to launch fbpanel for this user, so i issued fbpanel --configure but it failed stating "Cant open /home/chucky/.config/fbpanel default profile" i even tried fbpanel -p default but i got the sam