Application Development and Automation 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: 
Read only

query fields

Former Member
0 Likes
704

Hello all,

i am making a query with MKPF and MSEG tables (similar than MB51 t-code). I want to make one thing like the tcode. There when is quantity -2, puts red colour and when it is +2 puts it on green colour.

I want to make the same in my query. To put red and green fields when the quantity was negative or positive. Is this possible?.

Thanks.

5 REPLIES 5
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
665

want to make the same in my query --> Do you mean in your select or you are tyring to display the o/p ....

Read only

Former Member
0 Likes
665

hi...

to give such colouring

you can use this thing in your report

if quan > 0.

format color positive.

write: quan.

format color off.

endif.

if quan < 0.

format color negative.

write: quan.

format color off.

endif.

to make this query as TCODE you have to go to se80 and give the name of the report ( in which you have performed query ) there in you can create a TCODE for a report.

Read only

0 Likes
665

Thanks. It's a clue. The second part (to create a t-code) was known by me already. This wasn't my question but the first part yes.

I've tested it, but it doesn't works. When i write the coding into my added query field it tells me the next:

'COLOR POSITIVE" is not expected; only 1 to 7 or the relevant color. IDs (COL_...) are allowed.'

I've tested with 1 to 7 colours too, but nothing. My query added field says:

CLEAR ZCTD.

IF MSEG-SHKZG = 'S'.

ZCTD = MSEG-ERFMG.

ELSE.

ZCTD = - MSEG-ERFMG.

ENDIF.

if ZCTD > 0.

format color 1.

write: ZCTD.

format color off.

endif.

if ZCTD < 0.

format color 2.

write: ZCTD.

format color off.

endif.

Any ideas??

Read only

Former Member
0 Likes
665

Not solved

Read only

0 Likes
665

JLS:

If you question wasn't answered....why did you close it?

And this code works perfect for me...


DATA: test TYPE string.

test = -2.

IF test GT 0.
  FORMAT COLOR 1.
  WRITE:/ test.
  FORMAT COLOR OFF.
ELSE.
  FORMAT COLOR 5.
  WRITE:/ test.
  FORMAT COLOR OFF.
ENDIF.

Greetings,

Blag.