cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Decimals in Smartform not working

aidan_mulcahy
Active Participant
0 Kudos

Hi,

I use

&struc-field(C)&

to hide decimals in a SF.

The type of this field is LGMNG.

This code works for all instances, except when the UOM is type ROL (Role). I have put a break-point in the SF just before the value is output and they are identical.

But the output would be, for example say five units:

a) 5 SH (Correct)

b) 5,000 ROL (incorrect)

Anyone seen this before?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The option (C) is used to surpress spaces, not decimals. You need to use (.0) to remove decimals.

What you are seeing is the field being formatted to match the number of decimal places configured against the unit of measure.

Regards,

Nick

aidan_mulcahy
Active Participant
0 Kudos

Nick,

thanks for the reply. I tried both of these already:

&struc-field(.0)&
&struc-field(C.0)&

And, for both, I am told at runtime that (.0) is not a correct "formatting option for the field struc-field".

I'm going to put a code block in to convert to an integer and display that. It will work - I just thought that (C) or (.0) would work too?

Thanks.

Former Member
0 Kudos

Hi,

(C) won't work to supress decimals, but (.0) should against a field of type LGMNG. But I can't think of a reason why it wouldn't in this case.

Regards,

Nick

aidan_mulcahy
Active Participant
0 Kudos

Thanks Nick.

So 'C' compresses the spaces but not necessarily decimals - that comes from the definition of the UOM (ROL - in this case)?

Yes, it's strange that (.0) is not working - I have used it on other projects. We are on ECC6.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

u create program lines & declare another variable of type P with decimals as 0, then move the value to this variable & print it.

eg:

data : lv_field(13) TYPE p decimals '0'.

lv_field = struct-field.

P1 &lv_field(C)&

Hope it helps!!

Rgds,

Pavan

aidan_mulcahy
Active Participant
0 Kudos

Thanks Pavan.

I declared a type 'i' and put the value in there. The requirement is to have only an integer value so if it is 123.987 the output should be 123. I used trunc for this.

I will close this now but am curious if anyone had the same issue with (.N) not working at runtime.....

Thanks for your help.