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

concatenation.. help

Former Member
0 Likes
947

HI guys,

Need some help in concatenation

VarA = Left (location+' '),4) + right (order,8)..

Please solve the above

Example: "Location = 09 & order = 99912365478

Then

(location + 2 space) = (09 ) .i.e. 4 characters leftmost of (location + 2 space) = (09 )

8 digits (rightmost) from order number = 12365478

So,

VarA =4 characters leftmost of (location + 2 space) + 8 digits (rightmost) from order number

=> VarA = = (09 ) + 12365478

=> VarA = = 09 12365478..

Incase location is 09AA, then

Then (location + 2 space) = (09AA ) .i.e. 4 characters leftmost of (location + 2 space) = 09AA

VarA = 09AA12365478

I need to get this output remember two spaces in between..

regards,

nazeer

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
928

DATA: temp(4) type c,

output(12) type c,

location(4) type c value 'AB',

order(12) type c value 'abcd12345678'.

move location to temp.

if temp+2(1) cs sy-abcde.

concatenate location0(4) order3(8) into output.

else.

concatenate location0(2) order3(8) into output separated by ' '.

endif.

write 😕 output.

HI guys,

Need some help in concatenation

VarA = Left (location+' '),4) + right (order,8)..

Please solve the above

Example: "Location = 09 & order = 99912365478

Then

(location + 2 space) = (09 ) .i.e. 4 characters leftmost of (location + 2 space) = (09 )

8 digits (rightmost) from order number = 12365478

So,

VarA =4 characters leftmost of (location + 2 space) + 8 digits (rightmost) from order number

=> VarA = = (09 ) + 12365478

=> VarA = = 09 12365478..

Incase location is 09AA, then

Then (location + 2 space) = (09AA ) .i.e. 4 characters leftmost of (location + 2 space) = 09AA

VarA = 09AA12365478

I need to get this output remember two spaces in between..

regards,

nazeer

7 REPLIES 7
Read only

Former Member
0 Likes
928

HI,

DATA: temp(4) type c,

output(12) type c.

move location to temp.

concatenate location0(4) order3(8) into output.

Best regards,

Prashant

Read only

0 Likes
928

HI prasanth..

Please go through the thread properly..

I need spaces inbetween the VarA if location is just 2 of length..

for your answer the output will be 0912345678 not

(09 12345678)..

regards,

nazeer

Message was edited by:

nazeer shaik

Read only

Former Member
0 Likes
928

Hi Nazeer,

use this code inur program.

Data: temp(12).

concatenate (location0(4)) (order3(8)) into temp.

Reward points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
929

DATA: temp(4) type c,

output(12) type c,

location(4) type c value 'AB',

order(12) type c value 'abcd12345678'.

move location to temp.

if temp+2(1) cs sy-abcde.

concatenate location0(4) order3(8) into output.

else.

concatenate location0(2) order3(8) into output separated by ' '.

endif.

write 😕 output.

Read only

Former Member
0 Likes
928

nazeer,

Location = 09

order = 99912365478

If you want 2 more spaces in location

concatenate location ' ' ' ' into location.

then

concatenate location order+3(8) into VarA .

Don't forget to reward if useful...

Read only

Former Member
0 Likes
928

Thanks for all your answers

Read only

Former Member
0 Likes
928

Hi...

<b>I have tried this code..it is meeting ur requirements..</b>

<b>it checks if the third and fourth digit of location is empty and then processes..</b>i changed the value of location and ran it again...working fine.

data:order(11).

data:location(4) type c value '90AA',

temp(12).

order = '99912345678'.

if location+2(2) ne ''.

concatenate location order+3(8) into temp.

write : temp.

else.

concatenate location0(2) order3(8) into temp separated by ' '. " two spaces here

write : temp.

endif.

Reward if useful!!

Message was edited by:

shweta soni