cancel
Showing results for 
Search instead for 
Did you mean: 

Amt in words in sap script

Former Member
0 Kudos

Hi Experts,

I created sap script, in sap script i want amt to words function, i already use "spell_amount" function like

DATA v_int TYPE i VALUE '1000'.

DATA var LIKE SPELL.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = v_int

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = var.

call function 'WRITE_FORM'

exporting

element = 'TEXT'

type = 'MAIN'

window = 'MAIN'.

now what i want my table is REGUP and curency field is DMBTR

so now i change the code........ like this

DATA v_int LIKE REGUP-DMBTR.

*DATA v_int TYPE I.

*DATA var LIKE SPELL.

  • CALL FUNCTION 'SPELL_AMOUNT'

  • EXPORTING

  • AMOUNT = v_int

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • IN_WORDS = var.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = v_int

  • CURRENCY = 'SY-LANGU'

FILLER = 'SPACE '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = SPELL

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

but it display is zero

how can i get the value in variable "v_int" through" REGUP-DMBTR."

give me suggetion

Jigar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi All,

Thanks for the reply... i created sap script through t-code f-58.... in t-code f-58 currency field is "regup-dmbtr" i follow ur code its not working.... may be my mistake in sap script.. i pass the value in sap script like /E(text element) &var&

so is it true?????? if no so give me some suggetion... how can i pass the value in sap script???? which command i use????

<i><b>below is my code</b></i>

DATA v_int TYPE I.

v_int = regup-dmbtr.

DATA var LIKE SPELL.

  • CALL FUNCTION 'SPELL_AMOUNT'

  • EXPORTING

  • AMOUNT = v_int

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • IN_WORDS = var.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = v_int

  • CURRENCY = 'SY-LANGU'

FILLER = 'SPACE '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = var

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

<i><b>in sap script</b></i>

/E(text element) &var&

give me suggetion......

Jigar

Former Member
0 Kudos

Hi All

can u give me suggetion more suggetion value display is zero in v_int variable...

Jigar

naimesh_patel
Active Contributor
0 Kudos

You should write in SAPScript ast

/E Element
* &VAR-WORD&

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

i declare same like u

/E Element

  • &VAR&

i have 2 problems with this function

1) i not get value in in var(exporting) variable it dispaly <b>zero</b>

2) if i enter amount 195.00 so in v_int(amount) it shows 19500

how can i get the value in var variable through regup-dmbtr???

<b>below my code:</b>

Data: v_int(13) type i.

DATA : var LIKE spell.

v_int = regup-dmbtr.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = v_int

  • currency = 'SGD'

  • filler = ' '

language = sy-langu

IMPORTING

in_words = var

EXCEPTIONS

not_found = 1

too_large = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

give me some suggetion... in which palce i wrong.....\

Jigar

naimesh_patel
Active Contributor
0 Kudos

Hello ...

Change the declaration of the

Data: v_int(13) type i.

to

data: V_INT type regup-dmbtr,

You have to include the currency also in the FM call..

CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = v_int
 currency = 'USD'    "<<<<
* filler = ' '
language = sy-langu
IMPORTING
in_words = var
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

If you are getting the ZERO, that means your V_INT variable remains empty... put a break point there and try to generate one output.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

I follow ur code but yet "var" variable display zero..........................................

what to do now........... give me suggetion

Jigar

naimesh_patel
Active Contributor
0 Kudos

Try with this one:

V_AMT = REGUD-DMBTR.

Regards,

Naimesh Patel

Former Member
0 Kudos

hi....

yet display zero.....

jigar

naimesh_patel
Active Contributor
0 Kudos

can you figure out which field holds the Amount in the REGUD structure by putting breakpoint at OPEN_FORM or WRITE_FORM ...

start debugger.. Breakpoints > Breakpoint at > Function Module > Give WRITE_FORM... it will stop at each write_forms.. check out which field holds your amount.

than assign that field to V_AMT.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

I put the debuggre at function module and write_form... I got the currency value in "regup-dmbtr" field not in "regud-dmbtr"........

Jigar

naimesh_patel
Active Contributor
0 Kudos

than assing regup-dmbtr to V_AMT and see what happens..!!

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

i craete a new sap script for <b>payment print prog</b> and for this i use standrad print prog RFFORI01. for this i crate ZRFFORI01 prog for new sap script.

Jigar

Former Member
0 Kudos

Hi Naimesh

I see at regup-dmbtr to V_AMT.. it dispaly zero...

Jigar

Former Member
0 Kudos

Hi Naimesh,

i craete a new sap script for payment print prog and for this i use standrad print prog RFFORI01. for this i crate ZRFFORI01 prog for new sap script.

Jigar

Former Member
0 Kudos

Hi Naimesh,

i craete a new sap script for payment print prog and for this i use standrad print prog RFFORI01. for this i crate ZRFFORI01 prog for new sap script.

Jigar

naimesh_patel
Active Contributor
0 Kudos

Does your check are voided checks ??

If not than, search for this piece of code in the RFFORI01,

        IF reguh-rwbtr NE 0.           "zero net check has to be voided
          CALL FUNCTION 'WRITE_FORM'
               EXPORTING
                    window   = 'CHECK'
                    element  = '540'
                    function = 'DELETE'
               EXCEPTIONS
                    window   = 1       "Fehler bereits oben gemerkt
                    element  = 2.      "error already noted

Add your code after words for getting the SPELL_AMOUNT

V_AMT = REGUH-RWBTR.

then call FM SPELL_AMOUNT.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

yes its voided checks and i also use element 540.. ok now i check ur code.. i will catch u...............

Jigar

Former Member
0 Kudos

Hi Naimesh,

i follow ur code yet var variable diasply zero.........

<b>below my code:</b>

*********jigar changes*****

Data: v_int type i

data: var like spell.

Data: v_int(15) type p.

*v_int = REGUD-DMBTR.

*v_int = regup-dmbtr.

v_int = REGUH-RWBTR.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = 'v_int'

currency = 'USD'

  • filler = ' '

language = sy-langu

IMPORTING

in_words = var

EXCEPTIONS

not_found = 1

too_large = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Fenster Check, Element Entwerteter Scheck

  • window check, element voided check

IF reguh-rwbtr NE 0.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'CHECK'

element = '540'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc EQ 2.

err_element-fname = t042e-zforn.

err_element-fenst = 'CHECK'.

err_element-elemt = '540'.

err_element-text = text_540.

COLLECT err_element.

ENDIF.

endif.

Jigar

naimesh_patel
Active Contributor
0 Kudos

put it after ..

IF reguh-rwbtr NE 0.

and befor the FM

WRITE_FORM

call.

if anything helped you, and I would appreciate your points...

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Naimesh,

At last i use direct in sap script "&'*** 'SPELL-WORD& &REGUD-WAERS&&' und 'SPELL-DECWORD' Cents'& ***" its working

and thank you very much naimesh for help.......

Jigar

Answers (4)

Answers (4)

former_member196280
Active Contributor
0 Kudos

Do it in the below way it will solve your problem.

<b>Data: v_int(8) TYPE p.</b>

<b>*DATA v_int TYPE i VALUE '1000'.</b>

DATA var LIKE SPELL.

<b>WRITE REGUP-DMBTR TO v_int.</b>

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = v_int

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = var.

call function 'WRITE_FORM'

exporting

element = 'TEXT'

type = 'MAIN'

window = 'MAIN'.

Close th thread once your question is answered.

Regards,

Sairaam

naimesh_patel
Active Contributor
0 Kudos

Before calling the FM SPELL_AMOUNT just put this:

v_amt = regup-dmbtr.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Jigar...

try this code,

DATA v_int LIKE REGUP-DMBTR value '1000'.

DATA var LIKE SPELL.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = v_int

FILLER = 'SPACE '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = var

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write : / var-word.

gopi_narendra
Active Contributor
0 Kudos

Check this sample code or just execute this code

DATA : in_word LIKE spell.
DATA : word(255) TYPE c,
       dec(128) TYPE c.
CALL FUNCTION 'SPELL_AMOUNT'
     EXPORTING
          amount    = '123456.00'
          currency  = 'SGD'
          filler    = ' '
          language  = sy-langu
     IMPORTING
          in_words  = in_word
     EXCEPTIONS
          not_found = 1
          too_large = 2
          OTHERS    = 3.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
MOVE in_word-word TO word.
MOVE in_word-decword TO dec.

WRITE : / word.

In your code once you get SPELL then look at SPELL-WORD, which gives you the REGUP-DMBTR in words.

Regards

Gopi