cancel
Showing results for 
Search instead for 
Did you mean: 

problem in code

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Put this code:

REPLACE ALL OCCURRENCES OF ',' IN IN_TAB-VALUE WITH ' '.

condense IN_TAB-VALUE no-gaps.

v_total = in_tab-value.

Points appreciated.

Answers (0)