ALV Grid display cell color based on value ( Function Module ALV )

Hi,
I want to color the cell based on value eg ( Green = Green color, Red = Red color, Amber = Yello color ).
Each and every cell is editable after displaying on screen. once the user clicks update button the contents has to be saved to a custom table.
Can anyone help?
Advance thanks

Hi,
<li>To get color for the cell, you need to set EMPHASIZE field with below information while building fieldcatalog.
emphasize (highlight columns in color)
value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
'X' = column is colored with the default column highlight color.
'Cxyz' = column is colored with a coded color:
C: Color (coding must begin with C)
x: color number
y: bold
z: inverse
<li> To edit the fields, you need to set EDIT = 'X' or INPUT= 'X' . Try those .
wa_fieldcata-input = 'X'.
<li>you need to set PF status , to do your remaining requirement.
<li>For any help, you have to search the forum .
Thanks
Venkat.O

Similar Messages

  • Find Userexit name based on Exit function module

    Hi All,
    Is there any way to find the userexit name based on the function module.
    My exit function module is EXIT_SAPLATPC_001. I want to find the exit name.
    Appreciate your help.
    Thanks,
    Jaffer Ali.S

    Hi
    This is the Exit Name: ATP00001 for the Exit FM you have given. I took the package name this exit FM is stored in the Attributes of FM in SE37. In the search criteria of SMOD,after hitting f4..and selecting Information System, I gave the package name...and it gave me the exit name.
    P.S: The above method may sometimes lead to giving in more than one exit as result.
    Vishwa.

  • ADF Table cell color based on the value in that field

    Dear All,
    I want to create a table for our new application which contains a table used to represent the data in a chart format or matrix format,
    and each cell of the table should be filled with a colour out of three colors, based on the value belongs to which range eg:(1-8 ->green, 9-20 - yellow etc),
    I dont know how to implement this. Please help...
    Ranjith

    Check this out.
    How to highlight ADF table row based on column value?
    -Arun

  • Change cell color based on time

    I have a row with 24 cells. I want each cell (from left to right) to change color based on the time. Each cell will represent 1 hour A1=Midnight, B2=1AM, etc... At those specific hours I'd like the corresponding cell to change color. So, at midnight, A1 will change from white to red. I figured I could do this with conditional formatting.
    I created a table with =NOW() and formatted it to display only the hour. I then created my 24 column row and pointed each cell in that row to that =NOW() cell. Each cell now displayed the current hour. I setup conditional formatting so that, for example, if A2=1AM (as displayed in the cell) then the formatting would change, but this didn't seem to work. I'm guessing the conditional formatting is just seeing the formula and not the value in the cell. Any thoughts here?

    There are a couple of issues involved:
    1. Conditional formatting rules compare the value in the cell to be formatted to a fixed value or to the value in another cell. If the rule says "=", then the values must be exactly the same.
    2. Date and Time values in Numbers always contain both a time component and a date component. Always. The cell may be formatted to display only the time, only the date, or both, but no matter what is displayed, the values are equal only if the complete Date and Time value is the same.
    3. "Midnight", "1AM", are text values. They will never be equal to a Date and Time value.
    So the problems are to:
    • Extract the Hour from the Date and Time value returned by NOW()
    • Convert that number to a text value in the form "9AM", "9PM", or optionally "Midnight", and I presume, "Noon"
    • Store that changeable value where it may be compared to the value in the cell to be conditionally formatted.
    • Construct the rule to format the cell(s).
    Row 1 contains a sample of the 24 cells to be formatted.
    Columns D and E, rows 2 to 25 are a LOOKUP table, where the HOUR value is looked up and the corresponding text value returned.
    F2 (highlighted with an orangeish fill) contains the formula which extracts the HOUR value from NOW(), looks it up and returns the value displayed (and to be compared).
    F2: =LOOKUP(HOUR(NOW()),D2:D25,E2:E25)
    Regards,
    Barry
    Edit: Second thought
    The LOOKUP table can be avoided using this formula in F2
    =OFFSET($A$1,0,HOUR(NOW())-15)
    The -15 at the end of the formula works for my sample table, in which column 1 (column A) is 3PM. For column A=Midnight, the shift should be -0 (or just left off).
    Message was edited by: Barry

  • Data Grid Dynamic Cell Colors

    I would like to create a Data Grid where the individual cell
    colors change based on the number in the cell.
    For example, numbers between 0 and 1 would be green, between
    1 and 2 would be yellow, and between 3 and 4 would be red.
    I am wondering if this is even possible, or if I am going to
    have to find another solution other than the data grid component.
    Not looking for a complete answer (but I'd be happy to have
    one!) but any pointing in the right direction would be great.
    I have a lot of data and coloring the cells by hand is not an
    option. I don't even know if I can change individual cell colors in
    the data grid- if it isn't possible I'd be willing to change the
    text color instead.
    Any suggestions?
    Thanks!

    Example query:
    select cust.*
    , case when credit_limit > 5000 then 'red' else 'green' end as bg_color
    from (
    select
    CUSTOMER_ID,
    CUST_FIRST_NAME,
    round(dbms_random.value(1000,9000)) as CREDIT_LIMIT
    from #OWNER#.DEMO_CUSTOMERS
    ) custIn the Column Definition of CREDIT_LIMIT, set the HTML-Expression to &lt;div style="background-color:#BG_COLOR#">#CREDIT_LIMIT#&lt;/div>
    See result : http://apex.oracle.com/pls/apex/f?p=41715:3
    You could also construct the whole html in the SQL but I like to divide logic (SQL) and UI.
    Another option could be to create a Dynamic Action (After Refresh of the report region) and create a combination of a nifty selector and piece of JavaScript, but I guess this is easier.

  • Setting colors based on values in charts

    Hello
    Can anyone please provide some information on how to set colors based on certain values in the data object in Charts. I have a pie chart and we would like to show a certain color for some values (if the data object has a value of 0, for those slices in the pie chart, we want to show Red color). I tried creating a calculated field setting some HTML using an IF expression. I am not able to select the category for this calculated field as HTML under Value Format tab. Is this something that is possible in a pie chart?
    We are using BAM 10.1.3.3
    Thanks in advance for your help.
    Raja
    Edited by: Raja Ramasamy on Aug 21, 2009 10:21 AM

    This feature is not available for charts at the moment. For list views, the way you were trying is the way to go, you will have to create a calculated field with HTML that shows a color image based on the value in any of the columns, and finally, select that calculated field as one of the fields of the report.

  • ALV Grid Traffic control Example  program implemented with function modules

    Hi Friends,
    Can any one please give me ALV Grid control traffic lights  example program implented using function modules instead of OOP ALV. It is very urgent,
    Thanks in advance,
    Santosh Kumar.

    Hi Santosh ,
    Here is a sampla code for the same
    TYPE-POOLS : SLIS.
    DATA : BEGIN OF IT_1 OCCURS 0 ,
               MATNR TYPE matnr ,
               FLAG TYPE C ,  " added for the traffic control
           END OF IT_1.
    SELECT MATNR INTO TABLE IT_1 " Select Data
    UP TO 10 ROWS
    FROM MARA.
    DATA : CATALOG TYPE SLIS_T_FIELDCAT_ALV ,
           WA_CATALOG TYPE SLIS_FIELDCAT_ALV ,
           LAYOUT TYPE SLIS_LAYOUT_ALV .
    *" create catalog
    WA_CATALOG-FIELDNAME = 'FLAG'.
    WA_CATALOG-TABNAME = 'IT_1'.
    APPEND WA_CATALOG TO CATALOG.
    WA_CATALOG-FIELDNAME = 'MATNR'.
    WA_CATALOG-TABNAME = 'IT_1'.
    APPEND WA_CATALOG TO CATALOG.
    DATA : FLAG_T TYPE I.
    *"assign value to traffic signal
    LOOP AT IT_1.
    FLAG_T = SY-TABIX MOD 2.
    IF FLAG_T = 0.
    IT_1-FLAG = '1'.
    ELSE.
    IT_1-FLAG = '2'.
    ENDIF.
    MODIFY IT_1.
    ENDLOOP.
    *"specify the traffic signal field in the layout
    LAYOUT-LIGHTS_FIELDNAME = 'FLAG'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                =
    *   I_BUFFER_ACTIVE                   = ' '
    *   I_CALLBACK_PROGRAM                = ' '
    *   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                         = LAYOUT
       IT_FIELDCAT                       = CATALOG
    *   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_ADD_FIELDCAT                   =
    *   IT_HYPERLINK                      =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    *   IT_EXCEPT_QINFO                   =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_1
    * 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.
    so rem all you need to do is add a feild in internal table for the traffic signal , assign values 0 , 1, 2 to it and last specify the name of this feild in the layout.
    Regards
    Arun

  • How to display error message in case of function module ?

    In the report i was using  " message-id "   to display error message....
    how to use in function module ?

    Hi,
    Messages in Function Modules and Methods
    Messages have two different functions in function modules and methods:
    Normal Messages
    If you use messages in function modules and methods without the RAISING addition in the MESSAGE statement, and the caller does not catch the message, the message is handled
    normally according to the context in which it is called within the function module or method.
    Triggering Exceptions with Messages
    If you use messages in function modules and methods with the addition
    ... RAISING <exc>
    the way in which the message is handled depends on whether the calling program handles the exception <exc> or not.
      If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it
    was called.
      If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Catching Message in the Calling Program
    You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the
    EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:
      Type S, I, and W messages are ignored (but logged during background processing)
      Type E and A messages trigger the exception ERROR_MESSAGE
      Type X messages trigger the usual runtime error and short dump.
    Catching messages is not currently supported for methods.
    Regards,
    Bhaskar

  • What tech. do I need just to generate PDFs based on ABAP function modules

    Hello,
    We have mySAP ERP 2005 and Enterprise Portal 7. Until know we offered employees (in the portal) to print some "reports" such as travel data and payslip. We used the functionality to convert a spool job into a PDF in this case.
    Now, we want to migrate to a more advanced way of generating the PDFs with the following advantages:
    - template based design, better maintenance thus
    - richer formatting
    - option for integrating graphics
    Our current technology is hard to maintain (mostly write() based reports...).
    We do NOT want interactive forms as discussed here - but is it the same technology to use? I heard that you need a dedicated Adobe server for this and far as I know we just have a more or less default installation of mySAP ERP 2005 plus EP7 (so adding servers or other modifications e.g. opening new network ports should be avoided...).
    When developing new PDFs, I want to go shure that we are using an up-to-date technology. I do not know if perhaps we should vote for Smartforms?
    Instead of ABAP report we have function modules, so the technology should be able to call them in any way (directly, RFC or even JCo).
    Thanks for any advice, regards,
    Timo

    Hello,
    yes the SAP Interactive Forms by Adobe is the way to go, also in case of print forms.
    The ADS can run on your existing J2EE engine, as long as it is installed on a plattform, what is released for ADS. http://service.sap.com/PAM
    Kind regards,
    Dezso

  • Generic extractor based on specific function module with delta update

    Hi everybody,
    I'm trying to create a specific extractor using a specific function module and a specific structure of record.
    In my F.M i merge record from standard table MKPF and MSEg and return the result trhu the structure.
    In initialisation mode, there's no problem . But now i'm must be able to use the DELTA mode but i don't know how to do it.
    Can somebody help me?
    Here is the code of my function module , i know it's not a standard one because i'm not using cursor but i got everything i need. The delta mode must be on creattion time of record in mkpf .
    FUNCTION z_bw_extract_mvt_sortant.
    ""Interface locale :
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SBIWA_S_INTERFACE-REQUNR
    *"     VALUE(I_ISOURCE) TYPE  SBIWA_S_INTERFACE-ISOURCE OPTIONAL
    *"     VALUE(I_DSOURCE) TYPE  SBIWA_S_INTERFACE-ISOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SBIWA_S_INTERFACE-INITFLAG OPTIONAL
    *"  TABLES
    *"      E_T_DATA STRUCTURE  ZBW_MVTSORTANT OPTIONAL
    *"      I_T_SELECT TYPE  SBIWA_T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SBIWA_T_FIELDS OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *récupération des données.
      CASE i_initflag.
        WHEN space.
          transfert_record it_mvtsor e_t_data i_maxsize.
         DESCRIBE TABLE it_mvtsor LINES sy-tfill.
         IF sy-tfill GT i_maxsize.
           APPEND LINES OF it_mvtsor FROM 1 TO i_maxsize TO e_t_data.
           DELETE it_mvtsor FROM 1 TO i_maxsize.
         ELSEIF sy-tfill GT 0.
           APPEND LINES OF it_mvtsor FROM 1 TO sy-tfill TO e_t_data.
           FREE it_mvtsor.
         ELSE.
           RAISE no_more_data.
         ENDIF.
        WHEN OTHERS.
    raffraichissement des variables de travails.
          FREE : r_werks , r_bwart , it_mkpf , it_mseg , it_mvtsor .
          CLEAR : r_werks , r_bwart , it_mkpf , it_mseg , it_mvtsor .
    récupération des paramètres.
          PERFORM set_selection_criteria TABLES i_t_select.
          PERFORM init_code_mouvement.
          SELECT * FROM mkpf
          APPENDING CORRESPONDING FIELDS OF TABLE it_mkpf.
    WHERE cpudt = sy-datum.
          CHECK NOT it_mkpf IS INITIAL.
          SELECT * FROM mseg
            APPENDING CORRESPONDING FIELDS OF TABLE it_mseg
            FOR ALL ENTRIES IN it_mkpf
            WHERE mblnr = it_mkpf-mblnr
              AND mjahr = it_mkpf-mjahr
              AND werks IN r_werks
              AND bwart IN r_bwart.
          LOOP AT it_mkpf ASSIGNING  .
            ENDLOOP.
          ENDLOOP.
      ENDCASE.
    ENDFUNCTION.
    Thanks in advance.

    Hi,
    first of all: The use of delta in a generic Datasource by FM is not supported by SAP standard. You need to change the extraction method in table ROOSOURCE from F2 to F1. There is no standard transaction to do this, you have to do a hard table update. Be careful not to change any standard datasource by error, otherwise you can get serious problems.
    The interface for the FM will change with the new extraction method. You will need a new parameter I_UPDMODE of type SBIWA_S_INTERFACE-UPDMODE to distinguish between Init, Delta and Full Load.
    For an example coding please refer to FM RSVD_BW_GET_DELTA_DATA.
    Hope that helps
    Stephan
    Message was edited by: Stephan Müller

  • Crystal Reports Based on SAP Function Module and Transperant Tables

    Hi,
    I need to develop reports based on SAP trasperant tables and to filter the records I require to use one of the function module in SAP.
    I have created parameters in Crystal reports that are required for the function to execute and are included in the where clause of the query. This helped the fuction to get those parameters and execute it.
    The thing is that the fuction works fine with one set of parameters and gives accurate results both in SAP and Crystal Reports.
    But fails for other set of parameters.
    It works fine when we directly execute function in SAP produces a record set. But, when we pass those parameters from Crystal Reports it fetches no data.
    Can anybody tell me the exact procedure to use function module and transperent tables together in Crystal Reports ?
    Thanks in Advance.
    Niwas Joshi

    Hi,
    This is going to be hard to explain, however you need to recognize that the function has input and possibly output (export) parameters.  Crystal Reports is able to work with these parameters.  However it is up to you to figure out how these parameters are used effectively to give you the correct results when joining the function with other data sources such as transparent tables.
    If you're using transparent tables and functions in a Crystal Report, then you need to link these objects in such a way so that a left outer join for example is using the function's output parameters to join to the transparent table equivalent fields.  However if the table is the starting point then the joins from the table should join the Input parameters of your function.
    you can set these joins in the Database menu | Database Expert | Links of Crystal Reports.

  • JTable cell color overriding Boolean values displayed as checkboxes. Fix?

    I have a JTable column of Boolean values that automatically appear as checkboxes. When I apply my DefaultTableCellRenderer to this column, the checkbox disappears and a "false" or "true" appears instead. But if I mouseclick on the cell, the checkbox will appear momentarily.
    Any suggestions for getting the Boolean value displayed as a checkbox and seeing my colors change? (I suppose the easy way is using JCheckBox, but I'm curious if I can do it using Boolean)
    Thanks for the help. Code follows for the cell renderer.
    class ColorRenderer extends DefaultTableCellRenderer{
    public ColorRenderer() {
    super();
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected == true) {
      setBackground(Color.getHSBColor(100, 100, 1));
      setForeground(Color.BLACK);
    } else {
      setBackground(Color.LIGHT_GRAY);
      setForeground(Color.WHITE);
    if (hasFocus == true) {
      setBackground(Color.RED);
      setForeground(Color.WHITE);
    setOpaque(true);
    setValue(value);
    return this;

    Wouldn't extend DefaultTableCellRenderer as that extends a JLabel
    I would extend a JCheckBox and implement TableCellRenderer.

  • Display as Text page items - How to change color based on Value

    Hi,
    I have a bunch of page items that I would like to display in red if they contain a minus "-" sign. My guess is that this can be done with a template. Right now they are using the Optional Label with Help template. How might I elegantly specify to display a red font if the text contains a minus sign?
    I have done this before with report regions which include conditions and I just tagged a condition to a column template and I am looking to do something similar.
    Thanks!

    You haven't had a response... I was wondering if you could answer the question I posed of where are the "Display As" templates?
    It seems that there is nothing on the forum or WEB about them. They must be in a CSS sheet somewhere, but I don't even have access to those folders at work.
    I exported a "theme" and started to look through the sql code that created the CSS file (at least that is what I think it does) but it is about 170k and it is slow reading... I have tried searching on several key words but no luck yet.
    I appreciate any insights you have. It seems to me that the display as templates would provide some real cool features...
    turn negative numbers red
    gray out non-updateable fields
    The look and feel that would meet a design standard for a specific company...
    Best of luck,
    Sam

  • How to set background color based on values in column grouping

    Hello,
    I have query
    select 1 as CustomerID,'Reality' as Type, 100 as Turnover
    UNION
    select 1 as CustomerID,'Budget' as Type, 120 as Turnover
    UNION
    select 2 as CustomerID,'Reality' as Type, 140 as Turnover
    UNION
    select 2 as CustomerID,'Budget' as Type, 120 as Turnover
    I have matrix, where in rows are customers, there is columngroup based on field Type and in details are summaries of Turnover. I need to change background color of Reality field, when lower than Budget. How can I do that please ?

    Hi volyn,
    After testing the issue in my own environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    DIM PreviousValue AS Decimal
    Dim CustomerID AS String = ""
    Public Function  GetPreviousValue(byval Val as Decimal, byval CusID as string)  as Decimal
    DIM Local_PreviousValue AS Decimal
    IF CustomerID <> CusID THEN
    CustomerID  = CusID 
    PreviousValue  = val
    Local_PreviousValue  = 0
    ELSE
    Local_PreviousValue =  val - PreviousValue 
    PreviousValue  = val
    END IF
    return Local_PreviousValue 
    End function
    Click the cell which contains [Sum(Turnover)] value, modify the expression of BackgroundColor property to like this in the Properties Window: 
    =iif(Code.GetPreviousValue(Fields!Turnover.Value,Fields!CustomerID.Value)<0,"Brown","White")
    In this scenario, you can change Brown color to any color you like. The following screenshot is for your reference (I added some data to make it more clearly):
    If you have any other questions, please feel free to ask.
    Thanks, 
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Is it possible to make a cell disabled based on value in WD4A

    This is a question related to Webdynpro in ABAP programming. I am trying to set a particular cell in my ALV(in WD4A) to non-editable based on the value of that particular cell. Is this possible to do this programmatically?
    If anybody has done this, please share info.
    Thanks,
    Padmaja

    Then ask this question in the correct forum.

Maybe you are looking for

  • Report including open purchase order quantity for one storage location

    Hello gurus, I am looking for a report giving me the total/available stock and the open purchase order quantity for all materials stored in a certain storage location. I.e. like this: Plant 0001, storage loc. 01 Material        stock        open purc

  • LO 26315 - ODBC Drivers issue while generating LO Document

    Hello folks, LO 26315 - We got this error code while we were trying to generate a live office document on Universe ( Built on SQL Server with ODBC Connectivity) The complete error message was " Failed to get the document information (LO 26315) Databa

  • How to make movie credits on motion

    I need to do a typical movie credit reel where the names scroll from bottom to top and i need it to stretch out over about 2 minutes. I have tried live type, but it freezes too much and wont do exactly what i need. I hear motion is so much better, bu

  • Tree grid not expanding in SharePoint 2013.

    I have written a code using TB.Web.UI.TreeGrid.dll to represent data in tree grid in ShaarePoint 2010. and we have moved to 2013 with same code tree grid stop expanding giving me following Javascript error.Please suggest. TypeError: tr.style is undef

  • Can no longer scroll after download to firefox 5

    I can't vertically scroll since downloading firefox 5 from 3.6.18'''bold text'''