‎2008 Dec 03 5:51 AM
Hi..
Iam trying to print the time in words using spell_amount FM. I split the time in to 3 pieces but I got the error
" Offset Specification "+3" is greater than or equal to field length ("2"). My code is...
data : var1(2) type n,
var2(2) type n,
var3(2) type n.
parameters : p_var1 type t. "like payr_fi-rwbtr default '123456789.12'.
split p_var1 at space into : var10(2) var23(2) var3+6(2).
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = var1
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 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.
Can any body help me....?
Regarda,
Prathima.M
‎2008 Dec 03 6:36 AM
Hi
use ur code like dis....
data : var1(2) type n,
var2(2) type n,
var3(2) type n,
spell TYPE spell.
parameters : p_var1 type t.
var1 = p_var1+0(2).
var2 = p_var1+2(2).
var3 = p_var1+4(2).
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = var1
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 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.
Your p_var1 wont contain the delimiter '' : ".
so your split stmt will fail.
Use as per the above code.
and pass your var1,var2,var3 to your FM.....by calling it 3 times.
Revert back if ny queries
Regards
Winnie
‎2008 Dec 03 5:55 AM
>
> parameters : p_var1 type t.
> split p_var1 at space into : var10(2) var23(2) var3+6(2).
Do you know what is type T?
and how much its lenght and what data type?
and more important why you choose type T.
‎2008 Dec 03 6:19 AM
Hi..,
Type t holds 6 characters.
its a time field.
Regards,
Pratima.M
‎2008 Dec 03 5:58 AM
Hi
you hav split your hr,min,sec into 3 variables.
var2 is of lenght 2 and in your split stmt you hav given var2+3(2).
that variable var2+3(2) means that ur var2 is of lenght 5 which is not.
use like this
split p_var1 at space into : var1 var2 var3.
and call ur FM spell_amount thrice passing these 3 variables
Regards
Winnie
‎2008 Dec 03 6:04 AM
data : var1(2) type n,
var2(2) type n,
var3(2) type n.
parameters : p_var1 type t. "like payr_fi-rwbtr default '123456789.12'.
split p_var1 at space into : var10(2) var23(2) var3+6(2).
=====
in split statement
for VAR2+3(2) means from 4th character
but your var2 contains only 1st & 2nd chars mean var20(2) only allowed not var23(2)
‎2008 Dec 03 6:07 AM
Hi Pratima..
DATA : MONEY TYPE I,
VALUE LIKE SY-WAERS,
LANG LIKE SY-LANGU,
IN_LETTERS TYPE SPELL.
MONEY = 1000.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = MONEY
IMPORTING
IN_WORDS = IN_LETTERS
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
IF SY-SUBRC 0.
ENDIF.
WRITE : / MONEY, VALUE, IN_LETTERS-word.
‎2008 Dec 03 6:19 AM
Hi Pratima,
Time format will be XX:YY:ZZ.
So you need to use the following syntax while splitting.
SPLIT p_var1 AT ' : ' INTO var1 var2 var3.
Then you can pass the splitted variables into the function module.
Hope this will help you.
Regards,
Anand.
‎2008 Dec 03 6:59 AM
Hi..,
I passed the variables into FM. But the var2 and var3 not taking the values ... this is my code
tables: spell.
data : var1(2) type n,
var2(2) type n,
var3(2) type n.
parameters : p_var1 type t. "like payr_fi-rwbtr default '123456789.12'.
split p_var1 at ':' into var1 var2 var3.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = var1
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 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.
write :
spell-decword(64).
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = var2
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 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.
write : spell-decword(64).
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = var3
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 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.
write: spell-decword(64).
spell-word(64).
Suggest me Plz...
Why they are not taking the value???.
‎2008 Dec 03 6:36 AM
Hi
use ur code like dis....
data : var1(2) type n,
var2(2) type n,
var3(2) type n,
spell TYPE spell.
parameters : p_var1 type t.
var1 = p_var1+0(2).
var2 = p_var1+2(2).
var3 = p_var1+4(2).
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = var1
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 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.
Your p_var1 wont contain the delimiter '' : ".
so your split stmt will fail.
Use as per the above code.
and pass your var1,var2,var3 to your FM.....by calling it 3 times.
Revert back if ny queries
Regards
Winnie
‎2008 Dec 03 7:10 AM
Hi..,
My problem is solved with ur Answer.. I have a small doubt.. regarding my code,, when i use the Split statement the var2 and var3 variables are not taking the values..Why?. Here ur passing the input to variables using offset but in "split" not able to take...???
Thanks & Regards,
Prathima.M
‎2008 Dec 03 8:19 AM
Hi
if u go into debugging mode, u will see dat p_var1 doesnt contain delimiters.
for eg: if p_var1 u enter as 10:25:05
the value is stored as 102505...so as u see,there is no delimiter " : " by which u can use ur split stmt.
that is y var2 & var3 r empty , since all the values get stored into var1.
and since u hav used offset as var1+0(2)...only 10 will be stored in var1.------>dis is as per ur original code
Hope i hav cleard ur doubt.
Thanx 4 ur points.
Regards
Winnie
‎2008 Dec 03 8:22 AM
Hi Pratima,
While using SPLIT statement we need to specify field separator.
In your case, the field separator is not there (like space or , or - or / or . etc..).
So the statement is not working.
It will be better if you use offset statement and pass those values to the FM.
Regards,
Anand.
‎2008 Dec 03 10:22 AM