‎2008 Sep 02 5:59 PM
Hi Experts,
In my code below, i getting a short dump as unable to interpret 1,000 .00 as a number
lv_atwrt has to be type c & lv_qty1 has to be type n.
data : lv_cval(10) type n,
lv_qty1(10) type n,
lv_qty2 type dzmeng,
lv_atwrt(10) type c,
lv_qty3 type p.
lv_atwrt = '1,000.00'.
lv_qty1 = 10000.
write : lv_atwrt to lv_cval.
shift lv_qty1 left deleting leading '0'.
*lv_cval = lv_atwrt.
lv_qty2 = lv_qty1 / lv_cval. --> short dump
write lv_qty2.
i am getting a short dump if change lv_cval to type P.
pls tell me where am i wrong?
Thanks
Dan
‎2008 Sep 02 6:04 PM
‎2008 Sep 02 6:14 PM
Hi,
Comma (,) is unavoidable in lv_atwrt = '1000.00' as this is a value returned by an FM.
Any other suggestions plss.
Thanks
Dan
‎2008 Sep 02 6:40 PM
Which FM are you talking about? The output variable of the FM will not have the Comma during code execution, its only when it displays the output in the GUI it gets the user preferences and displays the comma.
‎2008 Sep 02 7:06 PM
Hi,
I am yaking abt FM: VC_I_GET_CONFIGURATION. the field lv_atwrt resembles the ATWRT field in the structure CONF_OUT.
Pls suggest.
‎2008 Sep 02 7:08 PM
Hi,
I am yaking abt FM: VC_I_GET_CONFIGURATION. the field lv_atwrt resembles the ATWRT field in the structure CONF_OUT.
Pls suggest.
‎2008 Sep 02 7:08 PM
Hi,
I am yaking abt FM: VC_I_GET_CONFIGURATION. the field lv_atwrt resembles the ATWRT field in the structure CONF_OUT.
Pls suggest.
‎2008 Sep 02 6:59 PM
data : lv_cval(10) type n,
lv_qty1(10) type n,
lv_qty2 type dzmeng,
lv_atwrt(10) type c,
lv_qty3 type p.
lv_atwrt = '1,000.00'.
lv_qty1 = 10000.
write : lv_atwrt to lv_cval.
shift lv_qty1 left deleting leading '0'.
*lv_cval = lv_atwrt.
Begin of Change
translate lv_cval using ', '.
condense lv_cval no-gaps.
End of Change
lv_qty2 = lv_qty1 / lv_cval. "--> No short dump
write lv_qty2.
Execute the above code you will not get dump .
Your issue is solved !!!!
Result : 10.000
Thanks,
Karthik
‎2008 Sep 02 7:03 PM
Hope the result of the program and you award points will be same .
‎2008 Sep 02 7:16 PM
ATWRT is of type char and size 30 so whats the problem still my code will work !!!!
data : lv_cval(10) type n,
lv_qty1(10) type n,
lv_qty2 type dzmeng,
lv_atwrt like conf_out-atwrt, ( I have referenced to the same type as you mentioned )
lv_qty3 type p.
lv_atwrt = '10,999,80,000.00'. ( Since its size is 30 i m adding few more comma's run the program and see you will not get any dump )
lv_qty1 = 10000.
write : lv_atwrt to lv_cval.
shift lv_qty1 left deleting leading '0'.
*lv_cval = lv_atwrt.
translate lv_cval using ', '.
condense lv_cval no-gaps.
lv_qty2 = lv_qty1 / lv_cval. "--> short dump
write lv_qty2.
Note : output will be 0.009 ( Less because we are using higher value in the denominator )
Thanks,
Karthik
‎2008 Sep 02 8:02 PM
Hi karthik,
It helped me to some extent.
when i use
*write : lv_atwrt to lv_cval. commented and used as below
lv_cval = lv_atwrt.
the result is different.
when lv_atwrt = 1,000.00
lv_cval will hold 1000000.00
why is this so?
code :
data : lv_cval(10) type n,
lv_qty1(10) type n,
lv_qty2 type dzmeng,
lv_atwrt(10) type c,
lv_qty3 type p.
lv_atwrt = '1,000.00'.
lv_qty1 = 10000.
*write : lv_atwrt to lv_cval.
lv_cval = lv_atwrt.
shift lv_qty1 left deleting leading '0'.
*lv_cval = lv_atwrt.
translate lv_cval using ', '.
condense lv_cval no-gaps.
lv_qty2 = lv_qty1 / lv_cval. "--> No short dump
write lv_qty2.
‎2008 Sep 02 8:06 PM
When you move the data using the WRITE, system writes the data to the target variable in the FORMATTED way, same as you would use the WRITE statement to write the contents on the screen. So, system gives you the vlaue in the target field with the Comma.
If you use MOVE or VAR1 = VAR2, system moves the data without formatting.
Regards,
Naimesh Patel
‎2008 Sep 02 8:17 PM
i m not getting the value what you say ...
the result is different.
when lv_atwrt = 1,000.00
lv_cval will hold 1000000.00
data : lv_cval(10) type n,
lv_qty1(10) type n,
lv_qty2 type dzmeng,
lv_atwrt like conf_out-atwrt,
lv_qty3 type p.
lv_atwrt = '1,000.00'.
lv_qty1 = 10000.
*write : lv_atwrt to lv_cval.
lv_cval = lv_atwrt.
write lv_atwrt.
skip.
write lv_cval.
result :
1,000.00
0000100000
Pls check with the above code .
‎2008 Sep 02 8:46 PM
Karthik -
data : lv_cval(10) type n,
lv_qty1(10) type n.
i mean to say that when assigning like this : lv_cval = lv_atwrt.
lv_cval will hold 0000100000 instead of 1000.00 (while in debugging) can be seen in debugging.
Can you pls tell me why is this so?
‎2008 Sep 02 8:56 PM
How can a number data type will hold a decimal value , that's why.
Thanks,
Karthik
‎2008 Sep 02 9:47 PM