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: 

variable update using string concatenation itself. Is this a bug ?

PRAGSMATIC
Participant
0 Kudos
478

As in the screenshot, at line 5, it gives me the expected output,

but I was expecting the same at line 6. Why iv_text updates itself in mid way of right expressing. In my opinion, it should evaluate the right expression completely and then update the variable itself.

1 ACCEPTED SOLUTION

FredericGirod
Active Contributor
340

replace this line

data(lv_text) = `Z_CLAIM_500_EMAIL`

' --> Char

`--> string

3 REPLIES 3

FredericGirod
Active Contributor
341

replace this line

data(lv_text) = `Z_CLAIM_500_EMAIL`

' --> Char

`--> string

340

anurag.gupta.home24 When you write this inline declaration:

data(lv_text) = 'Z_CLAIM_500_EMAIL'.

the ABAP compiler declares LV_TEXT as a variable of type C and length 17 (because there are 17 characters in the right-hand side).

It means that LV_TEXT can never have more than 17 characters at runtime, any longer text assigned to it will be truncated.

Solution: do as Frederic said.

Sandra_Rossi
Active Contributor
0 Kudos
340

Please post the code as text instead of image, so that one can easily answer by testing your code.