Application Development 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: 

ALV Grid ColumnType F display

IanStubbings
Active Participant
0 Kudos

All

Easy one this surely...

I wish to display a column in the ALV grid formatted to 2 decimal places with no exponent. Therefore, as the doucmentation suggests, I have specified the following in my field catalog definition:

if p_fieldname = 'PERCENT'.

gs_fieldcat-decimals_O = '2'.

gs_fieldcat-exponent = '0'.

endif.

The field percent is defined as type f.

However, both fields are completely ignored and I have resulted in creating another type c column and WRITEing the result into it. The if statement is sound as I debugged it and all is well. I added the gs_fieldcat-exponent-key = 'X' option to test it as well and this was fine. I have also tried the two options on their own but no difference, I still get 1.000000000E01 etc

What am I missing? I am on 46B BTW.

Any clues?

Ian

5 REPLIES 5

Former Member
0 Kudos

Hi,

<b>check with the reference field</b> for the column PERCENT.

0 Kudos

Hi Judith

THanks for the reply. I do not have a reference field for the PERCENT field it is directly typed as F.

TYPES: BEGIN OF ty_outtab,

plant type qals-werk,

lot TYPE qals-prueflos,

customer TYPE qals-zz_cust_name,

project TYPE qals-zz_project_name,

year(4) TYPE c,

month(3) TYPE c,

total TYPE i,

passed TYPE i,

failed TYPE i,

-> percent type f,

percentc(12) type c,

END OF ty_outtab,

0 Kudos

Hello Ian,

looks like ALV is converting your field from type f to Type c.

What happens if you try a field "Data: percentp type p decimals 2" and "percentp = percent" ?

Regards Wolfgang

0 Kudos

As u r using percent type f,

it will come as <b>exponent</b>

Try to convert this type before passing into the output table.

0 Kudos

Hi all

As you can see from the original code snippet:

failed TYPE i,

percent type f,

percentc(12) type c,

END OF ty_outtab,

I created another column percentc. I used this to produce the output I wanted. I didn't see as though I should have to do this though when the field catalog has the fields to determine the style of output formatting.