cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Numbers to Words in Check Printing

Former Member
0 Kudos

I am creating my own check template in SAPscript instead of a smartform simply because I did not want/find a driver program for a smartform. I am a little confused on how to perform ABAP function calls in SAPscript and need some help. I figure this ABAP code will do the job:


DATA: wa_amt TYPE SPELL.
*--
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = 100
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = it_amt
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.

    *
          o
                +

IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE 'A' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--
write wa_amt-WORD.
*--

But I think this code is meant for a smartform->program lines. I want to convert the variable "REGUD-SNETT" from a number to a string of words.

On a side note, how to do I set a break-point in my SAPscript so it enters debug mode after I post the check document in transaction code f-58?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
  • ------------------ Amount in words -------------------------------------

/ &'*** 'SPELL-WORD& &REGUD-WAERS&&' and 'SPELL-DECIMAL(2)'/100 '&***

/* Example for amount and decimal places in words

/* &'*** 'SPELL-WORD& &REGUD-WAERS&&' and 'SPELL-DECWORD' Cents'& ***

/* Example for numbers in words

/* &SPELL-DIG06(6)&&SPELL-DIG05(6)&&SPELL-DIG04(6)&&SPELL-DIG03(6)&&SPELL-D

If you want to see the details Open F110_PRENUM_CHCK Script and check the window code for Amount in words (Description of window)

If it is useful, please reward me with points.

Former Member
0 Kudos

Thanks for all your help. That solved my problem. If other people have this problem, he means the window called "CHECKSPL" instead of "Amount in Words".

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

In program ,put a break -point at required location, or goto se71-> Utilities menu-> Activate Debugger.

Go execute tcode f-58 automatically, debugger will activate for the script.

press F5-> Character by character it will print ( exceutue)

F6-> Line by line

F8-> text element by text element

Reward if useful.

Bye

Former Member
0 Kudos

Hi Mark,

You just have to create a subroutine in your script and pass the value REGUD-SNETT to the subroutine.Il give u a sample code, u modify it as desired. Write this in your script

/: Perform ZABC in program 'ZPPP'

/: USING &REGUD-SNETT &

/: Changing &TEXT1&

/: Endperform

In the subroutine you first read this value using the read statement and use Speel_Amount to convert the amt in words and send it back to ur script.

Let me know how it goes.

Nayan

Former Member
0 Kudos

hI,

DATA: hlp_filler TYPE c VALUE '*', "filler in spell_amount

spell type spell.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

language = 'E'

currency = reguh-waers

amount = regud-swnes

filler = hlp_filler

IMPORTING

in_words = spell

EXCEPTIONS

OTHERS = 1.

In your code:

DATA: wa_amt TYPE SPELL.

*--

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = 100

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = wa_amt

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

Regards,

Subramanian

Former Member
0 Kudos

Subramanian,

I used the code you supplied me but nothing is being printed to the screen. I'm not sure if I'm doing it correctly, but I have basically inserted verbatum line-by-line of what you have in a window with "/:" for the tag category. Not sure if this line is wrong and missing a double quote though:


DATA: hlp_filler TYPE c VALUE '*', "filler in spell_amount
spell type spell.

Can you elaborate more if this excerpt is suppose to go in the ABAP driver vs. the SAPscript window? I am trying to print the variable by calling "&in_words-words&", is this right/wrong?

Nayan,

I have also tried your solution but I am not very familiar with the read and write statements in ABAP. I am assuming that I have to define "TEXT1" first before I can use it? Also, where can I look at the source code for program ZPPP? It's not in se37 or se38.

Former Member
0 Kudos

debugging the scrpit

before u run the transaction

pl execute se38 program name RSTXDBUG and then execute ur transaction

Regards

Devanand

Former Member
0 Kudos

copy this function Module in a Z function Module and start doing the changes that would a better option rather that Looking for standard solution.I have done the Same thing and it was resusable

regards

Devanand