2008 Feb 21 12:17 PM
Following is the issue, I want to write l_char to l_quan, The following code is throwing a dump error.
Write and Move are not working.
Please solve this for me.
data : l_char(18),l_quan type kwmeng.
l_char = '123,456.000'.
l_quan = l_char.
write : l_quan.
<REMOVED BY MODERATOR>
-Veeru.
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 3:28 PM
2008 Feb 21 12:21 PM
Try this -
in this case, WRITE TO will not work, as you are sending CHAR value to a numeric field.
here is the logic i followed to overcome the (user settings of comma(,) and DOT(.))
DATA : V_WEIGHT TYPE LTAP-BRGEW,
V_WT_CHAR(21) TYPE C.
assume you have weight value in a CHAR field.
v_WT_CHAR = '21,987.258'.
here your requirement is to push this value to a weight field.for that follow this,
REPLACE ALL OCCURRENCES OF ',' IN V_WT_CHAR WITH ''.
REPLACE ALL OCCURRENCES OF '.' IN V_WT_CHAR WITH ''.
CONDENSE V_WT_CHAR.
MOVE V_WT_CHAR TO V_WEIGHT.
V_WEIGHT = V_WEIGHT / 1000.
now your V_WEIGHT will have value '21987.258' (as it stores in INTERNAL format)
~ As found in forum.
Regards,
Amit
Following is the issue, I want to write l_char to l_quan, The following code is throwing a dump error.
Write and Move are not working.
Please solve this for me.
data : l_char(18),l_quan type kwmeng.
l_char = '123,456.000'.
l_quan = l_char.
write : l_quan.
<REMOVED BY MODERATOR>
-Veeru.
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 3:28 PM
2008 Feb 21 12:20 PM
Hello Veerendranath,
SAP is throwing dump because you are tring to assign a value containing ',' and '.' to a quantitiy field. Please remove the ',' and '.' and try it should work.
Regards
Farzan
2008 Feb 21 12:21 PM
Try this -
in this case, WRITE TO will not work, as you are sending CHAR value to a numeric field.
here is the logic i followed to overcome the (user settings of comma(,) and DOT(.))
DATA : V_WEIGHT TYPE LTAP-BRGEW,
V_WT_CHAR(21) TYPE C.
assume you have weight value in a CHAR field.
v_WT_CHAR = '21,987.258'.
here your requirement is to push this value to a weight field.for that follow this,
REPLACE ALL OCCURRENCES OF ',' IN V_WT_CHAR WITH ''.
REPLACE ALL OCCURRENCES OF '.' IN V_WT_CHAR WITH ''.
CONDENSE V_WT_CHAR.
MOVE V_WT_CHAR TO V_WEIGHT.
V_WEIGHT = V_WEIGHT / 1000.
now your V_WEIGHT will have value '21987.258' (as it stores in INTERNAL format)
~ As found in forum.
Regards,
Amit
2008 Feb 21 12:24 PM
Don't pass ',' or '.' into the quan field ..
Pass like this ...
l_char = '123456000'.
l_quan = l_char.
l_quan = l_quan / 1000.
2008 Feb 21 12:26 PM
hi
good
data : qty type p decimals 2,
ch(10) type c value '10'.
move ch to qty.
may be this will be helpful to u.
or try the FM
CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'
EXPORTING
dmzei = ','
dtype = 'CURR'
efeld = input
IMPORTING
error = error
ifeld = output
messg = messg
msgln = msgln.
<REMOVED BY MODERATOR>
thanks
mrutyun^
Edited by: Alvaro Tejada Galindo on Feb 21, 2008 3:28 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |