on 06-11-2009 8:12 PM
Hi Eevryone,
I am having a problem in my check printing form. When the length of the amount in words exceeded it gets truncated. Parameters set for Page Windows are as follows:
Window Meaning Left Upper Width Hght
CHECK amount in words 1,00 CM 22,45 CM 65,00 CH 1,00 LN
Parameters set for Main in Page Windows are as follows:
MAIN 00 Main window 0,00 CM 1,00 CM 20,00 CM 16,60 CM
When the amount is in million then the text gets truncated.
we are printing two variables on same line
<B>PAY</>&SPELL-WORD&&' DOLLARS and 'SPELL-DECIMAL(2)'/100 '&
SPELL-WORD variable has word for dollar amount and then the cent part is printed through SPELL-DECIMAL(2).
So can somebody help me setting up the condition where I can check the string length in SPELL-WORD in SAP script so that I can place conditions and split the line if greater then 60 characters in 2 lines.
Also if the SPELL-WORD in itself is greater then 65 characters, can we wirte like first sixty or 65 characters in first line and rest of the charaters in next line.
Thanks in advance
Regards
guds
Edited by: guds on Jun 11, 2009 9:37 PM
try using the fm RKD_WORD_WRAP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
yes, u can acheive it by putting the condition in Script and writing the PERFORM. U call the PERFORM with a Variable/FLAG and get the FLAG value from the Program and put the conditions in Script to print.
Eg:
In Script:
/: DEFINE &FLAG&.
/: PERFORM amnt_words IN PROGRAM ZXXXXXX
/: CHANGING &FLAG&.
/: IF &FLAG& EQ '1'.
P1 print &spell-word&
/: elseif &flag& EQ'2'.
P1 'Print as U like'.
/: ENDIF.
In Program ZXXXXXX:
FORM amnt_words CHANGING out_tab STRUCTURE itcsy.
data : lv_flag TYPE i,
lv1 TYPE i.
Finding the string length of word.
lv1 = strlen( spell-word ).
Based on string length u assign the value to Flag.
if lv1 LE 60.
lv_flag = 1.
elseif lv1 GT 65.
lv_flag = 2.
endif.
READ TABLE out_tab with key name = 'FLAG'.
IF sy-subrc EQ o.
out_tab-value = lv_flag.
modify out_tab.
ENDIF.
ENDFORM.
Hope it solves!!
Rgds,
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pavan,
In calling subroutine
/: PERFORM amnt_words IN PROGRAM ZXXXXXX
/: CHANGING &FLAG&.
do we not need to pass the amount too and if yes then how will it be handled
should it be like in
Perform
/: USING &SPELL-AMOUNT& or ®UH-RWBTR&
and for
FORM
using in_tab structure itcsy
do let me know the other processing commands like how to read the passed value in form.
Thanks
guds
Hi,
I think u can use the Function Module 'RKD_WORD_WRAP' suggested by Kartik, U have to pass TEXT into 'TEXTLINE' & 'OUTPUTLEN' Importing parameters of Function Module and the FM will split into no of number of lines & put it in OUT_LINES of tables Parameters. I think this method is easy than which i suggested.
Eg:
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = textline
outputlen = '60'
TABLES
out_lines = lines.
Regarding the question asked about my method, yes u are correct in calling the FORM.
FORM
using in_tab structure itcsy
after calling follow the same procedure as like CHANGING.
we dont need to use any commands in the FORM to read the passed value, whaterver we pass the variable value in CHANGING of PERFORM, the value from FORM (i.e., after proessing the FORM) will automatically gets reflected after the PERFORM in Script.
Hope its clear!!
Rgds,
Pavan
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.