2019 Jul 16 5:45 AM
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.
2019 Jul 16 8:37 AM
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 🙂
2019 Jul 16 12:17 PM
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.
2019 Jul 16 12:53 PM
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.
2019 Jul 16 12:55 PM
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
2019 Jul 16 3:16 PM
How do you instantiate o_cust and o_cust2? If you pass the custom container name, why do you pass r_container too?
2019 Jul 17 8:01 AM
@ 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?
2019 Jul 16 9:57 AM
i guess you are using same ALV object for both screen. it easier to if you share your code.
2019 Jul 17 1:09 PM
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.