‎2008 Jul 30 4:29 PM
Hi,
Below given is the code in the perform.
I am calling this perform from the script. It is giving me dump at the below given place.
************************************************************************************************
FORM convert_currency TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA: i_curr LIKE vbdkr-waers,
v_sysdate(10),
v_date(10),
V_TOTAL_CHAR(255) type C,
v_excgrate type P decimals 5,
v_total type P decimals 5.
Delivery date
READ TABLE in_tab WITH KEY 'VBDKR-WAERK'.
IF sy-subrc IS INITIAL.
i_curr = in_tab-value.
v_sysdate = sy-datum.
CONCATENATE v_sysdate4(2) '/' v_sysdate6(2) '/' v_sysdate+0(4) into
v_date.
ENDIF.
PO date
READ TABLE in_tab WITH KEY 'INVOICE_TOTAL'.
IF sy-subrc IS INITIAL.
********************************************************************************************
Here in_tab- value is char 255. It is having a numerical value passed from script and v_total is type P decimal 5. when I am writing the in_tab-value to v_total it is copying some junk value in v_total.
WRITE in_tab-value to v_total.
*********************************************************************************************
v_total = in_tab-value.
ENDIF.
CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
CLIENT = SY-MANDT
DATE = SY-DATUM
FOREIGN_CURRENCY = i_curr
LOCAL_CURRENCY = 'SGD'
TYPE_OF_RATE = 'M'
IMPORTING
EXCHANGE_RATE = v_excgrate
FOREIGN_FACTOR =
LOCAL_FACTOR =
VALID_FROM_DATE =
DERIVED_RATE_TYPE =
FIXED_RATE =
EXCEPTIONS
NO_RATE_FOUND = 1
NO_FACTORS_FOUND = 2
NO_SPREAD_FOUND = 3
DERIVED_2_TIMES = 4
OVERFLOW = 5
OTHERS = 6
.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*********************************************************************************************
here proj is giving DUMP. both v_total and v_excgrate are type P decimal 5.
when I am multiplying the total with excahnge rate it is giving dump.
v_total = v_total * v_excgrate.
**********************************************************************************************
WRITE v_total TO v_total_char.
condense v_total_char.
LOOP AT out_tab.
CASE out_tab-name.
WHEN 'CURR'.
MOVE 'SGD' TO out_tab-value.
WHEN 'TOTAL'.
WRITE v_total_char TO out_tab-value.
WHEN 'EXCHRATE'.
MOVE v_excgrate TO out_tab-value.
ENDCASE.
MODIFY out_tab.
ENDLOOP.
ENDFORM. " FORMAT_DATE
Please help.
regards,
Gaurav.
‎2008 Jul 30 5:10 PM
Hello Gaurav,
While using WRITE.. TO statement, the target is a text variable.
You are multiplying the text with another number. So you are getting dump.
Instead of using WRITE.. TO, use MOVE.
And see that while multiplication, both are numeric fields with valid values
Hope it helps you
Regards
Indu.
‎2008 Jul 30 4:33 PM
UR passing in_tab-value to v_total .. and U say it's coping
some junk value ..
when U multiply some junk value it will give dump ...
It would be giving Unable to interpret '' as a number ...
‎2008 Jul 30 5:10 PM
Hello Gaurav,
While using WRITE.. TO statement, the target is a text variable.
You are multiplying the text with another number. So you are getting dump.
Instead of using WRITE.. TO, use MOVE.
And see that while multiplication, both are numeric fields with valid values
Hope it helps you
Regards
Indu.
‎2008 Jul 30 5:44 PM
Hi Gaurav,
Please don't cross-post => [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement].
Cheers,
Julius