‎2010 Jul 02 12:43 PM
hi
I have two structures, x_autwr and y_autwr, here the problem is data type of x_autwr is CURR ,15 and y_autwr is DEC, 23.
now when I write
x_autwr = y_autwr it gives an errornous data, for eg if the value of Y-autwr is 2000.0000, it transforms to x_autwr and makes it 200000.00,
PLease note that I cannot change the data type as its from standard, but I have tried taking to local variables of type i, c , or decimal of type 2,or divide by 100, but still no logic works.
Please help.
‎2010 Jul 02 12:47 PM
Hey ,
there is a mismatch in your query , once u say they are structures , and next u r saying there data types. Please correct the question.
what do you need to achieve please specify that. that is the what format the value you expect in x_autwr , specify that .
So that I can help you.
Regards,
Uma Dave
‎2010 Jul 02 12:52 PM
I want to convert a variable(y_autwr) of data type decimal, 23 to a variable (x-autwr)of currency,15.
the e.g in my scenario is when
x_autwr = y_autwr, then it should take the correct value, so if y_autwr = 2000 then x_autwr shouldnt be any other value than 2000.
Please note these are just example, so please go by the content.
‎2010 Jul 02 12:57 PM
Hey u can do that
by maing use of a intermediate variable of type string.
str_temp type string.
str_temp = y_str.
x_str = str_temp.
Hope this will resolve your problem.
Regards,
Uma Dave
‎2010 Jul 02 1:29 PM
No
it doesnt solve my problem, as I said earlier I have use of local variables of type C, D, String. Nothing works.
for everything it gives error data with wrong decimal point.
l_amount_in type string,"p DECIMALS 2,
l_amount_out TYPE string
l_amount_in = ccaut_save-autwv.
l_amount_out = ccaut_out-autwr.
xfplt-autwv = ccaut_save-autwv.
xfplt-autwr = ccaut_out-autwr.
this value in XFPLT comes as 200000.00. when ccaut_save-autwv value is 2000.000
‎2010 Jul 02 1:01 PM
Hi,
Use the local varibales and make use of offsets or use conversion so that source and destination length will be same.
Regards,
Pravin
‎2010 Jul 02 1:12 PM
I think this assignment is not correct. The CURR fields are always associated with a CUKY, do you have the currency key with you ?
If yes, then you can try this logic:
x_autwr = y_autwr.
DATA:
l_corr_factor TYPE i,
ls_bapi1090_1 TYPE bapi1090_1.
CALL FUNCTION 'BAPI_CURRENCY_GETDECIMALS'
EXPORTING
currency = v_waers "Your Currency key field
IMPORTING
currency_decimals = ls_bapi1090_1.
l_corr_factor = 10 ** ( lf_bapi1090_1-curdecimals ).
x_autwr = x_autwr / l_corr_factor.BR,
Suhas
‎2010 Jul 02 1:22 PM
Hi,
This problem is because of the decimal places. Try using "write to" instead of '=' with decimals edition. Check how to use it from ABAP keyword documentation.
write y_autwr to x_autwr decimals 4.should work.
Edited by: Gungor Ozcelebi on Jul 2, 2010 2:22 PM
‎2010 Jul 02 1:51 PM
‎2010 Jul 02 2:01 PM
Hello Raymond,
In either case we need to have the currency key defined. Correct ?
BTW i was wondering if we can use the
WRITE ... TO ... CURRENCY ...option.
BR,
Suhas
‎2010 Jul 02 2:14 PM
Hi Suhas
Please help me, I tried your solution, one of the structure has currency field , another one doesnt.
if I try to equate them still it doesnt work,
What shall I do?