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

single line code is hard coded, can be fixed using CONCATENATE

Former Member
0 Likes
1,311

Hello,

Very Good Morning!

This part of the line is hard coded...we need to use CONCATENATE

st_txt-cnm9 = 'CNPJ ' + CGC_NUMBER.

This line is hardcoded in the program.

We need to convert it to character/string and concatenate with the CNPJ

Can any one show me the way that i need to do this.....

Any suggestions would be appreciated......

Regards,

Developer

1 ACCEPTED SOLUTION
Read only

former_member386202
Active Contributor
0 Likes
1,188

Hi,

Do like this

concatenate 'CNPJ' CGC_NUMBER into st_txt-cmm9 separated by space.

Regards,

Prashant

10 REPLIES 10
Read only

Former Member
0 Likes
1,188

do you want to Concatenate CNPJ to the CGC_NUMBER and put it into st_txt-cnm9??

Constants: c_cnpJ type char4 value 'CNPJ'.

Data: v_cgcnumber type char (any length).

v_cgcnumber = CGC_NUMBER.

concatenate c_cnpj v_CGCNUMBER into st_txt-cnm9.

Read only

former_member386202
Active Contributor
0 Likes
1,189

Hi,

Do like this

concatenate 'CNPJ' CGC_NUMBER into st_txt-cmm9 separated by space.

Regards,

Prashant

Read only

Former Member
0 Likes
1,188

hi,

You can simplr write a CONCATENATE statement

CONCATENATE 'CNPJ' CGC_NUMBER into st_txt-cnm9.

This will solve the problem

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
1,188

IF the CGC_NUMBER is character type then...

concatenate 'CNPJ '

CGC_NUMBER

into st_txt-cnm9.

IF it is not character type

data w_char(requiredlength) type c.

move CGC_NUMBER to w_char.

concatenate 'CNPJ '

w_char

into st_txt-cnm9.

Read only

Former Member
0 Likes
1,188

Hi,

Try this..

concatenate 'CNPJ' CGC_NUMBER into st_txt-cmm9

if u want sapce inbetween then give sperated by sapce at the end of this statement...

Regards,

Sai

Read only

naveen_inuganti2
Active Contributor
0 Likes
1,188

Hi..,

Your question should be more clear...

Any way Understand this code...,

> data: f1(10),

> f2(4) value 'CNBJ',

> f3(14).

>

> move sy-datum to f1.

> concatenate f2 f1 into f3.

>

> write:/ f3.

Thanks,

Naveen.I

Read only

Former Member
0 Likes
1,188

Hello,

Very Good Morning!

Thank you for your response.

I need to adjust the line of code st_txt-cnm9 = 'CNPJ ' + CGC_NUMBER.

As CGC_NUMBER cannot be added to a character or a string. Please convert the number to a character/string and concatenate with CNPJ, else the program will fail.

Will the suggestions that you had provided satisfy the condition 'CNPJ ' + CGC_NUMBER. ?

Yes, it will be inserted into st_txt-cnm9. Can any body explain.

Thanks...

Developer

Read only

Former Member
0 Likes
1,188

Hi try this code...

DATA var(30).

CONCATENATE 'CNPJ' 'CGC_NUMBER' INTO var.

st_txt-cnm9 = var.

Read only

former_member787646
Contributor
0 Likes
1,188

Hi

Try the following and check....

Data: myString(50) TYPE C.

myString = CGC_NUMBER.

CONCATENATE 'CNPJ ' myString INTO st_txt-cnm9.

Hope it helps you.

Murthy

Read only

Former Member
0 Likes
1,188

Hello,

Very Good afternoon!

I am sorry for the late response!

Thank you very much for all your suggestions and help.

Your suggestions were really helpful.

Points rewarded!

Regards,

Developer.