02-28-2014 4:03 AM
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.
02-28-2014 4:07 AM
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
02-28-2014 4:07 AM
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
02-28-2014 4:14 AM
02-28-2014 4:17 AM
Activate the entire program and run the TCode once again.
Arivazhagan S
02-28-2014 4:20 AM
02-28-2014 4:07 AM
Hi,
Did you checked the attributes of screen painter's > Dict> Format > DEC ?