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: 

Allowing Decimals on Screen Painter imported Variable fields

Former Member
0 Kudos

I created this program using the screen painter, the program works but decimals don't work (doesn't allow them nor does the result screen use them) despite the fact that globally defined variables are defined with decimals like so:

DATA: value1 type p DECIMALS 2,
          value2 type p DECIMALS 2,
          result type p DECIMALS 2.

At this point I've set the imported fields as currency type. I dunno if theres anything I need do to the PAI module to make decimals work, but heres my coding on that anyway:

MODULE USER_COMMAND_0100 INPUT.
CASE sy-ucomm.
  WHEN 'OPAD'.
      result = value1 + value2.
      leave to screen 0200.
  WHEN 'OPSU'.
      result = value1 - value2.
      leave to screen 0200.
  WHEN 'OPMU'.
      result = value1 * value2.
      leave to screen 0200.
  WHEN 'OPDI'.
      result = value1 / value2.
      leave to screen 0200.
  WHEN others.
      leave program.
ENDCASE.
ENDMODULE.

Am I doing anything wrong? Why are the decimals not working? Thanks in advance.

1 ACCEPTED SOLUTION

arivazhagan_sivasamy
Active Contributor
0 Kudos

Hi James,

You need to mention the data type as decimal in screen painter for the fields value1, value2 and value3.

That is, in attribute-> format -> select as DEC.

Arivazhagan S

5 REPLIES 5

arivazhagan_sivasamy
Active Contributor
0 Kudos

Hi James,

You need to mention the data type as decimal in screen painter for the fields value1, value2 and value3.

That is, in attribute-> format -> select as DEC.

Arivazhagan S

0 Kudos


done that now, decimals not working still.

0 Kudos

Activate the entire program and run the TCode once again.

Arivazhagan S

0 Kudos

ah its working now, thankyou

former_member198275
Active Contributor
0 Kudos

Hi,

Did you checked the attributes of screen painter's > Dict> Format > DEC ?