2006 Jun 07 1:09 PM
Hi,
I am running a report in background on daily basis. I am using cl_gui_custom_container class here and calling the constructor of this class. I am getting a CNTL_ERROR exception at this point. But if i run the same report directly, it is not throwing any exception. The problem is if i schedule it to background. I am not able to sort it out. So please if any body knows, answer this.
Thanks,
Kumar
Hi,
I am running a report in background on daily basis. I am using cl_gui_custom_container class here and calling the constructor of this class. I am getting a CNTL_ERROR exception at this point. But if i run the same report directly, it is not throwing any exception. The problem is if i schedule it to background. I am not able to sort it out. So please if any body knows, answer this.
Thanks,
Kumar
2006 Jun 07 1:17 PM
This error oftens comes when GUI got corrupted due to viruses. Try to run report from a different PC. or install new gui.
Regards,
Wasim Ahmed
Message was edited by: Wasim Ahmed
2006 Jun 07 1:20 PM
Thanks for this Ahmed,
But the problem is in the production server. So, how can this be handled?
Kumar
2006 Jun 07 1:24 PM
you need to put this code in your program, then it will not give that error.
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = off.
IF off IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
ENDIF.Regards
vijay
2006 Jun 07 1:34 PM
The reason for this error, is that the gui containers relies on the gui being present, since it is running in the background, there is no gui, hence the control error. YOu can get around this by doing a little coding. See below.
* ALV Grid
DATA: R_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: R_CONTROL TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: G_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'LISTOUT1'.
SET TITLEBAR 'LIST1'.
<b> IF R_CONTROL IS INITIAL.
* Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
* Run in foreground
CREATE OBJECT R_CONTROL EXPORTING CONTAINER_NAME = 'CONTAINER_1'.
CREATE OBJECT R_GRID EXPORTING I_PARENT = R_CONTROL.
ELSE.
* Run in background
CREATE OBJECT R_GRID EXPORTING I_PARENT = G_DOCK.
ENDIF.</b>
* Structure ZBA_MARA1 is defined in DDIC as linetype
CALL METHOD R_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
IT_OUTTAB = ITAB.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
Regards,
Rich Heilman
2006 Jun 07 1:38 PM
2006 Jun 08 11:50 AM
Rich,
How can we handle this issue in case of a standard report. My requirement is for a standard report where i cannot change the code. Kindly let me know if anybody have a solution.
regards,
Kumar
2006 Jun 08 12:03 PM
2006 Jun 08 12:09 PM
2006 Jun 08 12:14 PM
You said it was a report.
If you are talking about VA01, then its not a enjoy transaction and does not have any CONTROLS on it.
What is the Transaction code you are using?
Regards,
Ravi
2006 Jun 08 12:24 PM
Hi,
Its a CRM transaction CRMD_ORDER. I am not talking with respect to R/3. Its in CRM sale order.
regards,
Kumar
2011 Sep 28 6:20 PM
Hi Nithin kumar
I'm having the same error on CRMD_ORDER in background.
Someone know this issue?
2014 Feb 27 5:11 AM
Hi Nithin,
I was facing the similar issue in a custom report program. I did apply the logic that you'd mentioned.
I've implemented the code as below.
IF gr_container IS INITIAL.
*** Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
* Run in foreground
CREATE OBJECT gr_container
EXPORTING
container_name = 'WORK_AREA_CONTAINER'.
CREATE OBJECT lv_grid
EXPORTING I_PARENT = gr_container.
ELSE.
* Run in background
CREATE OBJECT lv_grid
EXPORTING
I_PARENT = gr_dockcontainer.
ENDIF.
ENDIF.
i_parent_control = gr_dockcontainer.
CREATE OBJECT m_base_splitter
EXPORTING
parent = i_parent_control
ROWS = 1
columns = 2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CALL METHOD m_base_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = m_splitter_right_part
EXCEPTIONS
OTHERS = 1.
After I've implemented the above code I'm getting the following error in the batch job:
Category ABAP Programming Error
Runtime Errors OBJECTS_OBJREF_NOT_ASSIGNED
Except. CX_SY_REF_IS_INITIAL
You attempted to use a 'NULL' object reference (points to 'nothing')
access a component (variable: "M_BASE_SPLITTER").
An object reference must point to an object (an instance of a class)
before it can be used to access components.
Either the reference was never set or it was set to 'NULL' using the
CLEAR statement.
Would you be able to help me in the above issue?