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: 

Contains Operations and Move Percentage

Former Member
0 Kudos

Hi,

I am newbei in ABAP programming and rather stuck in these Problem, while doing a exercise.

Can any one explain me, how can i do it.

Problem 1:

<u><b>Move Percentage</b></u>

Data mc1(10) TYPE c VALUE 'ABCDEFGHIJ'.

<b>Use MOVE cmd with PERCENTAGE addition to display</b> output ‘ABCD’ left-aligned & right-aligned

Problem 2:

<u><b>Contains Operations</b></u>

Data test(50) type c value ‘Today is a wonderful day’.

<b>Check if it contains any numeric character</b>

Data num_var(6) type n value ‘12345’.

<b>Check if it contains all numeric values</b>

Also, Can u explain me OVERLAY String operation with a example. I am a bit confused in understanding this Operation.

Thanks in Advance.

Samir

1 ACCEPTED SOLUTION

suresh_datti
Active Contributor
0 Kudos

Hi Samir,

Try this..

Problem 1:

Data: mc1(10) TYPE c VALUE 'ABCDEFGHIJ',

mc2(10).

move mc1 to mc2 percentage 40 left.

write:/ mc1,mc2.

move mc1 to mc2 percentage 40 right.

write:/ mc1,mc2.

Problem 2:

Data: test(50) type c value ‘Today is a wonderful day’,

test2(10) value '1234567890'.

if test ca test2.

write:/ 'data contains a numeric character'.

endif.

Data: num_var(6) type n value ‘12345’,

num(10) value '1234567890'.

if num_var co num.

write: / 'Only mumeric values'.

endif.

Example for OVERLAY:

DATA: WORK(20) VALUE 'Th t h s ch ng d.',

HELP(20) VALUE 'Grab a pattern'.

OVERLAY WORK WITH HELP.

WORK now contains 'That has changed.' and the system field SY-SUBRC is set to 0.

Regards,

Suresh Datti

1 REPLY 1

suresh_datti
Active Contributor
0 Kudos

Hi Samir,

Try this..

Problem 1:

Data: mc1(10) TYPE c VALUE 'ABCDEFGHIJ',

mc2(10).

move mc1 to mc2 percentage 40 left.

write:/ mc1,mc2.

move mc1 to mc2 percentage 40 right.

write:/ mc1,mc2.

Problem 2:

Data: test(50) type c value ‘Today is a wonderful day’,

test2(10) value '1234567890'.

if test ca test2.

write:/ 'data contains a numeric character'.

endif.

Data: num_var(6) type n value ‘12345’,

num(10) value '1234567890'.

if num_var co num.

write: / 'Only mumeric values'.

endif.

Example for OVERLAY:

DATA: WORK(20) VALUE 'Th t h s ch ng d.',

HELP(20) VALUE 'Grab a pattern'.

OVERLAY WORK WITH HELP.

WORK now contains 'That has changed.' and the system field SY-SUBRC is set to 0.

Regards,

Suresh Datti