09-17-2008 8:32 AM
HI,
i am passing one currency value to the character variable . durnig the runtime it is not moving this currence value to a character variable .
i am using this in scrpt , in script editor i am using perform zform program zpro.
routine zform using table in_tab structure itcsy,
out_tab structure itcsy.
here i am moving currence value to character variabl , during the runtime it is not moving the currency value.
plz let me know the reason clearly.
09-17-2008 8:33 AM
see carefully the below example of subroutine pools:
*&---------------------------------------------------------------------*
*& Report ZDUNNING
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDUNNING.
form z_get_interest tables int_cond structure itcsy
outt_cond structure itcsy.
data: value type SALFW,
* value1 type p DECIMALS 2,
* value2 type p DECIMALS 2.
value1 type salfw,
value2 type salfw,
value3 type salfw.
data: SMAHSK type c.
data: days(5) type n.
"value1 type salfw.
data: valuec type c.
read table int_cond with key 'F150D-SALFW'.
if sy-subrc = 0.
*pack int_cond-value to value." FM added and commented by amit
CONDENSE int_cond-value NO-GAPS.
CALL FUNCTION 'MOVE_CHAR_TO_NUM'
EXPORTING
chr = int_cond-value
IMPORTING
NUM = value
EXCEPTIONS
CONVT_NO_NUMBER = 1
CONVT_OVERFLOW = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
.
*value = int_cond-value.
endif.
read table int_cond with key 'MHND-SMAHSK'.
if sy-subrc = 0.
SMAHSK = int_cond-value.
clear days.
case SMAHSK.
WHEN '3'. "Reminder 2 9% plus extra 10
value = value / 100.
*
value1 = ( value * '.09').
value2 = '15.00'.
*value1 = value1 + '15.00'.
value3 = ( value1 + value2 + value ).
when '2'. "Reminder 2 9% plus extra 5
value = value / 100.
value1 = ( value * '.09').
value2 = '10.00'.
value3 = ( value1 + value2 + value ).
when '1'.
value3 = value / 100.
endcase.
endif.
*value = value / 100.
*value1 = ( value * '.09').
*value2 = ( value1 + value ).
Read table outt_cond with key 'INTCH'.
if sy-subrc = 0.
outt_cond-value = value1.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
Read table outt_cond with key 'ADMFEE'.
if sy-subrc = 0.
outt_cond-value = value2.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
Read table outt_cond with key 'NEWTOT'.
if sy-subrc = 0.
outt_cond-value = value3.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
endform.
form z_get_date tables int_cond structure itcsy
outt_cond structure itcsy.
data: value type DZIELD_F15,
* value1 type p DECIMALS 2,
* value2 type p DECIMALS 2.
value1 type DZIELD_F15,
value2 type DZIELD_F15,
date type P0001-BEGDA,
date1(10) type c.
*22.04.2008
read table int_cond with key 'F150D-ZIELD'.
if sy-subrc = 0.
CONCATENATE int_cond-value+6(4) int_cond-value+3(2) int_cond-value+0(2) into date.
date = date + 5.
int_cond-value = date.
* date = int_cond-value.
endif.
Read table outt_cond with key 'ZDATE'.
if sy-subrc = 0.
concatenate date+6(2) '.' date+4(2) '.' date+0(4) into date1.
outt_cond-value = date1.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
endform.
09-17-2008 8:33 AM
see carefully the below example of subroutine pools:
*&---------------------------------------------------------------------*
*& Report ZDUNNING
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDUNNING.
form z_get_interest tables int_cond structure itcsy
outt_cond structure itcsy.
data: value type SALFW,
* value1 type p DECIMALS 2,
* value2 type p DECIMALS 2.
value1 type salfw,
value2 type salfw,
value3 type salfw.
data: SMAHSK type c.
data: days(5) type n.
"value1 type salfw.
data: valuec type c.
read table int_cond with key 'F150D-SALFW'.
if sy-subrc = 0.
*pack int_cond-value to value." FM added and commented by amit
CONDENSE int_cond-value NO-GAPS.
CALL FUNCTION 'MOVE_CHAR_TO_NUM'
EXPORTING
chr = int_cond-value
IMPORTING
NUM = value
EXCEPTIONS
CONVT_NO_NUMBER = 1
CONVT_OVERFLOW = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
.
*value = int_cond-value.
endif.
read table int_cond with key 'MHND-SMAHSK'.
if sy-subrc = 0.
SMAHSK = int_cond-value.
clear days.
case SMAHSK.
WHEN '3'. "Reminder 2 9% plus extra 10
value = value / 100.
*
value1 = ( value * '.09').
value2 = '15.00'.
*value1 = value1 + '15.00'.
value3 = ( value1 + value2 + value ).
when '2'. "Reminder 2 9% plus extra 5
value = value / 100.
value1 = ( value * '.09').
value2 = '10.00'.
value3 = ( value1 + value2 + value ).
when '1'.
value3 = value / 100.
endcase.
endif.
*value = value / 100.
*value1 = ( value * '.09').
*value2 = ( value1 + value ).
Read table outt_cond with key 'INTCH'.
if sy-subrc = 0.
outt_cond-value = value1.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
Read table outt_cond with key 'ADMFEE'.
if sy-subrc = 0.
outt_cond-value = value2.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
Read table outt_cond with key 'NEWTOT'.
if sy-subrc = 0.
outt_cond-value = value3.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
endform.
form z_get_date tables int_cond structure itcsy
outt_cond structure itcsy.
data: value type DZIELD_F15,
* value1 type p DECIMALS 2,
* value2 type p DECIMALS 2.
value1 type DZIELD_F15,
value2 type DZIELD_F15,
date type P0001-BEGDA,
date1(10) type c.
*22.04.2008
read table int_cond with key 'F150D-ZIELD'.
if sy-subrc = 0.
CONCATENATE int_cond-value+6(4) int_cond-value+3(2) int_cond-value+0(2) into date.
date = date + 5.
int_cond-value = date.
* date = int_cond-value.
endif.
Read table outt_cond with key 'ZDATE'.
if sy-subrc = 0.
concatenate date+6(2) '.' date+4(2) '.' date+0(4) into date1.
outt_cond-value = date1.
CONDENSE outt_cond-value NO-GAPS.
modify outt_cond index sy-tabix.
endif.
endform.
09-17-2008 3:09 PM