cancel
Showing results for 
Search instead for 
Did you mean: 

SAPSCRIPT - amount in million then amount in words get truncated on check

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member205763
Active Contributor
0 Kudos

try using the fm RKD_WORD_WRAP

Former Member
0 Kudos

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

Former Member
0 Kudos

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 &REGUH-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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi all,

Thanks for the responses, my problem resolved.

Regards,

Guds