2015 Nov 17 6:19 AM
Hello every body. I work with this statement seldom and it is not problem. But I try execute next snip of code for study aim.
REPORT ztest.
TYPES float TYPE p LENGTH 6 DECIMALS 0.
DATA a TYPE c LENGTH 1000.
DATA b TYPE float.
FIELD-SYMBOLS <value> TYPE x.
FIELD-SYMBOLS <value_new>.
ASSIGN a(6) TO <value> CASTING.
b = 1200.
<value> = b.
ASSIGN a(6) TO <value> CASTING.
ASSIGN <value> TO <value_new> CASTING DECIMALS 0.
WRITE <value_new>.
On screen out value '4;' , but I wait 1200. Pls, explain me this answer.
2015 Nov 17 7:04 AM
Hi Ivan
Change your declaration statement for <value> to be as follows and you problem will be solved :
FIELD-SYMBOLS <value> TYPE float.
Hi Ivan
Change your declaration statement for <value> to be as follows and you problem will be solved :
FIELD-SYMBOLS <value> TYPE float.
2015 Nov 17 7:04 AM
Hi Ivan
Change your declaration statement for <value> to be as follows and you problem will be solved :
FIELD-SYMBOLS <value> TYPE float.
2015 Nov 17 7:51 AM
Thanks for your answer and correct solution, but why my example don't work. I my mind program do next: 0x0000000004B0(hex code of 1200) save in char area, and after that do back transform to dec value. Where am I mistake?
2015 Nov 17 9:12 AM
I seems understand. Assignment statement doesn't do any transformation. It is only reflect byte sequence to field symbol. Abap inside hex code for value 1200 - 00000001200C, not 0000000004B0.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |