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

CNTL_ERROR while running a report in background mode

Former Member
0 Likes
5,016

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

12 REPLIES 12
Read only

dani_mn
Active Contributor
0 Likes
2,358

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

Read only

Former Member
0 Likes
2,358

Thanks for this Ahmed,

But the problem is in the production server. So, how can this be handled?

Kumar

Read only

Former Member
0 Likes
2,358

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,358

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

Read only

Former Member
0 Likes
2,358

Thanks Rich,

regards,

Kumar

Read only

Former Member
0 Likes
2,358

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

Read only

Former Member
0 Likes
2,358

Which standard report is this?

Regards,

Ravi

Read only

Former Member
0 Likes
2,358

Hi,

its a sale order transaction.

Kumar

Read only

Former Member
0 Likes
2,358

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

Read only

Former Member
0 Likes
2,358

Hi,

Its a CRM transaction CRMD_ORDER. I am not talking with respect to R/3. Its in CRM sale order.

regards,

Kumar

Read only

0 Likes
2,358

Hi Nithin kumar

I'm having the same error on CRMD_ORDER in background.

Someone know this issue?

Read only

mandeep_shrestha1
Participant
0 Likes
2,358

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?