Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Can program run in background without docking container

Hi Expert,

It's known that when we run a progarm in background,it should use docking containter for ALV display.

But i see in few program it run in background successfully without using docking container and it is using custom container in foreground.

Need your suggesting ....

Best Regards,

Sandip


Tags:
Former Member
Former Member replied

The problem is on what you  need to do

The container (and docking container too) are element of a dynpro, so they could be useless in a background process if the dynpro doesn't has to be used.

If you want to prevent the dump it needs to catch the exceptions, so try to copy BCALV_GRID_DEMO, and do this modifications:

- Original call of conainer:

MODULE PBO OUTPUT.

  SET PF-STATUS 'MAIN100'.

  IF G_CUSTOM_CONTAINER IS INITIAL.

   CREATE OBJECT G_CUSTOM_CONTAINER

           EXPORTING CONTAINER_NAME = G_CONTAINER.

    CREATE OBJECT GRID1

           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

         CHANGING  IT_OUTTAB        = GT_SFLIGHT.

  ENDIF.

ENDMODULE.

New call:

module pbo output.

   set pf-status 'MAIN100'.

   if g_custom_container is initial.

     create object g_custom_container

       exporting

         container_name              = g_container

       exceptions

         cntl_error                  = 1

         cntl_system_error           = 2

         create_error                = 3

         lifetime_error              = 4

         lifetime_dynpro_dynpro_link = 5.


     create object grid1

       exporting

         i_parent = g_custom_container.

     call method grid1->set_table_for_first_display

       exporting

         i_structure_name = 'SFLIGHT'

       changing

         it_outtab        = gt_sflight.

   endif.

endmodule.    

As you can see I've only added the excptions in order to prevent the dump and now it'll work in background, because the ALV will be print with a ALV list not GRID

Of course it's not very nice so it should be better to check if the program run in background mode, so the code should be:

MODULE PBO OUTPUT.

  SET PF-STATUS 'MAIN100'.

  IF G_CUSTOM_CONTAINER IS INITIAL.

      IF SY-BATCH IS INITIAL.

         CREATE OBJECT G_CUSTOM_CONTAINER

              EXPORTING CONTAINER_NAME = G_CONTAINER.

     ENDIF.

    CREATE OBJECT GRID1

           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

         CHANGING  IT_OUTTAB        = GT_SFLIGHT.

  ENDIF.

ENDMODULE.

So in this situation it desn't need to replace custom container with docking container

Max

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question