Wednesday, April 23, 2014

Code useful for executing ALV Grid report in Background mode causing short dump

 
Whenever an ALV grid control program is executed in background, a short dump occurs
Error:   GUI cannot be reached 
Reason
Whenever an ALV grid control program is executed in foreground it tries to create some front-end related objects. But when the same program is executed in background, the above error occurs as it fails to create front-end objects (GUI objects). So in order to rectify this problem, we need to use the docking container instead of custom container.
The docking container doesn't need any of the custom controls on the screen, instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom).
The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards.
We can use the below code when ALV is used in background programs
DATA : or_doc TYPE REF TO cl_gui_docking_container.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
 CREATE OBJECT or_custom_container
   EXPORTING
    container_name = c_container.
 CREATE OBJECT or_grid
   EXPORTING
    i_parent = or_custom_container.
ELSE.
  CREATE OBJECT or_grid
   EXPORTING
    i_parent = or_doc.
ENDIF.
We can also use  SAP system variable SY-BATCH  is ‘X’ to check if the program is being executed in background or foreground


4 comments:

  1. SAP ABAP - Screen programming - http://www.21cssindia.com/courses/sap-abap-online-training-207.html
    Simple screen - Different events - Table control - Tab strip - BDC (Batch Data Communication) - Call transaction - Session method - LSMW - Scripts - Smart forms - Flow - Smart style - Form development - Driver program - Web List General Directory PageRank 5 Directory - Debugging - Performance tuning techniques - Workbench organizer and Transport system - Interview Orientation and Resume preparation - Employees to learn at their own pace and maintain control of learning “where, when and how” with boundless access 24/7by 21st Century Software Solutions. contact@21cssindia.com

    ReplyDelete
  2. All ABAP programs stored inside the SAP databases and executed under the control of the run-time system, which is part of the SAP kernel. In this section you can find ABAP tutorial and PDF study materials for your reference. Normally a transaction code is used for executing an ABAP program.

    SAP ABAP ONLINE TRAINING

    ReplyDelete
  3. Start Making Money From Your Blog. Join Chitika today and place the ads in your blog.

    Chitika Ad Network - Best Adsense Alternative

    ReplyDelete
  4. Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here.Well, got a good knowledge.

    Sap Training in Chennai

    ReplyDelete