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

constructor + subfield access - GETWA_NOT_ASSIGNED. ABAP kernel bug?

Sandra_Rossi
Active Contributor
2,674

Maybe another ABAP kernel bug, not corrected yet?

With the code below, the DATA(name) = ... does a SHORT DUMP with GETWA_NOT_ASSIGNED. In some other situations, it may not fail but return a value which is at a different offset an with a different length !!

DATA(text) = 'hello'.
FIND ALL OCCURRENCES OF 'l' IN text RESULTS DATA(matches).
LOOP AT matches ASSIGNING FIELD-SYMBOL(<match>).
  DATA(name) = to_upper( CONV string( text+<match>-offset(<match>-length) ) ). " short dump
ENDLOOP.

It's due to the constructor expression combined with the subfield access. If I remove one of them, then it's okay.

It seems that subfield access/constructor expression is really a problem, because I also had another issue with COND (not CONV) inside a table comprehension. Moving it to a LET aux = str+off(len) had solved the issue, but I didn't see a note about that topic (only 1972833 was close but was for an old kernel 741).

Do you have the same issue, what is your ABAP version/kernel, do you know what SAP note/kernel solves?

My ABAP versions:

  • ABAP 7.52 (7.5C) SP0 kernel 753 SP300.
  • ABAP 7.52 SP1 kernel 753 SP16.

Thank you very much.

Sandra

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
2,482

For the record, I have posted an incident at SAP support. I will keep you informed.

(link for my own use: 258494 / 2019 constructor + subfield access -> short dump GETWA_NOT_ASSIGNED)

UPDATE 20190603: it's corrected by the SAP note 2791097 - ABAP Expressions with Offset/Length Access Yield Wrong Result

12 REPLIES 12
Read only

arthursilva
Active Participant
0 Likes
2,482

Hello Sandra, hope you're well

The error happened because the interpretor cannot convert a static char into string (as you have done before). The field-symbol statement has the capablity to change a variable content dinamically (without using MODIFY statement, or any other...), so it's not possible to convert a char(5) to string(255) because a string value is to long for the table content.

I did a few changea on your code. Please test it again

DATA(text) = CONV string( 'hello' ).
FIND ALL OCCURRENCES OF 'l' IN text RESULTS DATA(matches) .
LOOP AT matches ASSIGNING FIELD-SYMBOL(<match>) .
*  DATA(name) = to_upper( CONV string( text+<match>-offset(<match>-length) ) ) . " short dump
  DATA(name) = to_upper( text+<match>-offset(<match>-length) ) . " no dump :)
ENDLOOP .

KR,
Arthur Silva

Read only

0 Likes
2,482

The ABAP runtime can "convert char into string". String is not 255 characters.

You may check this code, it works well:

data(v1) = 'Hello'.
data(v2) = to_upper( conv string( v1+2(1) ) ).

I expect more an answer about a patch for correcting the bug.

(or maybe I should contact the SAP support)

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,482

NOTE: the question is not about how to make the assignment work, the question is about what SAP note/kernel solves. And eventually could you run the code, say if it works and what is your ABAP version.

Read only

arthursilva
Active Participant
0 Likes
2,482

Sandra,

Did you try the code that I've sent ?

No field sympol, no error:

data(v1) = 'Hello'.
data(v2) = to_upper( conv string( v1+2(1) ) ).

With field-symbol: error:

DATA(name) = to_upper( CONV string( text+<match>-offset(<match>-length) ) ) .

Don't confuse the use of field-symbol with inline-declaration.

Read only

matt
Active Contributor
0 Likes
2,482

What happens if you use substring instead?

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,482

Matthew Billingham I can't test now, but probably that would work. But that's not my question 😉

Read only

former_member259807
Active Participant
2,482

For what it is worth, it dumps here on SAP_ABA 750 SP9 as well.

Read only

DoanManhQuynh
Active Contributor
2,482

its ok if i do like this:

DATA(text) = 'hello'.
DATA part.
FIND ALL OCCURRENCES OF 'l' IN text RESULTS DATA(matches).
LOOP AT matches ASSIGNING FIELD-SYMBOL(<match>).
  part = text+<match>-offset(<match>-length).
ENDLOOP.

but its syntax error if i do like this:

DATA(text) = 'hello'.
FIND ALL OCCURRENCES OF 'l' IN text RESULTS DATA(matches).
LOOP AT matches ASSIGNING FIELD-SYMBOL(<match>).
DATA(part) = text+<match>-offset(<match>-length).
ENDLOOP.

if i separate the inline like this, there is no dump:

FIND ALL OCCURRENCES OF 'l' IN text RESULTS DATA(matches).
LOOP AT matches ASSIGNING FIELD-SYMBOL(<match>). DATA(conv) = CONV string( text+<match>-offset(<match>-length) ).
DATA(name) = to_upper( conv ). ENDLOOP.

mightbe its about generic type in inline declaration...

Read only

matt
Active Contributor
0 Likes
2,482

sandra.rossi Oh yes, I know. But if you're going to use old-fashioned constructs... 😉

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,482

matthew.billingham let's discuss about substring/text+off(len) in this new question

Read only

Sandra_Rossi
Active Contributor
2,483

For the record, I have posted an incident at SAP support. I will keep you informed.

(link for my own use: 258494 / 2019 constructor + subfield access -> short dump GETWA_NOT_ASSIGNED)

UPDATE 20190603: it's corrected by the SAP note 2791097 - ABAP Expressions with Offset/Length Access Yield Wrong Result

Read only

2,482

SAP answered they are about to correct the bug, and they'll issue a new SAP note... to be continued...