How to color a specific cell in ALV (not REUSE_ALV_GRID_DISPLAY)

Hi
I want to change color font or background to a specify position in ALV grid
It is possible but by creating ALV container (not FM for example REUSE_ALV_GRID_DISPLAY)?

Hi,
REPORT ZALV_LIST1.
TABLES:
SPFLI.
TYPE-POOLS:
SLIS.
PARAMETERS:
P_COL TYPE I ,
P_ROW TYPE I,
P_COLOR(4) TYPE C .
DATA:
T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,
W_COLOR(4) ,
W_ROW TYPE I,
W_FIELDNAME(20),
W_PROG TYPE SY-REPID.
DATA:
BEGIN OF T_SPFLI OCCURS 0,
COLOR(4),
CHECKBOX ,
CELL TYPE SLIS_T_SPECIALCOL_ALV,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
CITYFROM TYPE SPFLI-CITYFROM,
CITYTO TYPE SPFLI-CITYTO,
DISTANCE TYPE SPFLI-DISTANCE,
END OF T_SPFLI.
DATA:
FS_CELL LIKE LINE OF T_SPFLI-CELL.
SELECT *
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
W_COLOR = P_COLOR.
T_SPFLI-COLOR = P_COLOR.
IF P_COL IS INITIAL AND P_ROW GT 0.
MODIFY T_SPFLI INDEX P_ROW TRANSPORTING COLOR.
ENDIF.
FS_FIELDCAT-FIELDNAME = 'CARRID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 1.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-HOTSPOT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'CONNID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 2.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-HOTSPOT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 3.
FS_FIELDCAT-KEY = ' '.
FS_FIELDCAT-EDIT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
FS_FIELDCAT-FIELDNAME = 'CITYFROM'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 4.
FS_FIELDCAT-KEY = ' '.
APPEND FS_FIELDCAT TO T_FIELDCAT.
LOOP AT T_FIELDCAT INTO FS_FIELDCAT.
IF FS_FIELDCAT-COL_POS EQ P_COL.
FS_FIELDCAT-EMPHASIZE = P_COLOR.
W_FIELDNAME = FS_FIELDCAT-FIELDNAME.
IF P_ROW IS INITIAL AND P_COL GT 0.
MODIFY T_FIELDCAT FROM FS_FIELDCAT TRANSPORTING EMPHASIZE.
ENDIF.
ENDIF.
ENDLOOP.
FS_CELL-FIELDNAME = W_FIELDNAME .
FS_CELL-COLOR-COL = 6.
FS_CELL-NOKEYCOL = 'X'.
APPEND FS_CELL TO T_SPFLI-CELL.
IF P_ROW IS NOT INITIAL AND P_COL IS NOT INITIAL.
MODIFY T_SPFLI INDEX P_ROW TRANSPORTING CELL.
ENDIF.
FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.
FS_LAYOUT-F2CODE = '&ETA'.
W_PROG = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
IS_LAYOUT = FS_LAYOUT
IT_FIELDCAT = T_FIELDCAT
TABLES
T_OUTTAB = T_SPFLI
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2

Similar Messages

  • How to color a particular cell in ALV.

    hi,
       I have a requirement where i need to select a particular cell of a column in ALV and upon selection , i need to change the color of the selected cell. I choose the color from the dropdown toolbar created by me.
    plz help, thanks.

       REPORT  ZTEST_DHR.
    TYPE-POOLS : SLIS.
    TYPES: BEGIN OF TY_MARA,
            FLAG  TYPE CHAR1,
            MATNR TYPE MARA-MATNR,
            ERSDA TYPE MARA-ERSDA,
            ERNAM TYPE MARA-ERNAM,
            WESCH TYPE MARA-WESCH,
            STYLE TYPE LVC_T_STYL,
            CELLCOLR TYPE LVC_T_SCOL,
          END OF TY_MARA.
    DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA.
    DATA : IT_MARA1 TYPE STANDARD TABLE OF TY_MARA,
           WA_MARA TYPE TY_MARA,
           WA_MARA1 TYPE TY_MARA.
    * for reuse alv grid display
    *DATA : IT_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
    *        WA_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,
    *        WA_LAYOUT       TYPE SLIS_LAYOUT_ALV,
    *        GV_REPID      TYPE SY-REPID.
    *for LVC Display
    DATA : WA_SETTINGS TYPE LVC_S_GLAY.
    DATA : WA_LAYOUT TYPE LVC_S_LAYO.
    DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT,
            WA_FIELDCATALOG TYPE LVC_S_FCAT.
    DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    DATA : LS_CELL_COLOR TYPE LVC_S_SCOL.
    DATA : LT_CELL_COLOR TYPE LVC_T_SCOL.
    START-OF-SELECTION.
      SELECT MATNR ERSDA ERNAM WESCH
        FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
      UP TO 10 ROWS.
    END-OF-SELECTION.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_LAYOUT.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATALOG
    *       text
    FORM BUILD_FIELDCATALOG .
      WA_FIELDCATALOG-FIELDNAME = 'FLAG'.
      WA_FIELDCATALOG-OUTPUTLEN =  6.
      WA_FIELDCATALOG-CHECKBOX  = 'X'.           "as checkbox
      WA_FIELDCATALOG-EDIT      = 'X'.
      WA_FIELDCATALOG-SELTEXT = 'Check box'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'MATNR'.
      WA_FIELDCATALOG-OUTPUTLEN =  20.
      WA_FIELDCATALOG-SELTEXT = 'Mat no'.
    *  wa_fieldcatalog-input = 'X'.
      wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'ERSDA'.
      WA_FIELDCATALOG-OUTPUTLEN =  15.
      WA_FIELDCATALOG-SELTEXT = 'Creation Date'.
    *  wa_fieldcatalog-input = 'X'.
    *  wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'ERNAM'.
      WA_FIELDCATALOG-OUTPUTLEN =  20.
      WA_FIELDCATALOG-SELTEXT = 'Creation Time'.
    *  wa_fieldcatalog-input = 'X'.
    *  wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'WESCH'.
      WA_FIELDCATALOG-OUTPUTLEN =  20.
      WA_FIELDCATALOG-SELTEXT = 'Quantity'.
    *  wa_fieldcatalog-input = 'X'.
    *  wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
    ENDFORM.                    "build_fieldcatalog
    *&      Form  BUILD_LAYOUT
    *       text
    FORM BUILD_LAYOUT .
      CONSTANTS : LC_X TYPE CHAR1 VALUE 'X'.
    *  WA_LAYOUT-NO_INPUT          = LC_X.
      WA_LAYOUT-CWIDTH_OPT = LC_X.
      WA_LAYOUT-ZEBRA             = LC_X.
      WA_LAYOUT-STYLEFNAME = 'STYLE'.
      WA_LAYOUT-CTAB_FNAME = 'CELLCOLR'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       text
    FORM DISPLAY_ALV_REPORT .
      LS_EDIT-FIELDNAME = 'FLAG'.
      LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
      INSERT LS_EDIT INTO TABLE LT_EDIT.
      INSERT LINES OF LT_EDIT INTO TABLE WA_MARA1-STYLE.
      LS_CELL_COLOR-FNAME = 'MATNR'.
      LS_CELL_COLOR-COLOR-COL = '7'.
      LS_CELL_COLOR-COLOR-INT = '1'.
      INSERT LS_CELL_COLOR into table LT_CELL_COLOR.
      INSERT LINES OF LT_CELL_COLOR into TABLE WA_MARA1-CELLCOLR.
      LOOP AT IT_MARA INTO WA_MARA.
        IF WA_MARA-ERSDA EQ '20080625'.
          MODIFY IT_MARA INDEX SY-TABIX FROM WA_MARA1 TRANSPORTING STYLE CELLCOLR.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
       EXPORTING
    *      I_INTERFACE_CHECK                 = ' '
    *      I_BYPASSING_BUFFER                =
    *      I_BUFFER_ACTIVE                   =
         I_CALLBACK_PROGRAM                = SY-REPID
         I_CALLBACK_PF_STATUS_SET          = 'F_SET_STATUS'
         I_CALLBACK_USER_COMMAND           = 'F_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                      = 'Example of select and deselect'
    *      I_GRID_SETTINGS                   =
          IS_LAYOUT_LVC                     = WA_LAYOUT
         IT_FIELDCAT_LVC                   = IT_FIELDCATALOG
        TABLES
          T_OUTTAB                          = IT_MARA
    *    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.
    *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    *    EXPORTING
    *      I_CALLBACK_PROGRAM       = GV_REPID
    *      I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
    *      I_CALLBACK_USER_COMMAND  = 'F_USER_COMMAND'
    *      I_GRID_TITLE             = 'Example of select and deselect'
    *      I_GRID_SETTINGS          = WA_SETTINGS
    *      IS_LAYOUT                = WA_LAYOUT
    *      IT_FIELDCAT              = IT_FIELDCATALOG[]
    *    TABLES
    *      T_OUTTAB                 = IT_MARA.
    *  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  f_set_status
    *       text
    FORM F_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STATUS1'.
    ENDFORM.                    " f_set_status
    *&      Form  f_user_command
    *       text
    FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
    * BREAK-POINT.
      CASE R_UCOMM.
        WHEN 'ASEL'.
          LOOP AT IT_MARA INTO WA_MARA.
            WA_MARA-FLAG = 'X'.
            MODIFY IT_MARA FROM WA_MARA.
          ENDLOOP.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'DSEL'.
          LOOP AT IT_MARA INTO WA_MARA.
            WA_MARA-FLAG = ' '.
            MODIFY IT_MARA FROM WA_MARA.
          ENDLOOP.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'DELETE'.
    *      BREAK-POINT.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = REF1.
          CALL METHOD REF1->CHECK_CHANGED_DATA.
          DELETE IT_MARA
                   WHERE FLAG = 'X'.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'INSERT'.
          CLEAR WA_MARA.
          APPEND WA_MARA TO IT_MARA.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = REF1.
          CALL METHOD REF1->REFRESH_TABLE_DISPLAY.
        WHEN 'SAVEDB'.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = REF1.
          CALL METHOD REF1->CHECK_CHANGED_DATA.
    * CODE TO BE WRITTEN TO SAVE in DB just an insert statement
    *ENDLOOP.
      ENDCASE.
    ENDFORM.
       REPORT  ZTEST_DHR.
    TYPE-POOLS : SLIS.
    TYPES: BEGIN OF TY_MARA,
            FLAG  TYPE CHAR1,
            MATNR TYPE MARA-MATNR,
            ERSDA TYPE MARA-ERSDA,
            ERNAM TYPE MARA-ERNAM,
            WESCH TYPE MARA-WESCH,
            STYLE TYPE LVC_T_STYL,
            CELLCOLR TYPE LVC_T_SCOL,
          END OF TY_MARA.
    DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA.
    DATA : IT_MARA1 TYPE STANDARD TABLE OF TY_MARA,
           WA_MARA TYPE TY_MARA,
           WA_MARA1 TYPE TY_MARA.
    * for reuse alv grid display
    *DATA : IT_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
    *        WA_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,
    *        WA_LAYOUT       TYPE SLIS_LAYOUT_ALV,
    *        GV_REPID      TYPE SY-REPID.
    *for LVC Display
    DATA : WA_SETTINGS TYPE LVC_S_GLAY.
    DATA : WA_LAYOUT TYPE LVC_S_LAYO.
    DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT,
            WA_FIELDCATALOG TYPE LVC_S_FCAT.
    DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    DATA : LS_CELL_COLOR TYPE LVC_S_SCOL.
    DATA : LT_CELL_COLOR TYPE LVC_T_SCOL.
    START-OF-SELECTION.
      SELECT MATNR ERSDA ERNAM WESCH
        FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
      UP TO 10 ROWS.
    END-OF-SELECTION.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_LAYOUT.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATALOG
    *       text
    FORM BUILD_FIELDCATALOG .
      WA_FIELDCATALOG-FIELDNAME = 'FLAG'.
      WA_FIELDCATALOG-OUTPUTLEN =  6.
      WA_FIELDCATALOG-CHECKBOX  = 'X'.           "as checkbox
      WA_FIELDCATALOG-EDIT      = 'X'.
      WA_FIELDCATALOG-SELTEXT = 'Check box'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'MATNR'.
      WA_FIELDCATALOG-OUTPUTLEN =  20.
      WA_FIELDCATALOG-SELTEXT = 'Mat no'.
    *  wa_fieldcatalog-input = 'X'.
      wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'ERSDA'.
      WA_FIELDCATALOG-OUTPUTLEN =  15.
      WA_FIELDCATALOG-SELTEXT = 'Creation Date'.
    *  wa_fieldcatalog-input = 'X'.
    *  wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'ERNAM'.
      WA_FIELDCATALOG-OUTPUTLEN =  20.
      WA_FIELDCATALOG-SELTEXT = 'Creation Time'.
    *  wa_fieldcatalog-input = 'X'.
    *  wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
      WA_FIELDCATALOG-FIELDNAME = 'WESCH'.
      WA_FIELDCATALOG-OUTPUTLEN =  20.
      WA_FIELDCATALOG-SELTEXT = 'Quantity'.
    *  wa_fieldcatalog-input = 'X'.
    *  wa_fieldcatalog-edit = 'X'.
      APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
      CLEAR  WA_FIELDCATALOG.
    ENDFORM.                    "build_fieldcatalog
    *&      Form  BUILD_LAYOUT
    *       text
    FORM BUILD_LAYOUT .
      CONSTANTS : LC_X TYPE CHAR1 VALUE 'X'.
    *  WA_LAYOUT-NO_INPUT          = LC_X.
      WA_LAYOUT-CWIDTH_OPT = LC_X.
      WA_LAYOUT-ZEBRA             = LC_X.
      WA_LAYOUT-STYLEFNAME = 'STYLE'.
      WA_LAYOUT-CTAB_FNAME = 'CELLCOLR'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       text
    FORM DISPLAY_ALV_REPORT .
      LS_EDIT-FIELDNAME = 'FLAG'.
      LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
      INSERT LS_EDIT INTO TABLE LT_EDIT.
      INSERT LINES OF LT_EDIT INTO TABLE WA_MARA1-STYLE.
      LS_CELL_COLOR-FNAME = 'MATNR'.
      LS_CELL_COLOR-COLOR-COL = '7'.
      LS_CELL_COLOR-COLOR-INT = '1'.
      INSERT LS_CELL_COLOR into table LT_CELL_COLOR.
      INSERT LINES OF LT_CELL_COLOR into TABLE WA_MARA1-CELLCOLR.
      LOOP AT IT_MARA INTO WA_MARA.
        IF WA_MARA-ERSDA EQ '20080625'.
          MODIFY IT_MARA INDEX SY-TABIX FROM WA_MARA1 TRANSPORTING STYLE CELLCOLR.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
       EXPORTING
    *      I_INTERFACE_CHECK                 = ' '
    *      I_BYPASSING_BUFFER                =
    *      I_BUFFER_ACTIVE                   =
         I_CALLBACK_PROGRAM                = SY-REPID
         I_CALLBACK_PF_STATUS_SET          = 'F_SET_STATUS'
         I_CALLBACK_USER_COMMAND           = 'F_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                      = 'Example of select and deselect'
    *      I_GRID_SETTINGS                   =
          IS_LAYOUT_LVC                     = WA_LAYOUT
         IT_FIELDCAT_LVC                   = IT_FIELDCATALOG
        TABLES
          T_OUTTAB                          = IT_MARA
    *    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.
    *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    *    EXPORTING
    *      I_CALLBACK_PROGRAM       = GV_REPID
    *      I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
    *      I_CALLBACK_USER_COMMAND  = 'F_USER_COMMAND'
    *      I_GRID_TITLE             = 'Example of select and deselect'
    *      I_GRID_SETTINGS          = WA_SETTINGS
    *      IS_LAYOUT                = WA_LAYOUT
    *      IT_FIELDCAT              = IT_FIELDCATALOG[]
    *    TABLES
    *      T_OUTTAB                 = IT_MARA.
    *  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  f_set_status
    *       text
    FORM F_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STATUS1'.
    ENDFORM.                    " f_set_status
    *&      Form  f_user_command
    *       text
    FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
    * BREAK-POINT.
      CASE R_UCOMM.
        WHEN 'ASEL'.
          LOOP AT IT_MARA INTO WA_MARA.
            WA_MARA-FLAG = 'X'.
            MODIFY IT_MARA FROM WA_MARA.
          ENDLOOP.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'DSEL'.
          LOOP AT IT_MARA INTO WA_MARA.
            WA_MARA-FLAG = ' '.
            MODIFY IT_MARA FROM WA_MARA.
          ENDLOOP.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'DELETE'.
    *      BREAK-POINT.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = REF1.
          CALL METHOD REF1->CHECK_CHANGED_DATA.
          DELETE IT_MARA
                   WHERE FLAG = 'X'.
          RS_SELFIELD-REFRESH = 'X'.
        WHEN 'INSERT'.
          CLEAR WA_MARA.
          APPEND WA_MARA TO IT_MARA.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = REF1.
          CALL METHOD REF1->REFRESH_TABLE_DISPLAY.
        WHEN 'SAVEDB'.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = REF1.
          CALL METHOD REF1->CHECK_CHANGED_DATA.
    * CODE TO BE WRITTEN TO SAVE in DB just an insert statement
    *ENDLOOP.
      ENDCASE.
    ENDFORM.
    About Selecting a Color From Dropdown?  even i need to check for now this is the how u do cell color in alv

  • Set color of specific cells in JTable.

    I have a JTable where I want to set the color for specific cells. Is this possible to do, and if so, how?

    Well, one way is to create a custom renderer that know the background color of each cell in the table. The Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer]How to Use Table has an example you might be able to build on.
    Or, this posting may give you another approach. The key to both solutions is to somehow specify the color for every cell:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=610474

  • How to print a specific cell in numbers

    how to print a specific cell in numbers?

    Copy the cell (contents), Paste onto a page of a separate document, or onto a separate sheet of your Numbers document, Print.
    Or insert a single cell table onto your Numbers document, type an = sign in the cell then click on the cell you want to print. Drag the new table to a second sheet, set up your page there, and print.
    See the Numbers '09 User Guide for other useful tools and techniques. Download the guide via the Help menu in Nuimbers.
    Regards,
    Barry

  • How can I link specific cells in two different speadsheets so the data from a specific cell in spreadsheet A automatically updates in a specific cell in spreadsheet B. It works in Xcel- Any ideas?

    How can I link specific cells in two different tables so the data from a specific cell in table A automatically updates in a specific cell in table B? It works in Xcel- Any ideas?

    (1) your title ask the way to link different spreadsheets.
    In Numberland, a spreadsheet is an entire document.
    There is no way to link different documents.
    (2) in the message, you ask the way to link different tables.
    This feature is available and is described in iWork Formulas and Functions User Guide (which is available for free from the Help menu).
    Getting the info just requires a simple search in this available resource !
    Yvan KOENIG (VALLAURIS, France) 14 mai 2011 10:37:50

  • How to change the color of specific row in ALV tree

    Hi,
    I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
    The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
    Pls suggest...

    hi
    hope this code will help you.
    Reward if help.
    REPORT zsharad_test1.
    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,
    line_color(4) TYPE c, "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
    gd_layout-info_fieldname = 'LINE_COLOR'.
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    is_variant = z_template
    TABLES
    t_outtab = it_ekko
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    DATA: ld_color(1) TYPE c.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekko.
    *Populate field with color attributes
    LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
    i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
    IF ld_color = 8.
    ld_color = 1.
    ENDIF.
    CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
    MODIFY it_ekko FROM wa_ekko.
    ENDLOOP.
    ENDFORM. " DATA_RETRIEVAL

  • How to give color of particular cell in alv list display for dynamic table

    Dear Experts,
    i want to give color of a particular cell in alv list display (reuse_alv_list_display). Here i am passing data through dynamic table?

    Hi,
    Se this:
    DATA: lt_color    TYPE lvc_t_scol WITH HEADER LINE.
    DATA: BEGIN OF data_tab OCCURS 0.
             tabcolor     TYPE   lvc_t_scol,
          END OF data_tab.
    * Befone ALV call
      alv_layout-coltab_fieldname  = 'TABCOLOR'.
    * For each row in data_tab
    REFRESH: lt_color.
    CLEAR: lt_color.
    lt_color-color-col = 6.
    lt_color-color-int = 1.
    lt_color-fname = FIELD1'.
    APPEND lt_color.
    lt_color-color-col = 2.
    lt_color-color-int = 0.
    lt_color-fname = 'FIELD2'.
    APPEND lt_color.
    data_tab-tabcolor[] = lt_color[].
    append data_tab.
    Best regards,
    Leandro Mengue

  • Display Color for sigle  CELL in ALV report

    Hi all,
    I have one doubt is it possible to make a particular cell as read color in ALV.
    Ex: I have one field which shows amount in my ALV report,My requirement is that when ever the amount is less then 'ZERO', I have to show that particular cell in read color.
    Regards
    Anil Kumar.N

    hi,
    here code for coloring a perticular cell
    TYPE-POOLS:slis.
    TABLES:mara,
           makt,
           marc.
    DATA:BEGIN OF itab OCCURS 0,
          matnr LIKE mara-matnr,
          maktx LIKE makt-maktx,
          werks LIKE marc-werks,
          mtart LIKE mara-mtart,
          matkl LIKE mara-matkl,
          meins LIKE mara-meins,
          ntgew LIKE mara-ntgew,
         rowcolor(4) TYPE c,
          cellcolors TYPE lvc_t_scol,
         END OF itab.
    DATA:t_fcat TYPE slis_t_fieldcat_alv,
         t_eve TYPE slis_t_event.
    DATA : st_layout TYPE slis_layout_alv.
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:mat FOR mara-matnr.  " no intervals no-extension.
    *PARAMETERS:mat LIKE mara-matnr.
    SELECTION-SCREEN:END OF BLOCK blk1.
    INITIALIZATION.
      PERFORM build_cata USING t_fcat.
      PERFORM build_event.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM display_data.
    *&      Form  build_cata
          text
         -->TEMP_FCAT  text
    FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
      sy-tvar0 = sy-uname.
      WRITE sy-datum TO sy-tvar1.
      DATA:wa_fcat TYPE slis_fieldcat_alv.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-seltext_m = 'Material'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MAKTX'.
      wa_fcat-seltext_m = 'Description'.
      wa_fcat-fix_column = 'x'.
      wa_fcat-key = 'X'.                                     "To color a column
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'WERKS'.
      wa_fcat-seltext_m = 'Plant'.
      wa_fcat-key = ' '.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MTART'.
      wa_fcat-seltext_m = 'Type'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATKL'.
      wa_fcat-seltext_m = 'Group'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MEINS'.
      wa_fcat-seltext_m = 'Measurement Unit'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'NTGEW'.
      wa_fcat-seltext_m = 'Net Value'.
      APPEND wa_fcat TO temp_fcat.
    ENDFORM.                    "build_cata
    *&      Form  build_event
          text
    FORM build_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = t_eve
        EXCEPTIONS
          list_type_wrong = 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.                    "build_event
    *&      Form  data_retrieval
          text
    FORM data_retrieval.
      SELECT maramatnr  maramtart maramatkl marameins mara~ntgew
       maktmaktx  marcwerks
      INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara INNER JOIN makt ON
      maramatnr = maktmatnr
      INNER JOIN marc ON
      maramatnr = marcmatnr
      WHERE mara~matnr IN mat.
      SORT itab BY matnr.
      DELETE ADJACENT DUPLICATES FROM itab.
    ENDFORM.                    "data_retrieval
    *&      Form  display_data
          text
    FORM display_data.
    *******************************For setting Cell Color*******************************************
      DATA ls_cellcolor TYPE lvc_s_scol .
      st_layout-coltab_fieldname = 'CELLCOLORS'.
      READ TABLE itab INDEX 5 .
      ls_cellcolor-fname = 'MATNR' .
      ls_cellcolor-color-col = '1' .
      ls_cellcolor-color-int = '1' .
      APPEND ls_cellcolor TO itab-cellcolors .
      MODIFY itab INDEX 5 .
    st_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZALV_DS'
          is_layout          = st_layout
          i_save             = 'A'
          it_fieldcat        = t_fcat
          it_events          = t_eve
        TABLES
          t_outtab           = itab
        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
    Please reward if useful...

  • How to select a specific cell in a JTable?

    Hi there,
    in a JTable, I would like to select a specific cell (to highlight it) from a JButton.
    Here a sample code...
    Who could help me to fill it?
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TableSelection{
        public static void main (String args[]) {
          JFrame frame = new MyFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.show();
    class MyFrame extends JFrame{
      public MyFrame(){
        setTitle("TableSelection");
        setSize(WIDTH,HEIGHT);
        DefaultTableModel myModel = new DefaultTableModel(2,2);
        JTable myTable = new JTable(myModel);
        myTable.setCellSelectionEnabled(true);
        JButton button00 = new JButton("select 0,0");
        button00.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event){
         System.out.println("selection of cell (0,0)");
         //--- what code is required to select the cell(0,0)?
        JButton button11 = new JButton("select 1,1");
        button11.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent event){
         System.out.println("selection of cell (1,1)");
         //--- what code is required to select the cell(1,1)?
        Box myBox = new Box(BoxLayout.Y_AXIS);
        myBox.add(new JScrollPane(myTable));
        myBox.add(button00);
        myBox.add(button11);
        getContentPane().add(myBox, BorderLayout.CENTER);
      private static final int WIDTH=200;
      private static final int HEIGHT=200;
    }Thanks a lot for your help.
    Denis

    Use the addColumnSelectionInterval(int index1, int index2)method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addColumnSelectionInterval(int,%20int)
    and the addRowSelectionInterval(int index1, int index2) method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)
    Hope that helped.
    afotoglidis

  • How do I sort specific cells without affecting entire rows?

    In Excel I can sort specific cells ascending/descending and only what I highlight will sort.
    In Numbers, when I try to do that the entire row sorts.
    Is there a way to only sort the highlighted cells and not have the rest of the rows sort as well?

    Here's a link (Dropbox download) to a Copy Sort Acending service, that in your menu would look similar to this:
    To use it, select the cells you want to sort, just as in Excel, and make the choice from the menu.
    After that, unlike Excel, click once in the first cell where you want the sorted values to start appearing (either the original range, or a different range if you want) and type command-v or option-shift-command-v to paste.
    The one-time installation takes a double-click on the .workflow package and a click on 'Install'. You may also have to go to System Preferences > Security & Privacy and click 'Download anyway'.  Installing simply moves the service to your Library > Services folder so that it will appear in your menu. It does nothing to the innards of your Mac, and does not run unless you specifically tell it to by choosing it from the menu or running it from within Automator. You can view the script by opening it in Automator.  You can remove the service if you don't need it by holding down the option key in Finder, choosing Go from the menu and navigating to Library > Services, where you can delete it the way you would any other folder or package.
    SG

  • Help needed badly with coloring of specific cells in a tble

    I have an existing table and when this code, it colors all the cells in a column. Hoe can I use the funktion getCellRenderer: to color only one cell at a time and implement it in an already existing table.
    THX for any help I can get :)
    ColorRenderer cell=new ColorRender();
    // for(int i=0;i<table.getModel().getColumnCount();i++){
    // TableColumn mod=this.getColumn((this.getModel().getColumnName(i)));
    mod.setCellRenderer(cell);
    And ur ColorRender calss should override DefaultTableCellRenderer like this
    class ColorRenderer extends DefaultTableCellRenderer {
    protected int align;
    public ColorRenderer(int align) {
    this.align=align;
    public Component getTableCellRendererComponent(JTable table,
    Object value, boolean isSelected, boolean hasFocus, int row,
    int column) {
    setHorizontalAlignment(align);
    super.getTableCellRendererComponent(table, value, isSelected,
    hasFocus, row, column);
    if(col==4){
    setBackground(Color.cyan);
    return this;
    }

    Here's a bit of Friday Fun: before you run this code, what do you think the table will look like?
    What will it look like as you click and drag on it to select cells?
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class X {
        static class R extends DefaultTableCellRenderer {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component that = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Color bk = that.getBackground();
                that.setBackground((row + column)%2==0? bk.darker() : bk.brighter());
                return that;
        public static void main(String[] args) {
            JTable table = new JTable(20,10);
            table.setDefaultRenderer(Object.class, new R());
            JFrame f = new JFrame("X");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new JScrollPane(table));
            f.setSize(400, 300);
            f.setLocationRelativeTo(null);
            f.setVisible(true);

  • Background color of the cell in EXCEL not working....Pls help..

    Hi gurus,
    I have written a procedure to change the background color of the cell in EXCEL.The code is as below..
    PROCEDURE set_header     (p_row IN NUMBER, p_col IN NUMBER, p_value IN VARCHAR2, p_border IN VARCHAR2 DEFAULT 'N',p_bgcolor IN VARCHAR2 DEFAULT 'N') IS
    BEGIN
         v_args     := ole2.create_arglist;
         ole2.add_arg(v_args, p_row);
         ole2.add_arg(v_args, p_col);
         v_cell     := ole2.get_obj_property(v_worksheet, 'cells', v_args);
         v_font     := ole2.get_obj_property(v_cell, 'font');
         ole2.set_property(v_font, 'fontstyle', 'bold');
         ole2.set_property(v_font, 'size', 9);
         ole2.destroy_arglist(v_args);
         if p_border = 'Y' THEN
              v_border := ole2.get_obj_property(v_cell, 'Borders');
              ole2.set_property(v_border, 'LineStyle', 1);
              ole2.release_obj(v_border);
         End If;
         if p_bgcolor ='Y' THEN
              v_bgcolor := ole2.get_obj_property(v_cell,'Bgcolor'); --This is not woking
              ole2.set_property(v_bgcolor,'bgcolor','red');
              ole2.release_obj(v_bgcolor);
         End If;
              ole2.set_property(v_cell, 'value', p_value);
              ole2.release_obj(v_cell);
         END set_header;
    Pls tell me how to change the backcolor and forecolor in the cell...
    Thanks

    The background color is set for the "Interior" object of the selected cells (Range).
    Try something like this (haven't tested it):
    v_interior := ole2.get_obj_property(v_cell,'Interior');
    ole2.set_property(v_interior,'ColorIndex',3); --should be red
    ole2.release_obj(v_interior);
    If the Foreground color = Font Color then
    ole2.set_property(v_font,'ColorIndex',6); --should be yellow
    Gerald

  • HOW TO CHANGE COLOR OF PARTICULAR CELL  IN ALV

    I HAVE DISPLAYED A REPORT IN ALV
    I WANT TO CHANGE THE COLOR OF VBELN FIELD  ON WHICH HOTSPOT IS ON?
    HOW TO DO THIS?

    Hi Lovleen,
    Check out the code
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display each row in a different     *
    *& colour                                                              *
    REPORT  zdemo_alvgrid                 .
    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,
      line_color(4) type c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    data: ld_color(1) type c.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    *Populate field with color attributes
    loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
      ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
      if ld_color = 8.
        ld_color = 1.
      endif.
      concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
      modify it_ekko from wa_ekko.
    endloop.
    endform.                    " DATA_RETRIEVAL
    Regards,
    Chandru

  • How to select an individual cell in ALV.

    hi all,
    could anyone please tell me how do i select only one cell in a coloumn to perform the required operation on that cell.
    thanks.

    Hi Jagruti.
    If you search the forum with the key words: 'alv cell color' you will find the answer to
    this questions.
    Cheers,
    Sascha
    Message was edited by:
            Sascha Dingeldey

  • How to Delete a Specific Cell in a Matrix + plz Give sample code for Lost F

    hello there !!!!
    i m in Great Trouble please help me out..
    i have to search for a specific Column n then i have to validate that portion, similarly after validating i have to add update delete all the fuction apply... so please help me i m very upset.
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim Count As Int32
                If FormUID.Equals("Allowance") Then
                    If (pVal.BeforeAction = True) And (pVal.ItemUID = "1") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                        If pVal.Row = 0 Then
                            'BubbleEvent = False
                        End If
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        Count = o_Matrix.RowCount()
                        SBO_Application1.MessageBox("Matrix Count is " & o_Matrix.RowCount)
                        Validate(pVal, EventEnum, FormUID, BubbleEvent)
                    End If
                End If
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
        Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim Row, ii As Integer
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            o_Matrix.FlushToDataSource()
            Try
                For Row = 2 To o_Matrix.RowCount
                    StrName = Convert.ToString(DBtable.GetValue("CardCode", Row - 1)).Trim()''' i got Error over there n rest of my code is also not working pls...
                    StrUId = Convert.ToString(DBtable.GetValue("U_AlwID", Row - 1)).Trim()
                    StrEnter = Convert.ToString(DBtable.GetValue("U_SupEnter", Row - 1)).Trim()
                    StrExist = Convert.ToString(DBtable.GetValue("U_SupExist", Row - 1)).Trim()
                    If Row - 1 < DBtable.Rows.Count - 1 Or (Not (StrName.Equals(String.Empty) And StrUId.Equals(String.Empty) And (StrEnter.Equals(String.Empty) Or StrExist.Equals(String.Empty))) And (Row - 1 = DBtable.Rows.Count - 1)) Then
                        If (Not StrName.Equals(String.Empty)) And ((StrUId.Equals(String.Empty) Or StrEnter.Equals(String.Empty)) Or StrExist.Trim.Equals(String.Empty)) Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                        For ii = Row To DBtable.Rows.Count - 1
                            If Convert.ToString(DBtable.GetValue("ColName", ii)).Trim().Equals(StrName.Trim()) Then
                                SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Duplication Not Allowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
                                BubbleEvent = False
                                Exit Sub
                            End If
                        Next
                        If CDbl(StrName) < 0 Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                    End If
                Next Row
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

    Hello there
    sir i want to Add Update and delete these three basic operation onto the Matrix, Sir u game me a Sample code of Delete a specific Column...
    Sir can u do me a favour pls leave every thing n just told me how to update a matrix ,like i have to fill the matrix field through the DATABASE table now i want to update the DataBase table from the matrix..
    i just only know thta i have to fill back database table with the help of FLUSHTODATABASE()
    here is my Sample Code...n i have to update in the validate portion...
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim oCellValue As SAPbouiCOM.EditText
                If FormUID.Equals("Allowance") Then
                    If (pVal.ItemUID = "MatAllow") Then
                        If pVal.Row = 0 Then Exit Sub
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        If (pVal.Row > o_Matrix.RowCount) Then Exit Sub
                        oForm = SBO_Application1.Forms.Item(FormUID)
                        If (pVal.ItemUID = "1" Or EventEnum = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                            If pVal.ColUID = "ColName" And pVal.BeforeAction = True Then
                                If pVal.Row = 0 Then Exit Sub
                                oCellValue = CType(o_Matrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific(), SAPbouiCOM.EditText)
                                If (oCellValue.Value.Trim().Equals(String.Empty) And o_Matrix.RowCount <> pVal.Row) Then
                                    SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Blank Value Not Allowed", )
                                    oCellValue.Active = True
                                    BubbleEvent = False
                                    Exit Sub
                                End If
                            End If
                        End If
                    End If
                End If
                Validate(pVal, EventEnum, FormUID, BubbleEvent)
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
    Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim str, str1 As String
            Dim checkbox1, Checkbox2 As SAPbouiCOM.CheckBox
            Dim o_Matrix As SAPbouiCOM.Matrix
            Dim Sum As Integer
            Dim oRecordset As SAPbobsCOM.Recordset
            Dim Container As Integer
            Dim Count As Int32
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            oRecordset = o_CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                For Count = 0 To DBtable.Rows.Count - 1
                    CodeFill = Convert.ToString(DBtable.GetValue("Name", Count).Trme())
                    NameID = Convert.ToString(DBtable.GetValue("ColUID", Count).Trim())
                    Price = Convert.ToString(DBtable.GetValue("ColPrice", Count).Trim())
                    Quantity = Convert.ToString(DBtable.GetValue("ColQuant", Count).Trim())
                    Total = Convert.ToString(DBtable.GetValue("ColTotal", Count).Trim())
                    checkbox1 = o_Matrix.Columns.Item("ColSEnter").Cells.Item(Count).Specific
                    Checkbox2 = o_Matrix.Columns.Item("ColSExist").Cells.Item(Count).Specific
                    If (checkbox1.Checked = True) And (Checkbox2.Checked = True) Then
                        Dim Sql As String
                        Sql = "Update [@Supplier] Set U_Price=' " & Price & " ',U_ID=" & NameID & "Where Name ='" & CodeFill & " '"
                        oRecordset.DoQuery(Sql)
                    End If
                Next Count
                SBO_Application1.MessageBox("Record was Updated")
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

Maybe you are looking for

  • How to show select option on report

    Using the excel based bex tool is there a way to show what the user picked in the select-option on the report so when the print it. Thanks

  • How do you Uninstall Camera Raw 5.5 and 5.6 updates

    My 5.5 Raw Update was working well, then I decided to update to the 5.6 Raw plugin.  I was not happy with the colors and sharpness of the images opened with the 5.6 plugin.  I would like to thrash this and get back to 5.5.  However, PS E does not all

  • Broken Pipe / Connection Reset Errors

    I know they come from the user hitting the stop button on his browser. They are benign and can be ignored. I just don't want to see them in my logs (or my email box) anymore. Anyone figure out how to disable the logging of these messages? ####<Jul 14

  • Robert Jacobson.  Trying to use script to get rid of duplcates in itunes

    Downloaded script but do not how to use it. I have way to many duplicates to go one by one. Can you help

  • Secured dimensions - member access profile

    Hi, I have following question concerning secured dimensions As you all know, you can secure dimenions using "modify applications". There you have the options for "secure" of "R/W" If you choose to secure a dimension, you have the option read only and