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

alvs

Former Member
0 Likes
594

how to perform background processing for alv reports

4 REPLIES 4
Read only

dani_mn
Active Contributor
0 Likes
567

Hi,

If you are using functin module method to create alv. then use list display for background.


IF sy-batch = 'X'.
 REUSE_ALV_LIST_DISPLAY.
ELSE.
 REUSE_ALV_GRID_DISPLAY
ENDIF.

if you are using OO concept for alv then use following code.

DATA: grid1  type ref to cl_gui_alv_grid,
      G_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.

  if g_custom_container is initial.

  IF cl_gui_alv_grid=>offline( ) IS INITIAL.

    create object g_custom_container
           exporting container_name = g_container.

    create object grid1
           exporting i_parent = g_custom_container.

     ELSE.
* If it is in backround:
      CREATE OBJECT grid1
             EXPORTING i_parent = G_DOCK.
    ENDIF.

   
    call method grid1->set_table_for_first_display
                  exporting
                   is_print         = gs_print
                   is_layout        = gs_layout
*** For Layout Variants
                   is_variant       = gs_variant
                   i_save           = 'A'
                   i_default        = 'X'


          changing   it_fieldcatalog = itab[]
                     it_outtab        = main1[].


  endif.

Regards,

Wasim Ahmed

Read only

Laxmana_Appana_
Active Contributor
0 Likes
567

Hi Pavan,

see the below code for generating the ALV in background.

check the sy-batch variable while creating the Grid object , if program is running in background pass docking container to Grid object without creating the instance of the docking container, if program is running in foreground place a container on the screen and create

container object and pass container to grid object.

Code :

DATA: o_grid TYPE REF TO cl_gui_alv_grid,

o_container TYPE REF TO cl_gui_custom_container,

o_dockingcontainer TYPE REF TO cl_gui_docking_container .

IF NOT sy-batch = 'X'. -


foreground

CREATE OBJECT o_container

EXPORTING

container_name = 'CONTAINER'.

CREATE OBJECT o_grid

EXPORTING

i_parent = o_container.

ELSE. -


background

CREATE OBJECT o_grid

EXPORTING

i_parent = o_dockingcontainer.

IF sy-subrc NE 0.

ENDIF.

ENDIF

Regards

Appana

Read only

Former Member
0 Likes
567
Read only

Former Member
0 Likes
567

hi pavan,

check the below links may be useful for u

http://www.sapfans.com/forums/viewtopic.php?t=83243

http://www.sapfans.com/forums/viewtopic.php?t=19224

Regards,

Naveen