Execution of ALV grid control in background

Execution of ALV grid control in background

Whenever an ALV grid control program is executed in background, a short dump occurs stating:
Fatal error: GUI cannot be reached
And whenever an ALV grid control program is executed, 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 our 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.

Here is a sample code we use in our 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 use either cl_gui_alv_grid=>offline() or SY-BATCH is 'X' to check if the program is being

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

executed in background or not.

This was first published in May 2005

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.