2010 Mar 04 10:09 AM
Hi,
I am aware of NO_ZERO='X' solution but it hides all zeros in certain column.
What I want to do is hide zero values but only for certain rows ?
i.e. I have columns A, B, C, all numerical (like mseg-dmbtr)
A B C
0 2 [empty]
2 2 0.00
2 1 1.00
C is empty if A = 0
C is 0.00 if A=B
otherwise C = A-B
I'd like to solve it by not converting the fields into character fields.
Any clues ?
Thanks in advance,
Bart
2010 Mar 04 10:43 AM
Hello,
I am aware of NO_ZERO='X' solution but it hides all zeros in certain column.
Possibility 1 ruled out completely.
I'd like to solve it by not converting the fields into character fields.
You don't want to take this approach.
You must be aware character type variables have ' ' (space) as initial values (TYPE I, P, NUMC have zeroes as initial value) so i think that you can achieve this defining Column C as character.
May be other SDNers have some better ideas. Lets see !!!
BR,
Suhas
2010 Mar 04 11:02 AM
Hi Suhas,
Thats a remedy
But surely the user will come saying the sum functionality of that particular field is not working.
2010 Mar 04 11:04 AM
Hi,
The user is aware of sum problems thus I stated:
"I'd like to solve it by not converting the fields into character fields."
Cheers,
Bart
2010 Mar 04 11:15 AM
Check what sourav has suggested here
Just try
if input = '0.00' or input is initial.
output = ' '.
endif.
2010 Mar 04 11:18 AM
Create a fourth column in your internal table named D. Declare that column as Character. Put that new column in your fieldcatalog, dont put colum C in your fieldcatalog.
Right before displaying loop over your table:
loop at it_out assigning <p>.
if <p>-a is initial.
clear <p>-d.
elseif <p>-a = <p>-b.
<p>-d = '0.00'.
else.
tmp = <p>-a - <p>-b.
write tmp to <p>-d.
endif.
endloop.
2010 Mar 04 11:36 AM
@ Rainer Hübenthal
Final column D will still be character thus no sums right?
@ Mohaiyuddin Soniwala
Sorry, I forgot to mention, it's not OOALV.
@ Sourav Bhaduri
Very clever idea, however, inside the conversion exit I will not be able to distinguish whether the zero value should be displayed or not. I might use some magic value and put it into cell for conversion exit but then SUM would sum those values as well.
2010 Mar 04 11:45 AM
Yes its still character and cant be summed up. I cant see any possibility using the FM LIST_DISPLAY.
With GRID_DISPLAY there might be another solution. For every cell you can have separate colors, search the wiki for that. Setting foreground color to background color will make the content invisible. Dont know if its bpossible to set foreground color, but may its working.
2010 Mar 04 11:57 AM
Hi,
Sounds interesting. How do I set foreground color of a cell ?
I know how to set background color of row via:
l_layout-info_fieldname = 'KOLOR'.
or cell/row background color via:
l_layout-coltab_fieldname = 'KOLOR'.
I don't know how to set foreground color though.
Btw i use REUSE_ALV_GRID_DISPLAY.
Cheers,
Bart
2010 Mar 04 12:02 PM
[As i said, search the wiki|http://wiki.sdn.sap.com/wiki/display/Snippets/ColorindividualcellsofanALVGRID], i'm sure you find an entry on how to color individual cells using the GRID_DISPLAY FM.
But. just an idea, dont know if its possible to set foreground color.
2010 Mar 04 12:07 PM
Hi,
I misunderstood your sentence a bit. Been to wiki already, but it's background color which is set set there. I've never seen font color changed in ALV.
Cheers,
Bart
2010 Mar 04 12:11 PM
i_color in output table should be 4 characters
character 1: Always C
character 2: number between 1 and 7
character 3: 1 or 0 (intensified or not)
character 4: 1 or 0 (1 sets background as normal and colors text)
2010 Mar 04 12:11 PM
How do I set foreground color of a cell ?
ALV Hide zero in certain row
I guess that this thread will get locked.
2010 Mar 04 12:18 PM
Hi,
Sorry, went out of topic a bit. (Rainer Hübenthal that colours row and doesn't affect font color)
So far solution giving some hope is to use the conversion exit (Sourav Bhaduri). My field has 2 decimal places. I'll raise its precision, put a marker on let's say 8th decimal place and on it's base I'll decide whether to display the (FAKE) zeros in cell or not. Output conversion will then strip the number back to 2 decimal places for display. I doubt I'll be having that many records so that the sum of markers will affect 2nd decimal place.
Cheers,
Bart
2010 Mar 04 2:09 PM
I hope the business requirement is worth all this effort!
matt
2010 Mar 04 2:13 PM
> I guess that this thread will get locked.
OP is looking for a solution to an interesting problem, uses a meaningful subject, is being polite, follows up on the replies...perfect
I personally don't see a way of doing this using the REUSE_... function modules.
Maybe it can be done via the CL_SALV... classes, but I'm not enough of a geek in that area. Anybody?
Thomas
2010 Mar 04 2:23 PM
Hi,
Some times back,
The threads which were diverted into a different question from the actual question was locked and warned by Rob
It was stated to post the new question in a new thread
Regards,
Keshav
2010 Mar 04 2:27 PM
Possibly, but here we're still looking for a solution to the original problem, and the positive aspects outweigh, in my opinion.
Shouldn't stop you from keeping your eyes open, thanks for your ongoing help.
Thomas
2010 Mar 04 11:24 AM
I haven't tried this but you may give it a try and let us know.
SET_ZERO method of CL_SALV_COLUMN.
I think this is as good as no_zero....I don't think it is possible to display 0.00 in such cases...For a change you may color such cells to distinguish them
Regards,
Mohaiyuddin
Edited by: Mohaiyuddin Soniwala on Mar 4, 2010 5:01 PM
2010 Mar 04 11:25 AM
hiiiiiiiiiiii
use alv grid display
and use wa_fieldcatalog-no_zero = 'X'.
2010 Mar 04 11:27 AM
>
> hiiiiiiiiiiii
> use alv grid display
> and use wa_fieldcatalog-no_zero = 'X'.
Nonsense. This will affect all rows, and this is against requirement.
2025 Mar 14 1:08 PM
Hi,
Proposal : Use (not only color but) style with ALV_STYLE_CHECKBOX_NO '00060000' from INCLUDE <CL_ALV_CONTROL>.
Regards
Pierre
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |