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

ALV GRID with two Containers Background Execution

Former Member
0 Likes
2,119

Hi Friends,

I have to display two ALV GRIDS on two Container one below another in one screen.

I tried with 'DOCKING CONTAINER' - it works fine in foreground and not in BACKGROUND exection.

In background execution (F9) only one grid is getting displayed.

Please suggent whether I can go for CUSTOM CONTAINER or SPLITTER or some other way.

But I should use GRID DISPLAY and it should work in BACKGROUND EXECUTION also.

Regards,

Viji

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,615

Use two custom containers are use different refernce for each.

Use two custom containers are use different refernce for each.

9 REPLIES 9
Read only

Former Member
0 Likes
1,616

Use two custom containers are use different refernce for each.

Read only

0 Likes
1,615

Hi Vijay,

Can you explain in detail.

I have already tried with DOCKING CONTAINER. Only one GRID is getting displayed in the OUTPUT (SM37) when executing in BACKGROUND.

Regards,

Viji.

Read only

0 Likes
1,615

Create tow custom containers.

Creeate two object references for the contatiners

data : cont1 type ref to cl_gui_custom_container,

cont2 type ref to cl_gui_custom_container.

you can place the grid in these contatiners with the help of two alv grid objects

grid1 type ref to cl_gui_alv_grid,

grid2 type ref to cl_gui_alv_grid.

Handle these two objects seperately as two different programs.

Read only

0 Likes
1,615

Hi Vijay,

I have tried with Custom Container. Its working in fore ground. In background execution it displays only one GRID in the output. How to resolve this.

Regards,

Viji

Read only

0 Likes
1,615

Hi,

There is always a problem with the ALV in background if u use Containers / Grid to display more than one List at a time.

As a workaround solution u can try this

Inside the perform where you are displaying the ALVs check for the background mode ( SY-BATCH = 'X' ) and then call REUSE_ALV_LIST_DISPLAY one after another with the data you need to display.

Something like this:

IF SY-BATCH EQ 'X'.

PERFORM LIST_DISPLAY1.

PERFORM LIST_DISPLAY2.

ENDIF.

Inside the LIST_DISPLAY1 & LIST_DISPLAY2 call REUSE_ALV_LIST_DISPLAY to display the data.

You can control the SPOOL with IS_PRINT parameter of REUSE_ALV_LIST_DISPLAY.

Thanks,

Abhishek

Read only

0 Likes
1,615

Hi Abhishek,

I tried with that. But still I'm getting only one GRID in the output Display. Second GRID is not getting displayed while executing in Background (F9).

Is there any other way to acheive this?

Regards,

Viji

Read only

0 Likes
1,615

Hi Vijaya,

It should work. I am giving you a sample code. Try this and let me know.

REPORT TEST.

data gt_lfa1 type standard table of lfa1.

data gt_kna1 type standard table of kna1.

start-of-selection.

select * from lfa1 into table gt_lfa1 up to 10 rows.

select * from kna1 into table gt_kna1 up to 20 rows.

end-of-selection.

if sy-batch eq 'X'.

perform display_lfa1.

perform display_kna1.

endif.

form display_lfa1 .

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = sy-repid

i_structure_name = 'LFA1'

tables

t_outtab = gt_lfa1

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " DISPLAY_LFA1

form display_kna1 .

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = sy-repid

i_structure_name = 'KNA1'

tables

t_outtab = gt_kna1

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " DISPLAY_KNA1

copy and paste the code and create a program. Activate it and come back to SE38 screen.

Now, in program name give the name of the report created and then

select PROGRAM->EXECUTE->BACKGROUND from the MENU bar.

This will generate two separate spools . One for KNA1 data & one for LFA1 data.

Let me know how it goes.

Thanks,

Abhishek

Read only

former_member194669
Active Contributor
0 Likes
1,615

Hi,

If you are using the Object method along with DOCKING container then you need

Check IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL. Then create the container

This will convert the grid to a list in the background.

Example


CLASS-DATA list TYPE REF TO cl_gui_alv_grid.
 
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
ENDIF.
 
CREATE OBJECT list
EXPORTING i_parent = g_custom_container.

and after filling the itab use


CALL METHOD list->set_table_for_first_display
EXPORTING i_structure_name = 'ZTEST'
CHANGING it_outtab = gt_itab
it_sort = i_sort. 

Read only

Former Member
0 Likes
1,615

In BG Mode.

For the second ALV display, I downloaded the data into XL file and send it as email attachment to the user who executed the Program.

Thanks for your inputs.