Hello Friends in this article we are going to see how to colour Cell in the F4 help of ALV. Colour cell in F4 in sap abap.
Report ztests.
TYPE-POOLS SLIS.
DATA: BEGIN OF itab OCCURS 0,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF itab.
PARAMETERS: P_BUKRS TYPE BUKRS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
PERFORM F4_FOR_BUKRS.
&———————————————————————
*& Form F4_FOR_BUKRS
*———————————————————————-*
FORM F4_FOR_BUKRS.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
ES_SELFIELD TYPE SLIS_SELFIELD.
Get data
SELECT BUKRS
BUTXT
FROM T001
INTO TABLE itab
up to 10 rows .
Get field
CALL FUNCTION ‘REUSE_ALV_FIELDCATALOG_MERGE’
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = ‘ITAB’
CHANGING
CT_FIELDCAT = IT_FIELDCAT[].
LOOP AT IT_FIELDCAT.
IT_FIELDCAT-KEY = SPACE.
IF IT_FIELDCAT-FIELDNAME = ‘BUTXT’.
IT_FIELDCAT-EMPHASIZE = ‘C710’.
ENDIF.
IF IT_FIELDCAT-FIELDNAME = ‘BUKRS’.
IT_FIELDCAT-EMPHASIZE = ‘C610’.
ENDIF.
MODIFY IT_FIELDCAT.
ENDLOOP.
CALL FUNCTION ‘REUSE_ALV_POPUP_TO_SELECT’
EXPORTING
I_TITLE = ‘THIS IS FOR F4 IN COLOR’
I_TABNAME = ‘ITAB’
IT_FIELDCAT = IT_FIELDCAT[]
IMPORTING
ES_SELFIELD = ES_SELFIELD
TABLES
T_OUTTAB = ITAB .
ENDFORM. ” F4_FOR_BUKRS