‎2008 Jun 13 8:22 AM
hi all
am working of smart forms am getting all the data n using the sum statement am getting the total in G_dmbtr am passing it to the functional module and its giving me the amount in words . now i had to split the string into two line
while spliting i had to take care tht it wont split
for ex billion in the first line BILL and in the second line
lion like tht
pls let me know the way
thanks in advance
DATA:
l_spell type spell.
data: var(2) type c, " for S$
var2(5) type c, " for Cents
var3(4) type c. " for only
var = 'S$'.
var2 = 'Cents'.
var3 = 'ONLY'.
PARAMETERS: g_dmbtr(20) type c.
data: g_amt_in_txt1 type string,
G_AMT_IN_TXT2 type string,
G_AMT_IN_TXT3 type string,
G_AMT_IN_TXT type string.
*BREAK-POINT.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = G_DMBTR
CURRENCY = 'SGD'
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = l_spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
ENDIF.
if l_spell-DECWORD = 'ZERO'.
CONCATENATE var l_spell-word var3 into g_amt_in_txt1
separated by space.
else.
************moving S$ into l_spell-word
CONCATENATE var l_spell-word into G_AMT_IN_TXT2
SEPARATED BY space. "string with S$ and dollars
moving .23(twenty three) cents into l_spell-decword
CONCATENATE l_spell-DECWORD var2 into G_AMT_IN_TXT3
SEPARATED BY space.
this is for concatinating both the above strings
CONCATENATE G_AMT_IN_TXT2 G_AMT_IN_TXT3 into G_AMT_IN_TXT
SEPARATED BY ' and '.
endif.
write:/ g_amt_in_txt.
‎2008 Jun 13 12:40 PM
‎2008 Jun 13 8:25 AM
hi,
You can use split at space for splitting the string.
Regards,
Veeresh
‎2008 Jun 13 8:35 AM
‎2008 Jun 13 8:40 AM
SPLIT f AT g INTO TABLE itab.
Example :
TYPES: BEGIN OF ITAB_TYPE,
WORD(20),
END OF ITAB_TYPE.
DATA: ITAB TYPE STANDARD TABLE OF ITAB_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 5.
SPLIT 'STOP Two STOP Three STOP ' AT 'STOP' INTO TABLE ITAB.
ITAB now has three rows. The first is empty, the second contains ' Two', and the third ' Three'.
In your case, you should split at SPACE.
Regards
Saket
‎2008 Jun 13 8:41 AM
You can split the string into an internal table of string type data.
split DATA at space INTO T_TABLE.
‎2008 Jun 13 8:43 AM
Hi Annavarapu,
Try this.This will work.
Suppose the string is str.
data : str(255) value 'Type a reply to the thread using the form below',
str1 type string,
str2 type string,
i1 type i.
i1 = 20.
if str+i1 is not initial.
if str+i1(1) = ''.
str1 = str(i1).
str2 = str+i1.
else.
do.
i1 = i1 + 1.
if str+i1(1) = ''.
str1 = str(i1).
str2 = str+i1.
exit.
endif.
enddo.
endif.
endif.
Reward points if found useful.
Regards
Megha
‎2008 Jun 13 10:50 AM
data: str1 type string.
data: str2 type string.
data: str type string value 'one two three four five six seven eight nine ten eleven twelve thirteen'.
data: len type i,
del(1) value '',
pos type i.
len = STRLEN( str ).
pos = len - 15.
write:/ len.
write:/ pos.
do len times.
if space BETWEEN pos and len.
if sy-subrc = 0.
split str at del into str1 str2.
endif.
endif.
ENDDO.
write:/ str , 'this is string',
/ str1,
/ str2.
hi
pls correct me
how to do it
cheers
uday
‎2008 Jun 13 12:22 PM
Hi Uday,
if space BETWEEN pos and len.
split str at del into str1 str2.
endif.
I think it should work without do loop also.
Regards
Megha
‎2008 Jun 13 12:40 PM
‎2008 Jun 16 2:34 AM
‎2008 Jun 16 2:59 AM
hi
rkd_word_wrap is working fine but the length is only 35.
am going to try EHS00_WORDWRAP02
cheers
uday
‎2008 Jun 13 12:56 PM
‎2008 Jun 16 3:12 AM
hi
thanks a lot to each n everyone who responded thanks a lot
raju the one u suggested is working fine
done a good job thanks a lot
cheers
uday
‎2008 Jun 18 6:52 AM
hi all
this is how it is solved once again thks to all of u
cheers
uday
TABLES: payr_fi, spell.
data: begin of itab occurs 0,
fr_line1(50),
end of itab.
PARAMETERS:
lang LIKE sy-langu DEFAULT sy-langu NO-DISPLAY, "language
curr LIKE payr_fi-waers DEFAULT 'SGD' NO-DISPLAY, " currency
amount LIKE payr_fi-rwbtr DEFAULT '123456789.12'. " AMOUNT 1000.66
DATA: doll TYPE string, " this is for dollars
cent TYPE string, " this is for cents
str5 type string value 'Cents', " this is for Cents
str6 type string, " this is for final output
str7 type string value 'only',
str8 type string,
str9 type string,
i_char(100) type c.
data: i_char1 type CHAR512. " this is for word wrap02 function module
data: fr_line(75) type c,
sr_line(100) type c.
data: l_var1(50) type c,
l_var2(200) type c.
START-OF-SELECTION.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
language = lang
currency = curr
amount = amount
IMPORTING
in_words = spell.
MOVE spell-word TO doll.
MOVE spell-decword TO cent.
CONCATENATE str5 cent str7 into str8 SEPARATED BY space.
CONCATENATE doll str8 into str9 SEPARATED BY ' AND '.
move str9 to i_char1.
CALL FUNCTION 'IQAPI_WORD_WRAP'
EXPORTING
textline = i_char1
DELIMITER = ' '
OUTPUTLEN = 50
IMPORTING
OUT_LINE1 = fr_line
OUT_LINE2 = sr_line
OUT_LINE3 =
TABLES
OUT_LINES = itab
EXCEPTIONS
OUTPUTLEN_TOO_LARGE = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at itab.
if sy-tabix = 1.
l_var1 = itab-fr_line1.
else.
concatenate l_var2 itab-fr_line1 into l_var2.
endif.
ENDLOOP.
write:/ l_var1.
write:/ l_var2.