on 11-02-2007 1:45 AM
Hi Experts,
I created sap script, in sap script i want amt to words function, i already use "spell_amount" function like
DATA v_int TYPE i VALUE '1000'.
DATA var LIKE SPELL.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = var.
call function 'WRITE_FORM'
exporting
element = 'TEXT'
type = 'MAIN'
window = 'MAIN'.
now what i want my table is REGUP and curency field is DMBTR
so now i change the code........ like this
DATA v_int LIKE REGUP-DMBTR.
*DATA v_int TYPE I.
*DATA var LIKE SPELL.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = var.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
CURRENCY = 'SY-LANGU'
FILLER = 'SPACE '
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.
but it display is zero
how can i get the value in variable "v_int" through" REGUP-DMBTR."
give me suggetion
Jigar
Hi All,
Thanks for the reply... i created sap script through t-code f-58.... in t-code f-58 currency field is "regup-dmbtr" i follow ur code its not working.... may be my mistake in sap script.. i pass the value in sap script like /E(text element) &var&
so is it true?????? if no so give me some suggetion... how can i pass the value in sap script???? which command i use????
<i><b>below is my code</b></i>
DATA v_int TYPE I.
v_int = regup-dmbtr.
DATA var LIKE SPELL.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = var.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
CURRENCY = 'SY-LANGU'
FILLER = 'SPACE '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = var
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.
<i><b>in sap script</b></i>
/E(text element) &var&
give me suggetion......
Jigar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naimesh,
i declare same like u
/E Element
&VAR&
i have 2 problems with this function
1) i not get value in in var(exporting) variable it dispaly <b>zero</b>
2) if i enter amount 195.00 so in v_int(amount) it shows 19500
how can i get the value in var variable through regup-dmbtr???
<b>below my code:</b>
Data: v_int(13) type i.
DATA : var LIKE spell.
v_int = regup-dmbtr.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = v_int
currency = 'SGD'
filler = ' '
language = sy-langu
IMPORTING
in_words = var
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.
give me some suggetion... in which palce i wrong.....\
Jigar
Hello ...
Change the declaration of the
Data: v_int(13) type i.
to
data: V_INT type regup-dmbtr,
You have to include the currency also in the FM call..
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = v_int
currency = 'USD' "<<<<
* filler = ' '
language = sy-langu
IMPORTING
in_words = var
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.
If you are getting the ZERO, that means your V_INT variable remains empty... put a break point there and try to generate one output.
Regards,
Naimesh Patel
can you figure out which field holds the Amount in the REGUD structure by putting breakpoint at OPEN_FORM or WRITE_FORM ...
start debugger.. Breakpoints > Breakpoint at > Function Module > Give WRITE_FORM... it will stop at each write_forms.. check out which field holds your amount.
than assign that field to V_AMT.
Regards,
Naimesh Patel
Does your check are voided checks ??
If not than, search for this piece of code in the RFFORI01,
IF reguh-rwbtr NE 0. "zero net check has to be voided
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'CHECK'
element = '540'
function = 'DELETE'
EXCEPTIONS
window = 1 "Fehler bereits oben gemerkt
element = 2. "error already noted
Add your code after words for getting the SPELL_AMOUNT
V_AMT = REGUH-RWBTR.
then call FM SPELL_AMOUNT.
Regards,
Naimesh Patel
Hi Naimesh,
i follow ur code yet var variable diasply zero.........
<b>below my code:</b>
*********jigar changes*****
Data: v_int type i
data: var like spell.
Data: v_int(15) type p.
*v_int = REGUD-DMBTR.
*v_int = regup-dmbtr.
v_int = REGUH-RWBTR.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = 'v_int'
currency = 'USD'
filler = ' '
language = sy-langu
IMPORTING
in_words = var
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.
Fenster Check, Element Entwerteter Scheck
window check, element voided check
IF reguh-rwbtr NE 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'CHECK'
element = '540'
EXCEPTIONS
window = 1
element = 2.
IF sy-subrc EQ 2.
err_element-fname = t042e-zforn.
err_element-fenst = 'CHECK'.
err_element-elemt = '540'.
err_element-text = text_540.
COLLECT err_element.
ENDIF.
endif.
Jigar
Do it in the below way it will solve your problem.
<b>Data: v_int(8) TYPE p.</b>
<b>*DATA v_int TYPE i VALUE '1000'.</b>
DATA var LIKE SPELL.
<b>WRITE REGUP-DMBTR TO v_int.</b>
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = var.
call function 'WRITE_FORM'
exporting
element = 'TEXT'
type = 'MAIN'
window = 'MAIN'.
Close th thread once your question is answered.
Regards,
Sairaam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Before calling the FM SPELL_AMOUNT just put this:
v_amt = regup-dmbtr.
Regards,
Naimesh Patel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jigar...
try this code,
DATA v_int LIKE REGUP-DMBTR value '1000'.
DATA var LIKE SPELL.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
FILLER = 'SPACE '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = var
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 : / var-word.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this sample code or just execute this code
DATA : in_word LIKE spell.
DATA : word(255) TYPE c,
dec(128) TYPE c.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = '123456.00'
currency = 'SGD'
filler = ' '
language = sy-langu
IMPORTING
in_words = in_word
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.
MOVE in_word-word TO word.
MOVE in_word-decword TO dec.
WRITE : / word.
In your code once you get SPELL then look at SPELL-WORD, which gives you the REGUP-DMBTR in words.
Regards
Gopi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.