Skip to Content
Author's profile photo Abhijeet Kankani

Function That is use to convert digit currency into words currency.

I think I should share this:

This will convert Indian Rupees(digits) into  word.

FUNCTION ZMM_AMT_WORDS_INR.

*”———————————————————————-

*”*”Local Interface:

*”  IMPORTING

*”     REFERENCE(AMOUNT) TYPE  NETWR

*”  EXPORTING

*”     REFERENCE(WORD) TYPE  Z_CHAR160

*”———————————————————————-

MAMOUNT = ABS( AMOUNT ).

   MSTRING = FLOOR( MAMOUNT ).

   CONDENSE MSTRING.

   MLEN = STRLEN( MSTRING ).

   IF MLEN > 10.

   ENDIF.

   MDECI = MAMOUNT FLOOR( MAMOUNT ).

   MPAISE = MDECI * 100.

   MPAISESTATUS = ‘Y’.

   ITAB_AMTDESC = ‘One’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Two’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Three’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Four’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Five’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Six’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Seven’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Eight’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Nine’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Ten’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Eleven’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Twelve’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Thirteen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Fourteen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Fifteen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Sixteen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Seventeen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Eighteen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Nineteen’.

   APPEND ITAB_AMT.

   ITAB_AMTDESC = ‘Twenty’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   ITAB_AMTDESC = ‘Thirty’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   ITAB_AMTDESC = ‘Forty’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   ITAB_AMTDESC = ‘Fifty’.

   APPEND ITAB_AMT.

   PERFORMFILL_AMT.

   ITAB_AMTDESC = ‘Sixty’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   ITAB_AMTDESC = ‘Seventy’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   ITAB_AMTDESC = ‘Eighty’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   ITAB_AMTDESC = ‘Ninety’.

   APPEND ITAB_AMT.

   PERFORM FILL_AMT.

   MWORD = ‘Rupees’.

   MLEN1 = MLEN.

   DO.

     WHILE MLEN > 0 AND MLEN <= 16.

       IF MLEN = 16.

         MCLTH = ‘Crore’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT99 CHANGING MSUBSCR

                                     MLEN

                                     MCLTH

                                     MWORD

                                     MCONTINUE.

         MLEN1 = 0.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 15.

         MCLTH = ‘Crore’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                     MLEN

                                     MCLTH

                                     MWORD

                                     MCONTINUE.

         MLEN1 = 0.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 14.

         MCLTH = ‘Lakh’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT99 CHANGING MSUBSCR

                                     MLEN

                                     MCLTH

                                     MWORD

                                     MCONTINUE.

         MLEN1 = 0.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 13.

         MCLTH = ‘Lakh’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING   MSUBSCR

                                    MLEN

                                    MCLTH

                                    MWORD

                                    MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 12.

         MCLTH = ‘Thousand’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT99 CHANGING MSUBSCR

                                  MLEN

                                  MCLTH

                                  MWORD

                                  MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 11.

         MCLTH = ‘Thousand’.

         MCONTINUE = ‘Y’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                      MLEN

                                      MCLTH

                                      MWORD

                                      MCONTINUE.

         MLEN1 = 0.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 10.

         MCLTH = ‘Hundred’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                  MLEN

                                  MCLTH

                                  MWORD

                                  MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 9.

         MCLTH = ‘Crore’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT99 CHANGING MSUBSCR

                                     MLEN

                                     MCLTH

                                     MWORD

                                     MCONTINUE.

         MLEN1 = 0.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 8.

         MCLTH = ‘Crore’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING   MSUBSCR

                                    MLEN

                                    MCLTH

                                    MWORD

                                    MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 7.

         MCLTH = ‘Lakh’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT99 CHANGING MSUBSCR

                                     MLEN

                                     MCLTH

                                     MWORD

                                     MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 6.

         MCLTH = ‘Lakh’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                    MLEN

                                    MCLTH

                                    MWORD

                                    MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 5.

         MCLTH = ‘Thousand’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT99 CHANGING MSUBSCR

                                     MLEN

                                     MCLTH

                                     MWORD

                                     MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 4.

         MCLTH = ‘Thousand’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                    MLEN

                                    MCLTH

                                    MWORD

                                    MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 3.

         MCLTH = ‘Hundred’.

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                    MLEN

                                    MCLTH

                                    MWORD

                                    MCONTINUE.

         IF MCONTINUE = ‘Y’.

           CONTINUE.

         ENDIF.

       ELSEIF MLEN = 2.

         MSUBSCR = MSTRING.

         MTMPSCR = MSUBSCR.

         IF MSUBSCR = 0.

           EXIT.

         ENDIF.

         IF MSUBSCR <= 20.

           READ TABLE ITAB_AMT INTO MAMT_DESC INDEX MSUBSCR.

           MLEN = 0.

         ELSE.

           MSUBSCR = MSTRING(1).

           MSUBSCR = MSUBSCR * 10.

           READ TABLE ITAB_AMT INTO MAMT_DESC INDEX MSUBSCR.

         ENDIF.

         CONCATENATE MWORD MAMT_DESC INTO MWORD SEPARATED BY SEP.

         SHIFT MSTRING.

         MLEN = MLEN 1.

         IF MTMPSCR > 20.

           MSUBSCR = MSTRING(1).

           IF MSUBSCR = 0.

             SHIFT MSTRING.

             MLEN = MLEN 1.

             CONTINUE.

           ENDIF.

           READ TABLE ITAB_AMT INTO MAMT_DESC INDEX MSUBSCR.

           CONCATENATE MWORD MAMT_DESC INTO MWORD SEPARATED BY SEP.

           SHIFT MSTRING.

           MLEN = MLEN 1.

         ELSE.

           EXIT.

         ENDIF.

       ELSEIF MLEN = 1.

         MCLTH = .

         MCONTINUE = ‘N’.

         PERFORM JAPAMT9 CHANGING MSUBSCR

                                    MLEN

                                    MCLTH

                                    MWORD

                                    MCONTINUE.

         IF MCONTINUE = ‘Y’ OR MLEN = 0.

           EXIT.

         ENDIF.

       ENDIF.

     ENDWHILE.

     IF MPAISE > 0 AND MPAISESTATUS = ‘Y’.

       MSTRING = MPAISE.

       CONDENSE MSTRING.

       MLEN = STRLEN( MSTRING ).

       MPAISESTATUS = ‘N’.

       CONCATENATE MWORD ‘And Paise’ INTO MWORD SEPARATED BY SEP.

     ELSEIF

     MLEN = 1.

     ELSE.

       EXIT.

     ENDIF.

   ENDDO.

   CONCATENATE MWORD ‘only’ INTO MWORD SEPARATED BY SEP.

   WORD = MWORD.

Best,

Abhijeet Kankani

ENDFUNCTION.

Assigned tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Shruti D
      Shruti D

      Hi Abhijeet,

      Sorry for my ignorance. But, can you please tell me what is 'ditigit'?

      Author's profile photo abhijeet kankani
      abhijeet kankani
      Blog Post Author

      Hello Shruti,

      Now I have change the content Please check.

      And thanks For telling me.

      Best Regards

      Abhijeet Kankani

      Author's profile photo Former Member
      Former Member

      Good One.

      Author's profile photo Former Member
      Former Member

      Hi abhijeet,

      I Am in need of this function but as I copied it, Some declarations are missing can you share them so that I can use it.