09-19-2014 3:57 PM
Hello,
A short dump occurs while trying to change a field of a sorted table item passed as CHANGING parameter. Are non-key fields in a sorted structure protected? The error message does not explicitely say so. Can anyone link to documentation explaining this behavior?
best regards,
JNN
09-22-2014 1:01 PM
Hello,
Here, two things come together:
Horst
09-21-2014 10:27 AM
09-21-2014 1:59 PM
Error analysis
An exception has occurred which is explained in more detail below. The exception is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE' and was not caught in procedure "SORTED" "(METHOD)", nor was it propagated by a RAISING clause. Since the caller of the procedure could not have anticipated this exception, the current program was terminated.
The reason for the exception is: Field "%_##TVREG_001-EBELN" was to assigned a new value but this field is at least partly protected against changes. The following are protected against changes:
USING reference parameters and CHANGING parameters in FORMs, if the actual parameter is protected against changes.
09-21-2014 2:40 PM
Hi, According to short dump Actual parameter of your program is protected against changes. that why changing parameter is also protected. little changes to the code can solve your problem. Can you post the code so that I can suggest to resolve your problem. Regards Noorie
09-21-2014 4:14 PM
Hi Noorie,
check the code from the link to the Code Gallery.
Actually, I can think of a work around: create a sub-structure for non-key field and pass a reference to it as a CHANGING parameter. But my question here is, do you think the dump is normal/expected behavior?
I do not think so. I am actually presuming the error message is wrong. My argument is, the key fields of the structure are not accessed.
best regards,
JNN
09-22-2014 6:22 AM
What happens if instead of using a local defined variable, you define your sorted table as a private attribute of your class?
Edit: I tried it. No difference. Not surprising, really.
09-22-2014 6:44 AM
09-22-2014 7:19 AM
What a coincidence!
We stumbled over exactly that last week internally. The following crashes since the introduction of sorted and hashed tables:
CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main CHANGING VALUE(p) TYPE scarr.
ENDCLASS.
CLASS demo IMPLEMENTATION.
METHOD main.
ENDMETHOD.
ENDCLASS.
DATA itab TYPE SORTED TABLE OF scarr WITH NON-UNIQUE KEY carrid.
START-OF-SELECTION.
FIELD-SYMBOLS <fs> TYPE scarr.
INSERT INITIAL LINE INTO itab INDEX 1 ASSIGNING <fs>.
demo=>main( CHANGING p = <fs> ).
The problem is already addressed to the respective developers, answers pending ...
09-23-2014 7:34 PM
Hi Horst,
CLASS-METHODS main CHANGING VALUE(p) TYPE scarr..
what could be the use case of changing pararameter passed by value?
best regards,
JNN
09-24-2014 6:52 AM
Now that is neatly documented, I even have a guideline for that.
In short, changing parameters passed by reference are changed immediately, changing parameters passed by value are only returned if the method is left regularly (without exception) via RETURN or ENDMETHOD.
09-22-2014 9:14 AM
You are passing by reference with CHANGING.
It looks like read-only stuff can't be passed to method CHANGING.
When I pass a literal or constant, there is a syntax error.
System could have given you a syntax error instead of dump.
Have a look at this snippet. Both method calls throw syntax error.
/.
09-23-2014 8:00 PM
Hi Manish,
yes, but I would expect this syntax error.
I my code example, the field is not read-only, it is a partly protected field-symbol.
So I am now convinced it is a bug in the standard. I found this while trying to replace a STANDARD table with SORTED tables in my code, so I think it has a major impact and I hope it will be fixed in a future release.
If not, then at least the documentation (in this case, I mean this misleading message from the error analysis)
will be updated to say
best regards,
JNN
09-22-2014 1:01 PM
Hello,
Here, two things come together:
Horst
09-23-2014 7:40 PM
Hi Horst,
should we expect
in future releases?
Of course I would prefer the later.
best regards,
JNN
09-24-2014 6:53 AM