‎2007 Sep 21 10:33 AM
hi all,
curently i am facing problem with cheque printing script, my company want the check amount to display in word
example : RM 100,121 AND SEN 15 ONLY
in SAP default program, it can only convert to word.
i was able to separate decimal and number to 2 field.
which the code is as below:
&'***RM 'SPELL-NUMBER(Z)&&' AND SEN 'SPELL-DECIMAL(2)& ONLY ***
but, i need to have the thousand separator (,) to be shows in the amount. is there any way to do it?
if possible, use of existing and simple code will be good. i only know that 'v_syntax(T)' is to eliminate the separator. but is there another way to add the separator?
thanks
‎2007 Sep 21 11:14 AM
You can use function module SPELL_AMOUNT to write it in words. See example program RF_SPELL.
Then you can concatenate the output fields 'WORD' and 'DECWORD with a comma in between.
If you cannot do it directly in the form, you can use PERFORM in the form to convert the number in a form of the print program (or any other program/include).
EDIT: Argh, sorry, should have read your post better. You mean the 1000 seperator. I'll have another look...
Message was edited by:
Edwin Vleeshouwers
‎2007 Sep 21 11:19 AM
how am i going to code it in script, to call the sub program?
can you please guide through the code? i am very new in script.... thanks
‎2007 Sep 21 11:25 AM
Regarding PERFORM:
The situation can occur that you have a standard SAP-program that is too complicated to change. Using the USER-EXIT is not an option. Then you need to select data from a page window. Use a PERFORM .
For more documentation see:
SAP Library à Basis Components à Basis Services/Communication interfaces à SAPscript à BC Style and form maintenance.
BC Style and form maintenance à SAPscript Control Commands à Calling ABAP Subroutines: PERFORM.
Also for an example I had a program ZBC_SCRIPT_CHEQUE for form Z140_ACC_STAT_01.
In main window I added the perform (MAIN window is processed first: get data here so it will be available from the beginning and can be used in ALL windows).
/* Perform is used in INFO-window
/: PERFORM GET_FAX IN PROGRAM ZBC_GET_DATA_FOR_SCRIPT
/: USING &SYST-UNAME&
/: CHANGING &ZFAXNR&
/: CHANGING &ZFAX01&
/: ENDPERFORM In the appropriate window:
/ &ZFAXNR&-&ZFAX01&
The program ZBC_GET_DATA_FOR_SCRIPT I created the subroutine:
*----------------------------------------------------------------------*
* FORM GET_FAX
*----------------------------------------------------------------------*
* Get the users fax number from table USR03
*----------------------------------------------------------------------*
FORM get_fax TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
* Data declarations
DATA: zfaxnr LIKE usr03-telfx.
SELECT SINGLE addrnumber persnumber
INTO (usr21-addrnumber, usr21-persnumber)
FROM usr21
WHERE bname = sy-uname.
SELECT SINGLE fax_number fax_extens
INTO (adr3-fax_number, adr3-fax_extens)
FROM adr3
WHERE addrnumber = usr21-addrnumber
AND persnumber = usr21-persnumber
AND flgdefault = 'X'.
READ TABLE out_par WITH KEY 'ZFAXNR'.
CHECK sy-subrc = 0.
WRITE adr3-fax_number TO out_par-value.
MODIFY out_par INDEX sy-tabix.
READ TABLE out_par WITH KEY 'ZFAX01'.
CHECK sy-subrc = 0.
WRITE adr3-fax_extens TO out_par-value.
MODIFY out_par INDEX sy-tabix.
ENDFORM.It may seem complicated at first. Especially the use of the in_par and out_par tables. But it can be very useful sometimes.
‎2007 Sep 21 11:25 AM
Call a perform from your script where you are want the script value.
the statement is same as in normal abap.
Pass a parameter to that perform which will return the value in words.
Regards,
Pritha.