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: 

Truncate last 6 characters

sachin_soni
Active Participant
0 Kudos
132

Hi gurus,

i have a requirement where i'm having amount in words like:

one thousand and five hundred rupees

and i want it as:

one thousand and five hundred

anybody give me an idea on this

waiting eagerly for answers,

sachin soni

1 ACCEPTED SOLUTION

Former Member
0 Kudos
99

which FM u are using ? make use of Key word --->replace.

replace RUPEES with SPACE.

Regards

peram

7 REPLIES 7

Former Member
0 Kudos
100

which FM u are using ? make use of Key word --->replace.

replace RUPEES with SPACE.

Regards

peram

Former Member
0 Kudos
99

hi..

U can use<b> replace</b> statement

<b>REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].</b>

The statement searches the field <c> for the first occurrence of the first <l> positions of the pattern <str1>. If no length is specified, it searches for the pattern <str1> in its full length.

Then, the statement replaces the first occurrence of the pattern <str1> in field <c> with the string <str2>. If a length <l> was specified, only the relevant part of the pattern is replaced.

If the return code value of the system field SY-SUBRC is set to 0, this indicates that <str1> was found in <c> and replaced by <str2>. A return code value other than 0 means that nothing was replaced. <str1>, <str2>, and <len> can be variables.

DATA: T(10) VALUE 'abcdefghij',

STRING LIKE T,

STR1(4) VALUE 'cdef',

STR2(4) VALUE 'klmn',

STR3(2) VALUE 'kl',

STR4(6) VALUE 'klmnop',

LEN TYPE I VALUE 2.

STRING = T.

WRITE STRING.

REPLACE STR1 WITH STR2 INTO STRING.

WRITE / STRING.

STRING = T.

REPLACE STR1 WITH STR2 INTO STRING LENGTH LEN.

WRITE / STRING.

STRING = T.

REPLACE STR1 WITH STR3 INTO STRING.

WRITE / STRING.

STRING = T.

REPLACE STR1 WITH STR4 INTO STRING.

WRITE / STRING.

<b>Reward points if useful</b>

Regards

Ashu

Former Member
0 Kudos
99

Hi

U can use

SHIFT AMT RIGHT BY 6 PLACES.

Regards,

Former Member
0 Kudos
99

hi sachin,

data: string1 type string.

string1 = 'one thousand and five hundred rupees'.

replace 'rupees' with ' ' into string1.

thanks,

viji

former_member194669
Active Contributor
0 Kudos
99

Hi,


split string at 'Rupees' into dummy1 dummy2

aRs

Former Member
0 Kudos
99

Hi,

see this code.

DATA:STR(30) TYPE C VALUE 'CAVCAFADGJFDGDT DTYDTY'.

DATA:N TYPE I.

WRITE:/ STR.

N = STRLEN( STR ).

N = N - 6.

STR = STR+0(N).

WRITE:/ STR.

rgds,

bharat.

0 Kudos
99

thank u all for great answers,im confused by so amny answers let me try and the i shall award accordingly,

but most of the ans are for static strings but my amount wud allways be dynamic.

THANKS A TON TO ALL.