‎2013 Sep 26 8:12 PM
Hey guys,
I have an ALV Grid that needs to display a column of numbers with a percent at the end and any negative values in the front.
-35.4%
8.7%
13.4%
-100.3%
8732.9%
This was done, but while within the ALV, if they click on the sorting buttons, it does not sort correctly.
It is because the system column HAS to be a string to display it like it is, but as a string it sorts differently from how numbers sort.
Has anyone come up with a solution to this?
‎2013 Sep 27 3:16 PM
Hi,
I did a small test using CONVERSION_EXIT.
Here is the output:
Regards.
‎2013 Sep 26 10:41 PM
Why dont you put '%', eg Marks in % ,in the heading of the column and put just the values in column?
Your issue would be solved.
Regards,
Susmitha
‎2013 Sep 27 1:12 PM
That's similar to the answer I proposed, I added a new column with % in the column.
BUT they still want the - sign to be in front of the number, not behind the number.
In order to put the - sign in front, I have to use strings. Which gives me the exact same problem I had before; SAP uses the sorting rules for strings, not for numerics.
Because the % is at the end, it is a constant and I can find work arounds for it.
But to have the negative symbol in front of the string causes the problems.
‎2013 Sep 27 3:35 AM
If we convert its type by NUMC i thing then also it will work. Just give a try.
BR
ChanS
‎2013 Sep 27 4:08 AM
Hi Tom
I agree with "Susmitha's" reply please go through that one your issue will resolve.
Regards,
Krishna Chaitanya.
‎2013 Sep 27 4:21 AM
Hi Tom Neikam,
Put '%' in Field Text instead of displaying in filed ,
Remove % in column
Display values lie this
Field Name %
-35.4
8.7
13.4
-100.3
8732.9
instead of
Field Name
-35.4%
8.7%
13.4%
-100.3%
8732.9%
‎2013 Sep 27 1:14 PM
This does not fix the problem, because I still have to use strings to move the negative sign.
‎2013 Sep 27 6:12 AM
Hi,
If the end customer insist that you use the format 13.4% .
You can hold your data as numeric (for sorting).
Create your own CONVERSION_EXIT_PRCNT_OUTPUT and put ==PRCNT in the EDIT_MASK for this field in the field catalog .
Use can use the edit_mask of in the field catalog for formatting the output.
http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649baf17411d2b486006094192fe3/content.htm
http://help.sap.com/saphelp_erp2004/helpdata/en/33/206bc8012e11d3b495006094192fe3/content.htm
Regards.
‎2013 Sep 27 3:16 PM
Hi,
I did a small test using CONVERSION_EXIT.
Here is the output:
Regards.
‎2013 Sep 27 3:20 PM
‎2013 Sep 27 3:28 PM
Hi ,
Some blood some sweat some tears some luck.....
I will upload the code shortly.
Regards.
‎2013 Sep 27 3:43 PM
‎2013 Sep 27 3:51 PM
Hi,
Function: (Any CONVERSION_EXIT_????_OUTPUT can be used as a skeleton)
Code:
FORM conversion_yts01
USING
p_input
CHANGING
p_output .
DATA: buffer_1 TYPE char32 .
WRITE p_input TO buffer_1 NO-SIGN NO-ZERO RIGHT-JUSTIFIED .
IF p_input IS INITIAL .
p_output = space .
RETURN.
ENDIF .
CONDENSE buffer_1 .
CONCATENATE '+' buffer_1 '%' INTO buffer_1 .
IF p_input LT 0 .
WRITE '-' TO buffer_1+0(1) .
ENDIF .
CONDENSE buffer_1 .
p_output = buffer_1 .
ENDFORM. " CONVERSION_YTS01
Program:
In this case I use CL_SALV_TABLE ALV but this will work also in other ALV.
Just use the EDIT_MASK in the field catalog.
Full source included.
Regards.