Application Development and Automation 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: 
Read only

Shift Right and Overlay

Former Member
0 Likes
3,668

Hello,

I have a material = HR-SEC

I want to convert it to Internal format 000000000000HR-SEC. The conversion routine is not working.

I want to shift the material field to right and then add zeros using Overlay.

When I use Shift right, only one character is right shifted.

Any clue??

~Pranu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,511
DATA : s1 type char20,
       i1 TYPE i.

s1 = 'HR-SEC'.
i1 = strlen( s1 ).
i1 = 20 - i1.
OVERLAY s1 WITH '00000000000000000000'.
SHIFT s1 by i1 PLACES RIGHT CIRCULAR.

WRITE s1.

Hello,

I have a material = HR-SEC

I want to convert it to Internal format 000000000000HR-SEC. The conversion routine is not working.

I want to shift the material field to right and then add zeros using Overlay.

When I use Shift right, only one character is right shifted.

Any clue??

~Pranu

3 REPLIES 3
Read only

Former Member
0 Likes
1,511

Hi Pranu,

use

shift material by 12 places right.

here is sample code....


data:
w_i(30) type c value 'HR-SEC', " ur material field shd be  > the length by the number of places u r shiftng it.
w_over(12) type c value '000000000000'.
shift w_i right by 12 places.
write:/ w_i.
overlay w_i with w_over.
write:/ w_i.

Regards,

Mdi.Deeba

Edited by: Mdi.Deeba on Sep 14, 2009 3:38 PM

Read only

Former Member
0 Likes
1,512
DATA : s1 type char20,
       i1 TYPE i.

s1 = 'HR-SEC'.
i1 = strlen( s1 ).
i1 = 20 - i1.
OVERLAY s1 WITH '00000000000000000000'.
SHIFT s1 by i1 PLACES RIGHT CIRCULAR.

WRITE s1.
Read only

rainer_hbenthal
Active Contributor
0 Likes
1,511

shift material right deleting trailing space.