on 04-21-2009 11:15 AM
Dear All
I am having some problem in using SPELL Structure. I am using it in SAPSCIPT. The problem is that it works ok till the thousands. But since it has to be converted into INR Format, as soon as it goes into lakhs it displays it into millions. Is there any other way to view the output in lakhs not it millions. I know of a function module HR_IN_CHG_INR_WRDS which converts amount into words into INR format but i dont know how to use function module in SAPSCRIPT.
Any help would be appreciated and thanks in advance.
Prashant Jha
HI,
usually when we are enhancing the sap scripts, we will go for sub routine pool programs.
in the sap script,
go to a window where your wish to print the amount in words.
now write the code like this.
/: PERFORM GET_SUBTOTAL IN PROGRAM ZTEST
/: USING &EKpO-netwr&
/: CHANGING &TOTALFINAL&
/: ENDPERFORM
to print the value.
Ph &TOTALFINAL&
Here for example, take the amount and then convert the amount .
in side the progam
FORM GET_SUBTOTAL TABLES: IN STRUCTURE ITCSY
OUT STRUCTURE ITCSY.
READ TABLE IN INDEX 1.
W_variable = IN-VALUE.
here you will receive the value as the amount in char.
convert this into ccurrency format.
then use the fm HR_IN_CHG_INR_WRDS
and then
READ TABLE OUT INDEX 1.
OUT-VALUE = W_total.
modify out index 1.
endform.
regards,
Venkatesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Venkatesh
Thanks for the solution. I am working on Cheque printing F-58 transaction and SAPSCRIPT program is not getting called from any SE38 program. Please help me , where to write this GET_SUBTOTAL program ?
Should it be written in the main window ? and please help me how to make a call to this function module.
Thanks.
Prashant Jha
Hi,
I guess the program could be the RFFOUS_C
In the sap script for that cheque printing.
Check where the amount is getting printed. In that window, before the amount is getting printed,
paste the code what i have given in my previous post. I mean both the script code and then the subroutine program. Here i guess u r confused with the subroutine program .
/: PERFORM GET_SUBTOTAL IN PROGRAM ZTEST
/: USING &EKpO-netwr&
/: CHANGING &TOTALFINAL&
/: ENDPERFORM
here you need to create the program ztest and this progam will be the sub routine pool program.
Have any more questions, let me know.....
also u need to copy the code what i have given in my previous post
Regards,
Venkatesh
Hi,
use the PERFORM .. ENDPERFORM Control commands in your script to get the amount in words.
In your program use this code.
FORM get_spell TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
data: w_amt type PC207-BETRG,
spell type text150.
READ TABLE in_par WITH KEY 'w_input'.
CHECK sy-subrc = 0.
w_ amt = in_par-value.
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = W_AMT
IMPORTING
AMT_IN_WORDS = SPELL
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE out_par WITH KEY 'W_SPELL'.
CHECK sy-subrc = 0.
out_par-value = spell.
MODIFY out_par INDEX sy-tabix.
ENDFORM. "GET_SPELL
in your script use the folling code.
/: define &w_spell&
/: perform get_spell in program z_get_spell
/: using &w_input&
/: changing &w_spell&
/: endperform
Regards,
Jagadeesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well you could do a jump off from your sapscript in an external perform, then you can use your FM and give back desired values to form.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.