Skip to Content
author's profile photo
Former Member

Field symbols

Hi Everyone,

I have requirment like this:

in the alv report the values which are negative have to be colored red.

i have three field

Balance - Might be Negative or Positive Values

Inward- Positive Values

Outward-Negative Values.

i need to display the red color for negative values only for balance and not for Outward.

As outward is also negative it is getting colored as 'red' but i dont need that..

I have used the dynamic workarea created using field symbols to display the output

i am sending the code for the coloring of cells.

data lv_idx type i.

lv_count = lv_count + 2.

X_LAYOUT-coltab_fieldname = 'T_CELLCOLORS'.

loop at <dyn_table> into <dyn_wa>.

lv_idx = 0.

G_STOCK+6(02) = 0.

  • ASSIGN COMPONENT 'ZSTOCK123' OF STRUCTURE <dyn_wa> TO <w_field>.

do lv_count times.

IF lv_idx = 0.

G_STOCK = 'ZSTOCK123'.

endif.

if lv_idx = 1.

G_STOCK = 'ZSTOCK1'.

ENDIF.

IF lv_idx > 1.

G_STOCK6(02) = G_STOCK6(02) + 1.

ENDIF.

ASSIGN COMPONENT G_STOCK OF STRUCTURE <dyn_wa> TO <w_field>.

ASSIGN COMPONENT 'T_CELLCOLORS' OF STRUCTURE <dyn_wa> TO <t_cellcolors>.

clear wa_cellcolors.

wa_cellcolors-fname = G_STOCK.

if <w_field> < 0 .

wa_cellcolors-color-col = '6'.

else.

wa_cellcolors-color-col = '2'.

endif.

append wa_cellcolors to <t_cellcolors>.

modify <dyn_table> from <dyn_wa>.

lv_idx = lv_idx + 1.

enddo.

G_STOCK = 'ZSTOCK1'.

endloop.

endif.

i have the values of text like balance, inward and outward in the dynamic workarea but dont know how to retrieve that also.. because if i am able to retrieve that then i can check a condition to remove the coloring for the value 'outward'

Please help me.. its very urgent.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 08:16 AM

    <b>if <w_field> < 0 .</b>

    wa_cellcolors-color-col = '6'.

    Add a condition here that it if it is <b>negative and not outward</b>...then only set the color.....

    as u are just checking for if it negative or not...of course even outward fields which are negative will also be cloured red.

    Regards

    Vasu

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 10:35 AM

    i have resolved the issue myself.

    IF P_DETDIS = 'X'.

    assign component 'TEXT' of structure <dyn_wa> to <fs2>.

    if <fs2> eq 'OUTWARD'.

    continue.

    endif.

    ELSE.

    UNASSIGN <FS2>.

    ENDIF.

    then the coding for the color

    Add comment
    10|10000 characters needed characters exceeded