Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Color cell

Former Member
0 Kudos

I am getting suceess in this code, but i am getting same color on Filed ' Sunday ' in index 7, i need the color only on index 2.

how to solve this ?

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 2 .

IF SY-SUBRC = 0.

MOVE 'SUNDAY' TO LS_COLOR_CELL-FNAME.

MOVE '1' TO LS_COLOR_CELL-COLOR-COL.

MOVE '1' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 2.

CLEAR WA_BPSTAB.

ENDIF.

CLEAR : LS_COLOR_CELL-FNAME,LS_COLOR_CELL-COLOR-COL,LS_COLOR_CELL-COLOR-INT,LS_COLOR_CELL-COLOR-INV.

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 7 .

IF SY-SUBRC = 0.

MOVE 'MONDAY' TO LS_COLOR_CELL-FNAME.

MOVE '6' TO LS_COLOR_CELL-COLOR-COL.

MOVE '0' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 7.

ENDIF.

CLEAR : LS_COLOR_CELL-FNAME,LS_COLOR_CELL-COLOR-COL,LS_COLOR_CELL-COLOR-INT,LS_COLOR_CELL-COLOR-INV.

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 7 .

IF SY-SUBRC = 0.

MOVE 'TUESDAY' TO LS_COLOR_CELL-FNAME.

MOVE '5' TO LS_COLOR_CELL-COLOR-COL.

MOVE '0' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 7.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please add the bold line in your code and check.

<b>refresh LT_COLOR_CELL.</b>

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 2 .

IF SY-SUBRC = 0.

MOVE 'SUNDAY' TO LS_COLOR_CELL-FNAME.

MOVE '1' TO LS_COLOR_CELL-COLOR-COL.

MOVE '1' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 2.

CLEAR WA_BPSTAB.

ENDIF.

CLEAR : LS_COLOR_CELL-FNAME,LS_COLOR_CELL-COLOR-COL,LS_COLOR_CELL-COLOR-INT,LS_COLOR_CELL-COLOR-INV.

<b>refresh LT_COLOR_CELL.</b>

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 7 .

IF SY-SUBRC = 0.

MOVE 'MONDAY' TO LS_COLOR_CELL-FNAME.

MOVE '6' TO LS_COLOR_CELL-COLOR-COL.

MOVE '0' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 7.

ENDIF.

CLEAR : LS_COLOR_CELL-FNAME,LS_COLOR_CELL-COLOR-COL,LS_COLOR_CELL-COLOR-INT,LS_COLOR_CELL-COLOR-INV.

<b>refresh LT_COLOR_CELL.</b>

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 7 .

IF SY-SUBRC = 0.

MOVE 'TUESDAY' TO LS_COLOR_CELL-FNAME.

MOVE '5' TO LS_COLOR_CELL-COLOR-COL.

MOVE '0' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 7.

ENDIF.

Please reward points if it helps.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Please add the bold line in your code and check.

<b>refresh LT_COLOR_CELL.</b>

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 2 .

IF SY-SUBRC = 0.

MOVE 'SUNDAY' TO LS_COLOR_CELL-FNAME.

MOVE '1' TO LS_COLOR_CELL-COLOR-COL.

MOVE '1' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 2.

CLEAR WA_BPSTAB.

ENDIF.

CLEAR : LS_COLOR_CELL-FNAME,LS_COLOR_CELL-COLOR-COL,LS_COLOR_CELL-COLOR-INT,LS_COLOR_CELL-COLOR-INV.

<b>refresh LT_COLOR_CELL.</b>

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 7 .

IF SY-SUBRC = 0.

MOVE 'MONDAY' TO LS_COLOR_CELL-FNAME.

MOVE '6' TO LS_COLOR_CELL-COLOR-COL.

MOVE '0' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 7.

ENDIF.

CLEAR : LS_COLOR_CELL-FNAME,LS_COLOR_CELL-COLOR-COL,LS_COLOR_CELL-COLOR-INT,LS_COLOR_CELL-COLOR-INV.

<b>refresh LT_COLOR_CELL.</b>

READ TABLE GT_BPSTAB INTO WA_BPSTAB INDEX 7 .

IF SY-SUBRC = 0.

MOVE 'TUESDAY' TO LS_COLOR_CELL-FNAME.

MOVE '5' TO LS_COLOR_CELL-COLOR-COL.

MOVE '0' TO LS_COLOR_CELL-COLOR-INT.

MOVE '0' TO LS_COLOR_CELL-COLOR-INV.

APPEND LS_COLOR_CELL TO LT_COLOR_CELL.

WA_BPSTAB-COLOR_CELL[] = LT_COLOR_CELL[].

MODIFY GT_BPSTAB FROM WA_BPSTAB INDEX 7.

ENDIF.

Please reward points if it helps.

Former Member
0 Kudos

Try with Refreshing the table LT_COLOR_CELL after the clear for LS_COLOR_CELL at index 2. As it is now Sunday stays for all of the lines.

Regards,

Anders