‎2007 Aug 28 7:03 AM
HI ALL,
I HAVE AN STATEMENT LIKE THIS "12.5% VAT TAX OR VAT IS 12.5%'
I WANT THIS 12.5 ALONE TO FILTERED FROM THE TEXT AND DISPLAY IT.
PLEASE HELP ME .
THANKS IN ADVANCE.
POINTS WILL REWARDED.
‎2007 Aug 28 8:34 AM
hi,
this code will solve your problem:
data len type i.
data itab type table of string with header line.
data: zstr type string value 'the tax is 4% of total amount',
zstr1 type string,zstr2 type string.
data int type i.
split zstr at space into table itab.
loop at itab.
if itab CO '0123456789%'.
zstr1 = itab.
replace '%' with ' ' into zstr1.
endif.
endloop.
write zstr1.
here the output is 4.
do reward points if it helps.rgds
Message was edited by:
abaper s
‎2007 Aug 28 7:18 AM
use split statement...
str = '12.5%'
split str at '%' into str1 str2.
str1 'll contain 12.5
‎2007 Aug 28 7:22 AM
but it can be any where say 4% in the middle or starting or at the last of the statement.
‎2007 Aug 28 7:21 AM
Hi,
write like this.
data:str(40) value '12.5% VAT TAX'.
data:num(5) type n.
num = str.
write:/ num.
<b>reward if helpful</b>
rgds,
bharat.
‎2007 Aug 28 7:24 AM
i have given you an example '12.5% vat' or vat 12.5%' .it can be like this also 'vat 4% of total'
‎2007 Aug 28 7:26 AM
‎2007 Aug 28 7:27 AM
‎2007 Aug 28 7:44 AM
BELOW ARE THE EXAMPLES OF THE STATEMANTS.
FROM THE BELOW STATEMANTS I WANT ONLY THE NUMERIC VALUES
Zero% output tax
16% eED + 2% ECESS + 4%VAT
4%
16% eED + 2% ECESS + 4%VAT
16% ED + 2% ECESS
10% LST - No Excise
Test Taxcode - Sandeep
16% ED + 2% ECESS + 12.5% CST
16% ED + 2% ECESS + 12.5% CST
16% ED + 2% ECESS + 4% CST
'Test Taxcode - Sandeep
Zero % input tax assets
Zero% output tax --assets
Zero % input tax
16% bed
4% CST
Input ED 16% and Cess for Depot
input tax 16% bed
Excise16 %, Ecess 2 %,AED 4%
12.5 % VAT DEDUCT
12.5 % VAT'
‎2007 Aug 28 8:34 AM
hi,
this code will solve your problem:
data len type i.
data itab type table of string with header line.
data: zstr type string value 'the tax is 4% of total amount',
zstr1 type string,zstr2 type string.
data int type i.
split zstr at space into table itab.
loop at itab.
if itab CO '0123456789%'.
zstr1 = itab.
replace '%' with ' ' into zstr1.
endif.
endloop.
write zstr1.
here the output is 4.
do reward points if it helps.rgds
Message was edited by:
abaper s
‎2010 Apr 27 4:32 AM
Very good thread for programming learning.
Just think that maybe the sentence
if itab CO '0123456789%'.
should be
if itab CO '0123456789%.'.
which would be better to consider the decimal point also.