Skip to Content
-1
Nov 22, 2020 at 07:21 AM

ALV CELL COLOR

56 Views

HI EXPERT

I want to make two of my exit columns blue,My Code Here

TYPE-POOLS SLIS.

TYPES : BEGIN OF TY_T023T ,
MATKL TYPE T023T-MATKL,
WGBEZ TYPE T023T-WGBEZ,
END OF TY_T023T.
DATA : IT_T023T TYPE STANDARD TABLE OF TY_T023T .
DATA : I_T023T TYPE TY_T023T .

TYPES : BEGIN OF TY_T001W ,
WERKS TYPE T001W-WERKS,
NAME1 TYPE T001W-NAME1,
END OF TY_T001W.
DATA : IT_T001W TYPE STANDARD TABLE OF TY_T001W .
DATA : I_T001W TYPE TY_T001W .

DATA : IT_MARAFINAL TYPE STANDARD TABLE OF ZSTR_MARAFINAL,
I_MARAFINAL TYPE ZSTR_MARAFINAL .

DATA : IDX TYPE I .
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV .
DATA : WA_FCAT TYPE SLIS_FIELDCAT_ALV.

SELECT-OPTIONS : S_MATNR FOR I_MARAFINAL-MATNR.
SELECT-OPTIONS : S_WERKS FOR I_MARAFINAL-WERKS.
SELECT-OPTIONS : S_MATKL FOR I_MARAFINAL-MATKL.

START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM VALIDATE_FCAT.

END-OF-SELECTION.
PERFORM DISPLAY_ALV.


FORM GET_DATA.


SELECT MARA~MATNR MAKT~MAKTX
MARC~WERKS MARA~MATKL
INTO TABLE IT_MARAFINAL
FROM MARA
INNER JOIN MARC ON MARC~MATNR = MARA~MATNR
INNER JOIN MAKT ON MAKT~MATNR = MARA~MATNR
AND MAKT~MATNR = MARC~MATNR
WHERE MARA~MATNR IN S_MATNR
AND MARA~MATKL IN S_MATKL
AND MARC~WERKS IN S_WERKS
AND MAKT~SPRAS = 'E'.
SORT IT_MARAFINAL BY MATNR .


IF IT_MARAFINAL[] IS NOT INITIAL .

SELECT T001W~WERKS T001W~NAME1
INTO TABLE IT_T001W
FROM T001W
FOR ALL ENTRIES IN IT_MARAFINAL
WHERE WERKS = IT_MARAFINAL-WERKS AND SPRAS EQ 'E'.

SELECT T023T~MATKL T023T~WGBEZ
INTO TABLE IT_T023T
FROM T023T
FOR ALL ENTRIES IN IT_MARAFINAL
WHERE MATKL = IT_MARAFINAL-MATKL AND SPRAS EQ 'E'.

LOOP AT IT_MARAFINAL[] INTO I_MARAFINAL .

READ TABLE IT_T001W INTO I_T001W
WITH KEY WERKS = I_MARAFINAL-WERKS.
I_MARAFINAL-NAME1 = I_T001W-NAME1 .
READ TABLE IT_T023T INTO I_T023T
WITH KEY MATKL = I_MARAFINAL-MATKL .
I_MARAFINAL-WGBEZ = I_T023T-WGBEZ .

IDX = SY-TABIX.

MODIFY IT_MARAFINAL FROM I_MARAFINAL INDEX IDX .
ENDLOOP.
ENDIF.
ENDFORM.

FORM DISPLAY_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FCAT
TABLES
T_OUTTAB = IT_MARAFINAL.
ENDFORM.

FORM VALIDATE_FCAT.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_structure_name = 'ZSTR_MARAFINAL'
I_INCLNAME = SY-REPID

CHANGING
CT_FIELDCAT = IT_FCAT[].
ENDFORM.

-ZSTR_MARAFINAL Is a structure that i create in se11

now when i add cellcolor TYPE lvc_t_scol in my output internal tabale وBy the following code :

types : begin of ty_marafinal,
matnr like ZSTR_MARAFINAL-matnr ,
maktx like ZSTR_MARAFINAL-maktx ,
werks like ZSTR_MARAFINAL-WERKS ,
matkl like ZSTR_MARAFINAL-MATKL ,
wgbez like ZSTR_MARAFINAL-WGBEZ ,
name1 like ZSTR_MARAFINAL-name1,
cellcolor TYPE lvc_t_scol ,
end of ty_marafinal.
DATA : IT_MARAFINAL TYPE STANDARD TABLE OF TY_MARAFINAL,
I_MARAFINAL TYPE TY_MARAFINAL .

i see error :

the work area (or internal table ) 'it_marafinal' is not flat or contains references or internal tables as components. or internal tables as components. as components.

can you help me ? how can color cell in alv grid display and REUSE_ALV_FIELDCATALOG_MERGE