Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

spliting the single field into two variable text.....check print

Former Member
0 Kudos

Hi all,

Im working for cheque printing and in the Amount in words column....im getting the text in a single line...as i've made it as in my script.

(im moving the rate in to amount thru FM "HR_IN_CHG_INR_WRDS"....

and it displaying into a single line....)

But in every bank cheque...we have only a limit space for the first line and balance words should come in to the next line....How to achieve this in my form print.(when im giving the cheque(laser print) inside the printer for print)...

*******FYI..

now im getting it as

RUPEES Ninety Seven Thousand Thirty seven and four paise only.(its going out in my cheque as it's coming in a single line,going beyond the words column)

the above one...i want to print it as two lines as like in normal cheque...

what condition i've to give and how to split the text or make it to continue in the second line....

Pls do the needful with any examples or any coding.....

help needed

thanks & regards

sankar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Split the String at the word 'and' into another string2 .. write string2 in second line

13 REPLIES 13

Former Member
0 Kudos

DATA: str(72) TYPE c,

str(72) TYPE c,

itab TYPE TABLE OF string,

text TYPE string.

text = `What a drag it is getting old`.

SPLIT text AT space INTO: str1 str2

TABLE itab.

Message was edited by:

Karthikeyan Pandurangan

Message was edited by:

Karthikeyan Pandurangan

0 Kudos

thanks for a prompt reply...

but im getting error...itab...while checking ur code...

it says "itab already declared"...

***************

DATA: str1(72) TYPE c,

str2(72) TYPE c,

itab TYPE TABLE OF string,

text TYPE string.

text = `What a drag it is getting old`.

SPLIT text AT space INTO: str1 str2 .

tables itab.

***********************

Pls reply...

regards

sankar

0 Kudos

Hi karthikeyan,

but im getting error...itab...while checking ur code...

it says "itab already declared"...

***************

DATA: str1(72) TYPE c,

str2(72) TYPE c,

itab TYPE TABLE OF string,

text TYPE string.

text = `What a drag it is getting old`.

SPLIT text AT space INTO: str1 str2 .

tables itab.

***********************

Pls reply...

regards

sankar

0 Kudos

Hi Sankar

try this...



in your script

PERFORM words IN PROGRAM zcheque
USING ®UH-VBLNR&
CHANGING &RUPEES&
CHANGING &PAISE&
ENDPERFORM.


/* REGUH-VBLNR&

AS &RUPEES&
/              
AS &PAISE&



*In Print program

form WORDS TABLES in_tab structure itcsy
out_tab structure itcsy.

DATA : rupees TYPE char100.
DATA : paise TYPE char100.
DATA : l_dmbtr TYPE char200.

READ TABLE in_tab WITH KEY 'REGUH-VBLNR'.
IF sy-subrc = 0.
  l_dmbtr = in_tab-value.
  SPLIT l_dmbtr AT 'AND' INTO rupees paise.
  CONCATENATE rupees 'AND' INTO rupees SEPARATED BY SPACE.
  CLEAR l_dmbtr.
ENDIF.
READ TABLE out_tab WITH KEY 'RUPEES'.
IF sy-subrc = 0.
  out_tab-value = rupees.
  MODIFY out_tab INDEX sy-tabix.
  CLEAR l_dmbtr.
ENDIF.
READ TABLE out_tab WITH KEY 'PAISE'.
IF sy-subrc = 0.
  out_tab-value = paise.
  MODIFY out_tab INDEX sy-tabix.
  CLEAR l_dmbtr.
ENDIF.
ENDFORM.

Message was edited by:

Perez C

0 Kudos

HI Perez,

Sorry for the very late reply from my side...(went for official).

Based on ur code im getting the Doc number in the rupees output and blank for paise.

FYI------in se38

REPORT ZFI_CHQ.

DATA AMT LIKE REGUD-WAERS.

data: words(120) type c,AMOUNT(120).

data: ant like PC207-betrg,t like reguh-vblnr,t1 type int4.

form WORDS TABLES in_tab structure itcsy

out_tab structure itcsy.

DATA : rupees TYPE char100.

DATA : paise TYPE char100.

DATA : l_dmbtr TYPE char200.

READ TABLE in_tab WITH KEY 'REGUH-VBLNR'.

IF sy-subrc = 0.

l_dmbtr = in_tab-value.

SPLIT l_dmbtr AT 'AND' INTO rupees paise.

CONCATENATE rupees 'AND' INTO rupees SEPARATED BY SPACE.

CLEAR l_dmbtr.

ENDIF.

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING

AMT_IN_NUM = ant

IMPORTING

AMT_IN_WORDS = words.

READ TABLE out_tab WITH KEY 'RUPEES'.

IF sy-subrc = 0.

out_tab-value = rupees.

MODIFY out_tab INDEX sy-tabix.

CLEAR l_dmbtr.

ENDIF.

READ TABLE out_tab WITH KEY 'PAISE'.

IF sy-subrc = 0.

out_tab-value = paise.

MODIFY out_tab INDEX sy-tabix.

CLEAR l_dmbtr.

ENDIF.

*amount = words.

  • READ TABLE outtab INDEX 1.

  • MOVE WORDS TO outtab-value.

  • MODIFY outtab INDEX 1.

ENDFORM. "diff

and in SCRIPT******

PERFORM WORDS IN PROGRAM ZFI_CHQ

USING &REGUH-VBLNR&

CHANGING &RUPEES&

CHANGING &PAISE&

ENDPERFORM

/: IF &REGUH-HBKID& EQ 'ALLBK'

  • &REGUH-NAME1&

*AS &RUPEES&

/

*AS &PAISE&

*************************

Is this write....

Pls do reply ur post...

thanks & regards

sankar

Former Member
0 Kudos

Split the String at the word 'and' into another string2 .. write string2 in second line

Former Member
0 Kudos

Hi Sankar,

Are you using SAP Script??? if yes I'll let you know solution...

0 Kudos

Hi Perez C,

ya...im using the SAP script only 'ZF001_PRENUM_CHK'

fyi...IN SCRIPT..THE CODE IS..

********

PERFORM WORDS IN PROGRAM ZCHEQUE

USING &REGUH-VBLNR&

CHANGING &AMOUNT&

ENDPERFORM

*********

IN SE 38

**************

READ TABLE intab INDEX 1.

t = intab-value.

select single RWBTR from reguh into ant where vblnr eq t.

ant = ant * ( -1 ).

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING

AMT_IN_NUM = ant

IMPORTING

AMT_IN_WORDS = words.

amount = words.

READ TABLE outtab INDEX 1.

MOVE WORDS TO outtab-value.

MODIFY outtab INDEX 1.

ENDFORM. "diff

******************

PLS POST UR COMMENTS ON URGENT BASIS...

REGARDS

SANKAR

former_member387317
Active Contributor
0 Kudos

Hi sankar,

DATA : str type string.

str = 'Ninety Seven Thousand Thirty seven and four paise only'.

strtemp1 = str+0(50). "here, 0 indicates starting position nd 50 for distance..

strtemp2 = str+50(60).

write : / strtemp1.

write : / strtemp2.

Hope it will solve ur problem.

<b>Reward points if useful..</b>

Thanks & Regards

ilesh 24x7

0 Kudos

Hi Ilesh,

u want me to assign the strtemp1 and 2 as one another character data types...

im getting errors here....strtemp1 & 2..

pls do reply

thanks & regards

sankar

former_member387317
Active Contributor
0 Kudos

hi..

DATA : str type string.

str = 'Ninety Seven Thousand Thirty seven and four paise only'.

<b>DATA : strtemp1(50) type C, strtemp2(20) type C.

  • Declare above two variables in ur code and do according to the size u want..

  • hear i took it of 50 and 20 character length...

</b>

strtemp1 = str+0(50). "here, 0 indicates starting position nd 50 for distance..

strtemp2 = str+50(20).

write : / strtemp1.

write : / strtemp2.

u can use strtemp1 and strtemp2 wherever u want now..

Hope it will solve ur problem..

Thanks & Regards

ilesh 24x7

0 Kudos

Hi ilesh,

its getting dump if the text of the string comes from another variable instead of giving in " "...

i.e.im moving the amount to str variable...while executing,it goes dump..error.

says the characters exceeded the current length of the string.....str2 error...

how to resolve it???

thanks & regards

sankar

former_member387317
Active Contributor
0 Kudos

Hi Try to look once in the error statement...

The error message u r getting is very clearly saying that the length of the variable is not enouth to hold the data...

Try to increase it and keep the value of strtemp2 as per ur requirement...

DATA : str type string.

str = 'Ninety Seven Thousand Thirty seven and four paise only'. " <b>lenth of str is 54</b>

<b>*DATA : strtemp1(50) type C, strtemp2(20) type C.</b>

DATA : strtemp1(34) type C, strtemp2(20) type C.

<b>* Declare above two variables in ur code and do according to the size u want..

</b>

strtemp1 = str+0(34). " <b>here, 0 indicates starting position nd 34 for distance..</b>

strtemp2 = str+34(20).

write : / strtemp1.

write : / strtemp2.

Hope now u understood...

Pls see the commented lines b4 using ny code in ur program...

<b>Reward points if useful..</b>

Thanks & Regards

ilesh 24x7