Application Development 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: 

SALV Container Refresh in New screen

bhargava_dns
Participant
0 Kudos
1,239

I am using salv factory method to display the alv in say screen 6000 with custom container say c1, now on click of a buttoin in application tool bar i am calling a screen 6001 where i am display a different alv in a custom container c2 using factory method in salv.

The problem is when i am calling new screen eg 6001 from 6000 the alv that has been displayed in 6000 screen is being displayed in 6001 also, can any one please let me know how to get rid of this issue. I have refreshed, freed and cleared all the objects but still of no use.

8 REPLIES 8

SimoneMilesi
Active Contributor
450

Did you declare the two different ALV objects and the 2 different containers?
It's a bit hard to reply without reading the significant pieces of your code 🙂

0 Kudos
450

I did not create two different objects, As the salv factory method is a static class, i am unable to create object.

please let me know how to create object for static class.

0 Kudos
450

TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
EXPORTING
* LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
R_CONTAINER = o_cust
CONTAINER_NAME = 'ALV_CONT'
IMPORTING
R_SALV_TABLE = o_alv
CHANGING
T_TABLE = it_log_h
.
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.

TRY.
cl_salv_table=>factory(
EXPORTING
r_container = o_cust2
container_name = 'ALV_DTLS'
IMPORTING
r_salv_table = o_alv2
CHANGING
t_table = it_log_h_temp2 ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.

0 Kudos
450

DATA : o_alv TYPE REF TO cl_salv_table,
o_cust TYPE REF TO cl_gui_custom_container,
o_alv2 TYPE REF TO cl_salv_table,
o_cust2 TYPE REF TO cl_gui_custom_container.

I have created alv using the above described code.

i have differetn containers and different objects also, still i am facing the problem

450

How do you instantiate o_cust and o_cust2? If you pass the custom container name, why do you pass r_container too?

0 Kudos
450

@ bhargava.dns

Well, you create 2 objects, o_alv and o_alv2: what do you think they are if not 2 different objects?

And, as per Sandra's question, how did you created the containers objects?


DoanManhQuynh
Active Contributor
450

i guess you are using same ALV object for both screen. it easier to if you share your code.

bhargava_dns
Participant
0 Kudos
450

Solved the problem by creating objects for containers explicitly instead of passing to the factory method.

CREATE OBJECT O_CUST
EXPORTING
* PARENT =
CONTAINER_NAME = 'ALV_CONT'

TRY.
cl_salv_table=>factory(
EXPORTING
r_container = o_cust
* container_name = 'ALV_CONT'
IMPORTING
r_salv_table = o_alv
CHANGING
t_table = it_log_h ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.