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: 

how can i cancatenate a string and constants

Former Member
0 Kudos
86

Presently I am having

010000012830DP_SPRNGBD

From 1-8-----Account number

From 9-12----sub account number

and From 13 to ramaining is the product_id

I already cancatenate above 3 fields.

Now I need to cancatenate anoyher two constants in between account number and sub account number and second in between subaccount and product_id.

Constants are return_indicator = y

Hivol indicator = N

Then after this my output will be 01000001Y2830NDP__SPRNGBD

I have taken the account number to product_id fields from one loop.

So How can concatenate these constants in to this loop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
56

within in your loop.

data : l_newvalue type string.

concatenate string+0(8)

c_return_indicator

string+8(3)

c_Hivol_indicator

string 11(24)

into l_newvalue.

condense l_new_value.

4 REPLIES 4

Former Member
0 Kudos
57

within in your loop.

data : l_newvalue type string.

concatenate string+0(8)

c_return_indicator

string+8(3)

c_Hivol_indicator

string 11(24)

into l_newvalue.

condense l_new_value.

Former Member
0 Kudos
56

Hi,

If the statement using concatenate variable1 constant1 into result_variable1 is not sucessful, then use the constant in the tild symbol. i.e. CONSTANT

Now it will work.

Regards,

Santhosh.

Former Member
0 Kudos
56

hi,

try this,

var1 = '010000012830DP_SPRNGBD'

cons1 = 'Y'

Cons2 = '_'

data v_final type string.

concatenate var10(8) cons1 var19(3) cons2 var1+13 into v_final.

write v_final.

regards

padma

Former Member
0 Kudos
56

well, this depends on the type of your constants.

concatenate works just for character based types e.G. char or string.

if you have variables constants of other types you need to concatenate, then slope them through a char variable.