09-13-2006 5:42 AM
Hello Experties,
I hav a function Module 'ZIN_SPELL_AMOUNT'
to print amount in words that i want to call in SAPscript.I hav written the code in follwing manner
IN SAPSCRIPT WINDOW
Perform sub_amt in program ztestscript
/: USING &AMT&
/:CHANGING &AMT_WORD&
/:ENDPERFORM
IN ZTESTSCRIPT PROGRAM
REPORT ZTESTSCRIPT.
FORM sub_amt
TABLES in_par structure itcsy
out_par structure itcsy.
data : amt LIKE BSEG-WRBTR.
DATA : l_word TYPE string.
READ table in_par with key 'regud-WAERS'.
CHECK sy-subrc = 0.
amt = in_par-value.
CALL FUNCTION 'ZIN_SPELL_AMOUNT'
EXPORTING
P_NUMBER = amt
IMPORTING
AMTWORD = l_word
EXCEPTIONS
AMOUNT_NOT_ENTERED = 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 'amt_word'.
out_par-value = l_word.
MODIFY out_par INDEX SY-TABIX.
ENDFORM. "sub_amt
BUT ABOVE CODE IS NOT WORKING .
SO PLZ ANYONE GUIDE ME FOR THE SAME,
THANKSS & REGARDS,
SADIK.
09-27-2006 6:00 AM
Hi Sadik,
Use 'AMT' in place of 'regud-WAERS' in the statement below.
READ table in_par with key 'regud-WAERS'.
Try out with above change.
And also use
READ table out_par with key name = 'amt_word'.
instead of
READ table out_par with key 'amt_word'.
Ajay Kodali.
09-27-2006 6:10 AM
hi,
have a look at <b>READ TABLE</b> statement. it must be <b>READ TABLE <ITAB> WITH KEY out_par-name = 'AMT_WORD'</b>
also look at the case sensitiveness.
reward if useful...
09-27-2006 6:20 AM
Hello,
Debug the script and check wether &AMT& is getting populated.
Next debug report and see wether in the report the in_par-value value is getting populated.
Next see the amt field is getting populated.
When u are reading the
READ table out_par with key 'amt_word'.
make this 'amt_word' caps
Please check and let me know.
Regards
09-27-2006 3:39 PM
HI sadik,
1. CAPITAL
2. READ table out_par with key 'amt_word'.
should be
READ table out_par with key <b>'AMT_WORD'.</b>
regards,
amit m.
09-27-2006 3:46 PM
Hi,
See the bold one ..
Perform sub_amt in program ztestscript
/: USING &AMT&
/:CHANGING &AMT_WORD&
/:ENDPERFORM
IN ZTESTSCRIPT PROGRAM
REPORT ZTESTSCRIPT.
FORM sub_amt
TABLES in_par structure itcsy
out_par structure itcsy.
data : amt LIKE BSEG-WRBTR.
DATA : l_word TYPE string.
<b>READ table in_par with key 'AMT.</b>
CHECK sy-subrc = 0.
amt = in_par-value.
CALL FUNCTION 'ZIN_SPELL_AMOUNT'
EXPORTING
P_NUMBER = amt
IMPORTING
AMTWORD = l_word
EXCEPTIONS
AMOUNT_NOT_ENTERED = 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 'amt_word'.
out_par-value = l_word.
MODIFY out_par INDEX SY-TABIX.
ENDFORM. "sub_amt
Regards
Sudheer
11-16-2006 10:31 PM
Try this.. If works mark it is answered..
REPORT ZTESTSCRIPT.
FORM sub_amt
TABLES in_par structure itcsy
out_par structure itcsy.
data : amt LIKE BSEG-WRBTR.
DATA : l_word TYPE string.
<b>READ table in_par INDEX 1.</b>
CHECK sy-subrc = 0.
amt = in_par-value.
CALL FUNCTION 'ZIN_SPELL_AMOUNT'
EXPORTING
P_NUMBER = amt
IMPORTING
AMTWORD = l_word
EXCEPTIONS
AMOUNT_NOT_ENTERED = 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.
<b>READ table out_par with key 'AMT_WORD'.</b>
out_par-value = l_word.
MODIFY out_par INDEX SY-TABIX.
ENDFORM. "sub_amt
Regs
Rakesh