cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Printing Amount in Words

Former Member
0 Kudos

Dear ABAPers,

I have created SAP Script for Cheque Printing and i have assigned it in the Transaction code FBZP.It is working fine.This SAP Script is called in the Standard program RFFOUS_C.

When i am printing the Amount in Words.It is printing in International Format.But i want to print it in indian Format.For Example when it is printing '1000000' it prints as 'One Million' but i want to print it as 'Ten Lakh'.

For this i have created Subroutine pool program.But i not know how to how to Use this.Please help me.

Thanks & Regards,

Ashok.

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

You can use this sample code to call the subroutine from script and also for the subroutine.

write the following code in sapscript

/: PERFORM GET_AMOUNT IN PROGRAM ztest

/: USING &amount1&

/: CHANGING &amount2&

and the write the suboutine GET_AMOUNT in program ztest as follows

FORM get_amount TABLES l_input_table STRUCTURE itcsy

l_output_table STRUCTURE itcsy.

DATA: l_amount like PC207-BETRG.

l_amount_words(22) type c.

READ TABLE l_input_table WITH KEY name = 'amount1' (should be in same case as in perform statement)

IF sy-subrc = 0.

l_amount = l_input_table-value.

ENDIF.

call FM HR_IN_CHG_INR_WRDS

importing = l_amount

exporting = l_amount_words.

CLEAR l_output_table.

READ TABLE l_output_table WITH KEY name = 'amount2'.

IF sy-subrc = 0.

MOVE l_amount_wordsTO l_output_table-value.

MODIFY l_output_table INDEX sy-tabix.

ENDIF.

ENDFORM. "GET_AMOUNT

Former Member
0 Kudos

Dear ABAPers,

My Question is answered.

Thanks & Regards,

Ashok.

Former Member
0 Kudos

Hi,

Try to call a subroutine in your script as

PERFORM GET_AMOUNT IN PROGRAM 'Zprogram'.

USING &&

CHANGING &&

ENDPERFORM.

In your print program u can call ur subroutine as

FORM get_amount TABLES in_var STRUCTURE itcsy

out_var STRUCTURE itcsy.

ENDFORM.

Inside this subroutine you can read your USING parameter values as

READ TABLE in_var INDEX 1.

local varibale = in_var-value.

Based on the above value/values you can call the FM and proceed with your further processing.

After you get the amount in words, you can pass into out_var structure.

Regards,

Chandra

Former Member
0 Kudos

Use this function module HR_IN_CHG_INR_WRDS.

If you need help in how to use the above function module,please let me know..

Former Member
0 Kudos

Hi.

use the PERFORM --- ENDPERFORM control commands in the Script by passing the value and receive the worods by using the function mudule .

Former Member
0 Kudos

check dis

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = l_v_totamt

currency = is_bil_invoice-hd_gen-bil_waerk

language = is_nast-spras

IMPORTING

in_words = v_tot

Give currency as INR..

Regards

Palak

Former Member
0 Kudos

if u r using standard program RFFOUS_C then make one z program of dat.

in dat

go to include ZRFFORI99.

and in FORM ziffern_in_worten. add following code.

FORM ziffern_in_worten.

DATA : spell1(150).

CLEAR spell.

DATA : W_AMOUNT TYPE PC207-BETRG ,

W_DUTY TYPE IN_WORDS.

MOVE reguh-rwbtr TO W_AMOUNT.

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING

amt_in_num = W_AMOUNT

IMPORTING

amt_in_words = W_DUTY.

REPLACE 'RUPEES' WITH '' INTO W_DUTY.

REPLACE 'ONLY' WITH '' INTO W_DUTY.

spell-word = W_DUTY.

WRITE SPELL-WORD LEFT-JUSTIFIED TO SPELL-WORD.

*

IF sy-subrc EQ 1.

  • in Tabelle T015Z fehlt ein Eintrag

  • entry in table T015Z not found

CLEAR err_t015z.

err_t015z-spras = sy-msgv1.

err_t015z-einh = sy-msgv2.

err_t015z-ziff = sy-msgv3.

COLLECT err_t015z.

IF hlp_sprache NE 'E'.

  • Letzter Versuch mit Sprache 'E' (besser als nichts)

  • Last trial with language 'E' (better than nothing)

  • CALL FUNCTION 'SPELL_AMOUNT'

  • EXPORTING

  • language = 'E'

  • currency = reguh-waers

  • amount = regud-swnes

  • filler = hlp_filler

  • IMPORTING

  • in_words = spell

  • EXCEPTIONS

  • OTHERS = 1.

  • CALL FUNCTION 'ZCFM_SPELL_AMOUNT_INR1'

  • EXPORTING

  • amount = reguh-rwbtr

  • IMPORTING

  • text = spell1.

  • REPLACE 'RUPEES' WITH '' INTO spell1.

  • REPLACE 'OLNY' WITH '' INTO spell1.

  • spell-word = spell1.

spell-word = W_DUTY.

ENDIF.

ENDIF.

IF sy-subrc EQ 2 OR spell-number GE hlp_maxbetrag.

  • Betrag ist zum Umsetzen zu groß

  • amount too large for transformation

MOVE-CORRESPONDING reguh TO err_in_worten.

COLLECT err_in_worten.

CLEAR:

spell-dig01, spell-dig02, spell-dig03, spell-dig04, spell-dig05,

spell-dig06, spell-dig07, spell-dig08, spell-dig09, spell-dig10,

spell-dig11, spell-dig12, spell-dig13, spell-dig14, spell-dig15.

ENDIF.

ENDFORM.

it will help u.

no need to add subroutine.

if u really need to write it. then let me know.

i will tell u where n what u have to write.

Edited by: MONIKA DHUMAL on Mar 17, 2009 1:42 PM

Former Member
0 Kudos

Hi Monika,

Whatever you have replied is very much near to my question.

I need to write the Code Could you please Explain me clearly.

Thanks & Regards,

Ashok.

Former Member
0 Kudos

Hi Ashok,

There is no need of creating a Z program of the standard SAP pgm RFFOUS_C, instead call the sub routine pool program in the window when you are printing the amount in words as

PERFORM <ur Sub routine pool name> USING <the field which in printing in dollar>CHANGING

<give a variable name>.Now call the FM to convert the amount to INR in ur subroutine pool.and give this variable name which u have got from the FM to the SAP Script as &variable name&.

Regards,

Asish Dash

Former Member
0 Kudos

hi.........by which method u want to go .....

by using z program or using suroutine .

if using z program then

just copy standard program into z ( Includes also)

then go to include -


INCLUDE zrffori99.

in dat just copy my code between

FORM ziffern_in_worten.

'

'

'

ENDFORM.

IF U WANT SUBROUTINEPROGRAM......THEN LET ME KNOW.......

subroutine :

add this in ur sapscript.

/: DEFINE &TOTAL&

/: PERFORM GET_DATA IN PROGRAM ZRFFOUS_FORM

/: USING &REGUH-RWBTR&.

/: CHANGING &TOTAL&.

/: ENDPERFORM.

& TOTAL&

AND IN UR SUBROUTINE PROGRAM ---ZTEST

ADD CODE

form get_data TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA : TOTAL LIKE REGUH-RWBTR.

DATA : LV_TOTAL LIKE REGUH-RWBTR.

READ TABLE IN_TAB INDEX 1.

MOVE IN_TAB-VALUE TO LV_TOTAL.

TOTAL = LV_TOTAL.

Former Member
0 Kudos

Hi frnd,

USe Function module

HR_IN_CHG_INR_WRDS

Former Member
0 Kudos

Hi Nivetha,

I am using the mentioned function module in my Subroutine pool program.But i want to know how to call this in SAP Script.Could you please Explain me how to create the subroutine pool program and how to use it in the SAP Script and how to pass the value from SAP Script and How get the Value from Subroutine to SAP Script.

Thanks & Regards,

Ashok.

Former Member
0 Kudos

HI,


* Code lines in the script
/: perform <form_name> in program <program_name> 
/: using &amount& 
/: changing &amt_words& 
/:endperform

* Form imlementation in program specified in <program_name>
FORM <form_name> TABLES IN_PAR STUCTURE ITCSY
                                            OUT_PAR STRUCTURE ITCSY.

DATA: l_AMOUNT  LIKE PC207-BETRG, "page number 
          Words TYPE CHAR60. 

READ TABLE IN_PAR WITH KEY u2018AMOUNTu2019.
CHECK SY-SUBRC = 0.
L_AMOUNT = IN_PAR-VALUE.

" CALL the FM HR_IN_CHG_INR_WRDS and pass the l_amount and get the text in words

READ TABLE OUT_PAR WITH KEY u2018AMT_WORDSu2019.
CHECK SY-SUBRC = 0.
OUT_PAR-VALUE = words.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.