2009 Oct 16 8:52 AM
Hi all,
I have created a report using local classes entirely,
I created the object reference and instantiating it in INITIALIZATION event then i'm using one method of the class in AT SELECTION-SCREEN ON event.
now everything is fine except that in some rare cases a a short dump is coming that object is not assigned, this is happening for the same test case also.
Now can there be any case that INITIALIZATION doesnot get executed and directly AT SELECTION-SCREEN is called?
this is happening entirely randomly.
кu03B1ятu03B9к
2009 Oct 16 8:57 AM
Hello Kartik,
AFAIK this is not possible. ABAP is an event-driven language & i donot believe that INITIALIZATION will be skipped.
A small question: Have you initialised the object instance after the program execution & tried to rerun the code? Are you getting the dump in that case?
BR,
Suhas
2009 Oct 16 8:57 AM
Hello Kartik,
AFAIK this is not possible. ABAP is an event-driven language & i donot believe that INITIALIZATION will be skipped.
A small question: Have you initialised the object instance after the program execution & tried to rerun the code? Are you getting the dump in that case?
BR,
Suhas
2009 Oct 16 9:39 AM
Ya even i still dont believe that initialization could have skipped but some cases on random basis it did happen, i even had a break point after the initialization statement which was getting triggered but on one case it did not stop on breakpoint and gave dump.
This means the only reason that it could have happened is that initialization did not get triggered. this is happening once in a while say once in 10 or 20 times
2009 Oct 16 9:41 AM
Hello Kartik,
You did not answer my question? Is there any pattern which the errors are following? Or is it happening randomly?
BR,
Suhas
2009 Oct 16 9:50 AM
No pattern.
entirely randomly, even while running the same variant.
2009 Oct 16 10:16 AM
I tried to reproduce this dump you are getting, but not able to do so. In my case, the INITIALIZATION event is triggered on every run(call). So also after executing the report and returning to the selection screen.
But I have one remark on approach, or actually it is a question? Why are you using the initialization event for creating an object? This event is only meant for initializing screen fields and not for instantiating objects. One of the down sides of procedural programming events is that you have not influence on the moment of triggering. But this will not answer your question I know.
BTW: My first thought was that it has something to do with the Garbage collector, but that would not explain the fact that your INITIALIZATION event is not called.
2009 Oct 20 8:27 AM
Hi Micky,
I am using the object in 'AT SELECTION-SCREEN' START-OF-SELECTION as well as END-OF-SELECTION events thats why i chose to instantiate the object in INITIALISATION.
Even I'm not able to reproduce the dump at will. Its weird that it happened at random and that too since past 2-3 i have not seen it, everything is running fine. only one day it gave trouble on a couple of times.
Closing this thread now as it is neither a standard problem nor has any solution.
кu03B1ятu03B9к
2009 Oct 20 8:31 AM
Hi Kartik,
too bad, I was quite curious on what could be causing this problem. Especially since it happens 'randomly'.
2009 Oct 20 8:36 AM
well here's the dump analysis, you might be interested to look at it, might be there's something i'm missing
INITIALIZATION.
* Too add movement types 101 & 261 as default movement types
l_wa_bwart-sign = c_i. "I
l_wa_bwart-option = c_eq. "EQ
l_wa_bwart-low = c_101. "101
APPEND l_wa_bwart TO s_bwart.
l_wa_bwart-low = c_261. "261
APPEND l_wa_bwart TO s_bwart.
* Instance Creation
CREATE OBJECT: o_validate.
IF sy-subrc IS NOT INITIAL.
MESSAGE e999.
ENDIF.
* Instance Creation
CREATE OBJECT: o_alv.
IF sy-subrc IS NOT INITIAL.
MESSAGE e999.
ENDIF.
***********************************************************************
* SELECTION SCREEN VALIDATIONS
***********************************************************************
AT SELECTION-SCREEN ON s_plant.
"To validate plant and check authorisation
CALL METHOD o_validate->validate_p_plant." <---Dump at this statement
AT SELECTION-SCREEN ON s_matnr.
"To validate material
CALL METHOD o_validate->validate_p_matnr.
AT SELECTION-SCREEN ON s_bwart.
"To validate movement type
CALL METHOD o_validate->validate_s_bwart.Runtime Error OBJECTS_OBJREF_NOT_ASSIGNED
Except. CX_SY_REF_IS_INITIAL
What happened?
Error in ABAP application program.
The current ABAP program "/FIR/RRF2S_A042_001" had to be terminated because one
of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_REF_IS_INITIAL', was
neither
caught nor passed along using a RAISING clause, in the procedure
"%_SEL_SCREEN_S_PLANT" "(FORM)"
.
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
Attempt to access a component using 'NULL' object reference (points
to nothing).
An object reference must point to an object (an instance of a class)
before you can use it to access components (variable: "O_VALIDATE").
Either the reference has not yet been set, or it has been reset to
'NULL' by a CLEAR statement.
I'm not sure where to move this create object statement.
Edited by: Kartik Tarla on Oct 20, 2009 1:07 PM
2009 Oct 20 9:44 AM
Hi Micky,
Whenever I execute the report directly the initialization gets called, but when i run the transaction code assigned to the program, it doesnot go to the initialization and directly goes to at selection screen event and dumps.
the transaction type is "program and selection screen" report transaction
кu03B1ятu03B9к
2009 Oct 20 9:48 AM
I deleted the tcode and created again, now its working fine, may be i have missed something previously, or may be i created it as dialog transaction(i dont remember exactly).
but now its fine.
thanks,
кu03B1ятu03B9к
2009 Oct 20 9:41 AM
seems i have got a pattern in what i thought was random occurance.