Hi SAP Gurus.....
I am trying to Concatenating '$' to an amount field in ALV Grid....I am assigning '$' as first char of amount field taken as char.....
But some time allignment of digits & '$' is not proper as
'$' need to present only at first pos irrespective of length of amount field....
Pl suggest some way out.....
Thanks in advance
Regards,
Gaurav
Hello Gaurav,
You have said that <i>sometimes</i> there is a problem with the alignment. That is somewhat vague to understand completely. Could you provide the specific example where it is not appearing correctly? Also paste the code here, so that we can analyze it better.
Regards,
Anand Mandalika.
Hi,
Try this you will get the answer with required spaces.
TABLES: vbak.
DATA: temp1 LIKE vbak-netwr,
temp2(15) type c,
temp3(17) type c.
temp1 = 245666.
write:/ temp1.
temp2 = temp1.
concatenate '$' ' ' temp2 into temp3.
write:/ temp3.
temp1 = 666.
write:/ temp1.
temp2 = temp1.
concatenate '$' ' ' temp2 into temp3.
write:/ temp3.
just concatenate the value as shown above.
Regards,
Kathirvel.
Hello Gaurav,
I think, it can be solved with only 1 line source code.
WRITE: amount TO wchar USING EDIT MASK 'RR$ _________________'.
grx Andreas
The problem is with the ALV Grid display.
The solutions presented here will correctly format the data with a dollar sign, and if you are doing a traditional list display, then you are good to go. But if you display the data in an ALV Grid, the data is displayed with a proportional font. A space takes up less room than a digit so 2 character fields with a different number of spaces, will display with different total lengths.
I am playing around with the idea of using a non-display character instead of a space. I would need a non-display character that takes up the same amount of room as a digit. No luck so far, any ideas?
I looked around for an ALV option to change the font but no luck.
No luck on the unprintable character.
You can default to left justified and get the $'s to line up but the digits will not line up.
You can set the JUST parameter in the field catalog to the value 'R' and get the field right justified and then the digits will line up but the $'s will not line up.
You can use the underscore character instead of spaces between the digits and the $. It appears to use the same amount of room as the digits. Be careful of any commas because then the proportional problem appears again.
You can put a $ in a 1 character field in front of the number, then present the number right justified without a $.
Any better solutions out there?
Add a comment