10-02-2009 3:58 PM
Hi there, I'm having some troubles adding a self defined function to an ALV in fullscreen. The thing is that I'm getting a dump after I press de button of my added function; the exception is CX_OBJECT_NOT_FOUND within the CL_SALV_FUNCTIONS->IS_SALV_FUNCTION.
Althoug I can press my new button, it seems that the function code haven't been added to the functions table checked in the IS_SALV_FUNCTION method and so the exception is thrown.
As far as I know you only have to add a function code within your own gui status and provide the logic in the event handlers, is there anything fancy to do when defining the function in the status for this to be considered as a SALV function? I've also followed some tutorials on this an by copying the gui status SALV_STANDARD and using the added function of this status gui does not throw any exepction...
Thanks in advance.
10-02-2009 5:50 PM
When you create a Full Screen ALV (like created with the FM REUSE_ALV_GRID_DISPLAY), system except only the PF-STATUS. You have to use the method SET_SCREEN_STATUS of the class CL_SALV_TABLE. To use this method, you need to create your own PF-STATUS with the required function in it.
Like:
gr_table->set_screen_status(
pfstatus = 'SALV_STANDARD'
report = gs_test-repid
set_functions = gr_table->c_functions_all ).
In the fullscreen ALV, you would NOT be able to add the function using the method ADD_FUNCTION of the class CL_SALV_FUNCTIONS. You can use this method while creating the ALV as the Grid (like created with class CL_GUI_ALV_GRID).
See the report SALV_DEMO_TABLE_FUNCTIONS and check the way Functions are enabled for the different types of ALV.
Regards,
Naimesh Patel
10-02-2009 6:43 PM
Hi Naimesh, my fault for not giving a code snipet of the source code, here it is:
DATA: obj_tree type ref to cl_salv_tree,
obj_funciones type ref to cl_salv_functions_tree.
TRY.
cl_salv_tree=>factory(
importing
r_salv_tree = obj_tree
changing
t_table = lcl_principal=>t_output
CATCH...
lcl_principal=>crear_arbol( ).
obj_tree->set_screen_status( pf_status = 'SALV_STANDARD'
report = sy-repid
set_functions = obj_tree->c_functions_all).
obj_funciones = obj_tree->get_functions( ).
obj_funciones->set_all( abap_true ).
... more coding here
obj_tree->display( ).
This coding works untill you push the new button included in the pf_status SALV_STANDARD, that will throw the exception mentioned abocve. I was thinking that I missed anything when creating the button in the pf status, cause when I debugg the code untill the exception the table with all the functions object does not have my new function code &LISTADO.
Thanks for your quick response.
Edited by: David Diaz on Oct 2, 2009 7:43 PM
10-02-2009 6:58 PM
Please do not pass SY-REPID directly.
obj_tree->set_screen_status( pf_status = 'SALV_STANDARD'
report = sy-repid "<<---- NO!!!
set_functions = obj_tree->c_functions_all).
Instead, pass this as a varaiable.
data: lv_repid type sy-repid.
lv_repid = sy-repid.
obj_tree->set_screen_status( pf_status = 'SALV_STANDARD'
report = lv_repid " LIKE THIS!!!
set_functions = obj_tree->c_functions_all).
Regards,
Rich Heilman
10-02-2009 11:26 PM
Hi Rich, I changed the method call by using a variable to pass the program as you kindly suggested, however it's still throwing the same dump at the same place...
Thank you for your help!.
10-09-2009 6:42 PM
Hi David,
You have to generate the standard status SALV_STANDARD to your program. Then only it will work.
10-15-2009 7:23 PM
Hi David,
You have to generate the standard status SALV_STANDARD to your program. Then only it will work.
07-09-2010 9:12 PM
As ABAP_Shisya says, you just have to create the STATUS GUI so it will work, ABAP Editor/ Right click on your program name (Object Name) / Create / STATUS GUI.
10-10-2009 9:00 AM
Hi, first of all I want to thank you for all the support and suggestions you did,
I want to share how I solved this issue and maybe somebody could find the workarround helpfull.
As I kept having the dump, I decided to make a copy from the standard report and status SALV_DEMO_TREE_FUNCTIONS -> SALV_STANDARD all toegether; I renamed them to Z_SALV_STANDARD and ZSALV_DEMO.... In this new copy of the status I added my function &LISTA. After generated and activated I tested it and notice that no dump was thrown.
After having the new status working with the copied standard report, I copied the status to my program and worked like a charm.
I still wonder what or where the problem is, but anyway things are working.
Regards.
David.
06-17-2012 10:09 AM
http://scn.sap.com/community/abap/blog/2012/06/16/back-to-the-future--part-04
If you want to add your own buttons to the PF-STAUS without having to create your own whilst still using CL_SALV_TABLE in full screen mode, please see the above link.