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: 

Re: Reg concatenation

Former Member
0 Kudos

Hi,

val1 = R71234771

i should get val2 = R7123477.1

is my stmt correct r nt

concatenate val1(8) '.' val18(2) into val2

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sravanthi,

You have to use like

CONCATENATE val10(8) '.' val18(<no.of characters you want>) INTO val2.

Regards,

Atish

4 REPLIES 4

Former Member
0 Kudos

Hi Sravanthi,

You have to use like

CONCATENATE val10(8) '.' val18(<no.of characters you want>) INTO val2.

Regards,

Atish

former_member194669
Active Contributor
0 Kudos

Hi,

Check this


types : begin of t_value,
        val8(8) type c,
        val9(1) type c.
types : end of t_value.

data : wa_value type t_vlaue.

move : 'R71234771' to wa_value.

concatenate wa_value-val8 '.' wa_value-val9 to v_value.

Here v_value will be R7123477.1

aRs

Message was edited by:

former_member200338
Active Contributor
0 Kudos

Hi,

First confirm let us know the max length of the varaible. if is std, then you can use the above mentioned codes. else my option will be the following.

pass the val1 to FM conversion_alpha_input. to append by leading zeros.

data: l_len type i,

l_temp1 type val1,

l_temp2 type val1.

l_len = strlen( val1 ).

if you are sure that last 2 digits represnt the decimals then do the following.

l_len = l_len -2.

l_temp1 = val1 + 0(l_len).

l_temp2 = val1 + l+ len(2).

concatenate l_temp1 '.' l_temp2 into val2.

Regards,

Niyaz

Former Member
0 Kudos

Hi Gopal,

Check this code which will work for any length of your input.

DATA VAL1 TYPE STRING.

DATA VAL2 TYPE STRING.

DATA V_LEN TYPE I.

VAL1 = 'R71234771'.

V_LEN = STRLEN( VAL1 ).

V_LEN = V_LEN - 2.

CONCATENATE VAL10(V_LEN) VAL1V_LEN(1) SEPARATED BY '.' INTO VAL2.

WRITE:/ VAL2.

Thanks,

Vinay