Hi everybody
The new cl_salv_table class is fine for a lot of things but it definitely needs EDIT type of functionality -- doesn't need a huge amount but the user should be able to edit individual cell(s) and insert / delete lines as with the current cl_gui_alv_grid.
To show SAP that this function is needed just postunder this a single line Agree.
If enough replies come back I'm sure SAP will consider this in future.
I'd love to do a Poll but this Forum doesn't seem to have that facility available.
Cheers
jimbo
We need this definately !
Currently I'm using *alv for editable tables and *salv for view tables, that's not satisfactorily.
Furthermore the *alv API disagrees with the modern *salv OO concept.
Hope SAP will implement the edit issue in *salv !
Regards
Olaf
Add me to this list. I can't believe they didn't provide this. I just found out about this issue today from one of our developers who was using the old grid (reuse_alv) because of this issue.
Since all of our employees went to the new grid (cl_salv) class and don't know the old grid other than from examples, now we've got an issue because we stated up front to all of our contractors that only the new grid was to be used.
I know what SAP is going to say - use a dialog - that's a major pain compared to the old grid way. And now I've got a standards issue on my hands - oh what fun.
I'm in.
>And now I've got a standards issue on my hands - oh what fun.
I love standards. So many to choose from...
matt
I strongly support this suggestion.
Cheers
Thomas
Count me in. I haven't used this new ALV OM a lot yet, but I've discovered this edit mode lack yesterday on a thread while searching for another functionality.
I just couldn't believe it. What would happen if you develop a fairly complicated program using CL_SALV* classes and then the user requests to "just add editing capability on this field and we're done" (which is quite common)? Half of the program would have to be redone using CL_GUI_ALV_GRID?
I've tried a bit of "Old Fashioned" Hacking --- hope the US military are not reading this or I might be extradited to the US to serve 50 years in jail for "Terrorism" (referring to what the US are attempting to do to one of our UK citizens at the moment).
Inheriting the the cl_salv class doesn't actually help as this cl_salv_class makes calls all over the place and by the time you are done you are better off using the cl_gui_alv_grid anyway.
I certainly can understand the concept of making a quick easy callable ALV display has attractions but as people have posted users often want an "Editable" facility after a report has been designed.
I'm actually surprised this wasn't built in to the factory model.
Cheers
jimbo.
Oh yes, there should definitely be an editing function!
BR Jörg
Yeah
I too join the group, It's very much appreciated if edit option is incorporated!
Regards,
Ravi
Hello Everybody,
I am also facing the same problem , so include me also.
Thanks,
Pavan.
good thought Include me also.....
Before starting the poll, have look at this work around:
https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12187
Regards,
Naimesh Patel
I am happy about the work-around. But I still think it should be available from cl_salv_table without that. It's annoying that SAP seems to have abandoned OO ALV in favor of webdynpro.
Hi there
I'm still amazed this hasn't YET been done.
Actually Web Dynpro won't replace this functionality yet -- there's a big difference in running web dynpro and an OO report from a bog standard R/3 system.
Also -FM REUSE people
Don't use that -- use cl_gui_alv_grid -- this is fully OO and does have edit capability -- bit complex but does have it.
You can also run it in batch so there's absolutely NO NEED to use the old FM any more.
cheers
jimbo
>
james hawthorne wrote:
> Hi there
> I'm still amazed this hasn't YET been done.
> Actually Web Dynpro won't replace this functionality yet -- there's a big difference in running web dynpro and an OO report from a bog standard R/3 system.
>
> Also -FM REUSE people
>
> Don't use that -- use cl_gui_alv_grid -- this is fully OO and does have edit capability -- bit complex but does have it.
>
> You can also run it in batch so there's absolutely NO NEED to use the old FM any more.
>
> cheers
> jimbo
only problem is dat cl_gui_alv_grid doesn't have full screen mode. I started to investigate a new OO standard for the reuse_alv a few years ago but got stuck in the 2 classes cl_gui_alv_grid and cl_salv_table which both had major incapabilities compared to reuse_alv.
http://forums.sdn.sap.com/thread.jspa?threadID=301620
it's already complex enough to set up and understand 1 standard way of programming ALV lists editable or not. so It's not feasible to do a lot of investigation in setting up a standard for 1 class while you know that 1/3 of the z programms require the other class which require an equal amount of investigation and testing.
with the function GUI_UPLOAD they make a method 1-1 also called GUI_UPLOAD in CL_GUI_FRONTEND_SERVICES
which just calls the old function. so from now on I can easily use the method instead of the function.
why is that not done with the reuse_alv ?
Edited by: A. de Smidt on Oct 29, 2009 9:53 AM
Hi there
this is a COMMON misconception - you CAN use the WHOLE screen in cl_gui_alv_grid.
Don't define a CUSTOM container - just use a docking container.
This gives you a FULL SCREEN.
If you need to split then use splitting control (continer).
(The CODE directive in the forum doesn't seem to work any more as I only get PLAIN TEXT input options.)
Cheers
jimbo
I also tried this workaround, but it is still quite complicated...
there is another way to get acces to this functionality,
by using function module GET_GLOBALS_FROM_SLVC_FULLSCR
to get the reference to CL_GUI_ALV_GRID
In this example you just have to enter in the command field:
%_EDIT_ALL - to set the whole ALV editable
or
%_EDIT_[FIELDNAME] - to set only one column editable
in addition i added a check, so this is only available on NON-productive systems
*&---------------------------------------------------------------------* *& Report ZTEST_ALV_EDITABLE *& *&---------------------------------------------------------------------* REPORT ztest_alv_editable. *----------------------------------------------------------------------* * CLASS lcl_event_handler DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_event_handler DEFINITION. PUBLIC SECTION. METHODS: on_user_command FOR EVENT added_function OF cl_salv_events IMPORTING e_salv_function, handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed sender. ENDCLASS. "lcl_event_handler DEFINITION *----------------------------------------------------------------------* * CLASS lcl_report DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_report DEFINITION. PUBLIC SECTION. DATA: gt_tab TYPE REF TO data, gr_alv TYPE REF TO cl_salv_table. METHODS: constructor, show_alv. ENDCLASS. "lcl_report DEFINITION PARAMETERS: p_table TYPE tabname. DATA: lr_report TYPE REF TO lcl_report. START-OF-SELECTION. CREATE OBJECT lr_report. lr_report->show_alv( ). *----------------------------------------------------------------------* * CLASS lcl_report IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_report IMPLEMENTATION. METHOD constructor. FIELD-SYMBOLS: <lt_tab> TYPE ANY TABLE. CREATE DATA gt_tab TYPE TABLE OF (p_table). ASSIGN gt_tab->* TO <lt_tab>. SELECT * FROM (p_table) INTO TABLE <lt_tab>. ENDMETHOD. "constructor METHOD show_alv. DATA: lr_func TYPE REF TO cl_salv_functions_list, lr_events TYPE REF TO cl_salv_events_table, lr_handler TYPE REF TO lcl_event_handler. FIELD-SYMBOLS: <lt_tab> TYPE ANY TABLE. ASSIGN gt_tab->* TO <lt_tab>. TRY. cl_salv_table=>factory( IMPORTING r_salv_table = gr_alv CHANGING t_table = <lt_tab> ). CATCH cx_salv_msg. ENDTRY. lr_func = gr_alv->get_functions( ). lr_func->set_all( 'X' ). lr_events = gr_alv->get_event( ). CREATE OBJECT lr_handler. SET HANDLER lr_handler->on_user_command FOR lr_events. gr_alv->display( ). ENDMETHOD. "show_alv ENDCLASS. "lcl_report IMPLEMENTATION *----------------------------------------------------------------------* * CLASS lcl_event_handler IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_event_handler IMPLEMENTATION. METHOD on_user_command. DATA: lr_grid TYPE REF TO cl_gui_alv_grid, lv_layout TYPE lvc_s_layo, lt_fieldcat TYPE lvc_t_fcat, lr_grid_events TYPE REF TO lcl_event_handler, lv_fieldname TYPE lvc_fname. FIELD-SYMBOLS: <ls_fieldcat> LIKE LINE OF lt_fieldcat. CALL FUNCTION 'PRGN_CHECK_SYSTEM_PRODUCTIVE' EXCEPTIONS client_is_productive = 1 OTHERS = 2. IF sy-subrc NE 1. IF e_salv_function(7) EQ '%_EDIT_'. IF e_salv_function NE '%_EDIT_ALL'. lv_fieldname = e_salv_function+7. ELSE. CLEAR lv_fieldname. ENDIF. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING e_grid = lr_grid. CALL METHOD lr_grid->get_frontend_layout IMPORTING es_layout = lv_layout. IF lv_fieldname IS NOT INITIAL. lr_grid->get_backend_fieldcatalog( IMPORTING et_fieldcatalog = lt_fieldcat ). READ TABLE lt_fieldcat ASSIGNING <ls_fieldcat> WITH KEY fieldname = lv_fieldname. IF <ls_fieldcat> IS NOT ASSIGNED. MESSAGE w398(00) WITH 'Fieldname' lv_fieldname 'does not exist'. EXIT. ENDIF. IF <ls_fieldcat>-edit = 'X'. lv_layout-no_toolbar = abap_true. <ls_fieldcat>-edit = abap_false. ELSE. lv_layout-no_toolbar = abap_false. <ls_fieldcat>-edit = abap_true. ENDIF. lr_grid->set_frontend_fieldcatalog( EXPORTING it_fieldcatalog = lt_fieldcat ). ELSE. IF lv_layout-edit = abap_true. CLEAR lv_layout-edit. ELSE. lv_layout-edit = abap_true. ENDIF. ENDIF. CALL METHOD lr_grid->register_edit_event EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter. CREATE OBJECT lr_grid_events. SET HANDLER lr_grid_events->handle_data_changed FOR lr_grid. CALL METHOD lr_grid->set_frontend_layout EXPORTING is_layout = lv_layout. CALL METHOD lr_grid->refresh_table_display( ). ENDIF. ENDIF. ENDMETHOD. "on_user_command
Edited by: Jakob Simon Mainka on Dec 14, 2011 12:17 AM
can you perhaps split the code blocks into several blocks, above a certain amount of characters code blocks are scrambled since they don't want you to copy past complete programs here on sdn
kind regards
arthur
Jakob Simon Mainka wrote:
&----
*& Report ZTEST_ALV_EDITABLE
*&
&----
REPORT ztest_alv_editable.
----
CLASS lcl_event_handler DEFINITION
----
*
----
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
on_user_command
FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function,
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed sender.
ENDCLASS. "lcl_event_handler DEFINITION
----
CLASS lcl_report DEFINITION
----
*
----
CLASS lcl_report DEFINITION.
PUBLIC SECTION.
DATA: gt_tab TYPE REF TO data,
gr_alv TYPE REF TO cl_salv_table.
METHODS: constructor,
show_alv.
ENDCLASS. "lcl_report DEFINITION
PARAMETERS: p_table TYPE tabname.
DATA: lr_report TYPE REF TO lcl_report.
START-OF-SELECTION.
CREATE OBJECT lr_report.
lr_report->show_alv( ).
----
CLASS lcl_report IMPLEMENTATION
----
*
----
CLASS lcl_report IMPLEMENTATION.
METHOD constructor.
FIELD-SYMBOLS: <lt_tab> TYPE ANY TABLE.
CREATE DATA gt_tab TYPE TABLE OF (p_table).
ASSIGN gt_tab->* TO <lt_tab>.
SELECT * FROM (p_table) INTO TABLE <lt_tab>.
ENDMETHOD. "constructor
METHOD show_alv.
DATA: lr_func TYPE REF TO cl_salv_functions_list,
lr_events TYPE REF TO cl_salv_events_table,
lr_handler TYPE REF TO lcl_event_handler.
FIELD-SYMBOLS: <lt_tab> TYPE ANY TABLE.
ASSIGN gt_tab->* TO <lt_tab>.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = <lt_tab> ).
CATCH cx_salv_msg.
ENDTRY.
lr_func = gr_alv->get_functions( ).
lr_func->set_all( 'X' ).
lr_events = gr_alv->get_event( ).
CREATE OBJECT lr_handler.
SET HANDLER lr_handler->on_user_command FOR lr_events.
gr_alv->display( ).
ENDMETHOD. "show_alv
ENDCLASS. "lcl_report IMPLEMENTATION
----
CLASS lcl_event_handler IMPLEMENTATION
----
*
----
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_user_command.
DATA: lr_grid TYPE REF TO cl_gui_alv_grid,
lv_layout TYPE lvc_s_layo,
lt_fieldcat TYPE lvc_t_fcat,
lr_grid_events TYPE REF TO lcl_event_handler,
lv_fieldname TYPE lvc_fname.
FIELD-SYMBOLS: <ls_fieldcat> LIKE LINE OF lt_fieldcat.
CALL FUNCTION 'PRGN_CHECK_SYSTEM_PRODUCTIVE'
EXCEPTIONS
client_is_productive = 1
OTHERS = 2.
IF sy-subrc NE 1.
IF e_salv_function(7) EQ '%_EDIT_'.
IF e_salv_function NE '%_EDIT_ALL'.
lv_fieldname = e_salv_function+7.
ELSE.
CLEAR lv_fieldname.
ENDIF.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lr_grid.
CALL METHOD lr_grid->get_frontend_layout
IMPORTING
es_layout = lv_layout.
IF lv_fieldname IS NOT INITIAL.
lr_grid->get_backend_fieldcatalog(
IMPORTING et_fieldcatalog = lt_fieldcat ).
READ TABLE lt_fieldcat ASSIGNING <ls_fieldcat>
WITH KEY fieldname = lv_fieldname.
IF <ls_fieldcat> IS NOT ASSIGNED.
MESSAGE w398(00)
WITH 'Fieldname'
lv_fieldname
'does not exist'.
EXIT.
ENDIF.
IF <ls_fieldcat>-edit = 'X'.
lv_layout-no_toolbar = abap_true.
<ls_fieldcat>-edit = abap_false.
ELSE.
lv_layout-no_toolbar = abap_false.
<ls_fieldcat>-edit = abap_true.
ENDIF.
lr_grid->set_frontend_fieldcatalog(
EXPORTING it_fieldcatalog = lt_fieldcat ).
ELSE.
IF lv_layout-edit = abap_true.
CLEAR lv_layout-edit.
ELSE.
lv_layout-edit = abap_true.
ENDIF.
ENDIF.
CALL METHOD lr_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CREATE OBJECT lr_grid_events.
SET HANDLER lr_grid_events->handle_data_changed FOR lr_grid.
CALL METHOD lr_grid->set_frontend_layout
EXPORTING
is_layout = lv_layout.
CALL METHOD lr_grid->refresh_table_display( ).
ENDIF.
ENDIF.
ENDMETHOD. "on_user_command
thanks ![]()
Even i like the workaround I too think that there should be and "offical" (and supportet) way of makin an SALV Grid editable
Please addd me to the Group
Supported already!!!
Flavio Rasseli
Hi Flavio,
Do you mean the ALV editable functionality is now available in CL_SALV_TABLE? If yes, can you explain which method you used?
Cheers,
Jodie
No! I mean: the CAUSE is supported by me!
Sorry.
To be fair, the V stands for Viewer, not Editor (cos that would make it ALE and confusing
). SAP should never have opened the original viewer code up for editing.
so in that case if V stands for viewing there must come an class
CL_SALE_TABLE for the editing which inherits all the methods from CL_SALV_TABLE.
question remains the same. we also stick to reuse_alv since the class is not complete with the edit mode.
kind regards
arthur
I Agree
Count me in.
Edited by: Shanmugam Maheswaran on Oct 29, 2009 6:23 PM
Add me to the Group too guys. I had to convince our guys a lot to get back to cl_alv_grid instead cl_salv_table for edit purposes.
Regards
Count me in!
Containers aren't supported in batch mode (someone always requests their reports in background), and i'm getting tired of the REUSE function, this needs to be incorporated into this new architecture.
I totally agree that ALV OM should have support for Editable content in the ALV. I have used the new model which is really nice and easy to understand, i just don't understand why the editing functionality is not supported. I haven't looked at the work around solution that was suggested here but i hope that i don't have to use the old classes since i never worked with them.
Hi,
I also tried finding the editing function but was not able to find anything.
I strongly support you in this. Lets see if SAP does something about it.
Regards,
Manish Kumar
I agree.
I'd rather SAP supplied and supported a well-documented solution. Using workarounds like the one Naimesh Patel has blogged about is probably not supported by SAP.
Regards,
Paul
+1
Uwe, aka @se38
+1
Yes, very annoying. Someone should come up with a solution to this!
Count me in as well!
Regards, Fred
I agree
Max
I'm in it too.
Regards Jörg
I agree 100%.
Too bad that nobody from sap wants to share their view on things....
One more supporting vote to this.
Wee need the edit option
Agree
agree
agree
how many agrees still have to come before SAP will implement this obvious necessary request ?
We are still using reuse_alv for all reports since there still is no substitute to replace it with.
if they want me to use OO then also provide the proper objects for this.
kind regards
arthur
I use cl_salv_table when ever I am creating a view-only report in SAP Gui. I would really like it if I could make editable ALV Grid like CL_GUI_ALV_GRID. Come on SAP, you allow for editable ALV in WD Abap which is very similar to cl_salv_table. I agree completely that this functionality needs to be added.
What I would really like to know is why SAP did not include this feature and what is their reasons for not including this feature. If someone from SAP could respond in order to inform the community why this feature is not included and if it ever will be included, we would appreciate it. Even if SAP has no plans to include editable ALV Grid functionality in cl_salv_table, I think that the community would appreciate knowing that. Not knowing why it was not included or if it ever will be is worse than knowing that the feature will not be included.
Gregg Hinkle
Edited by: Gregg Hinkle on Aug 4, 2010 9:36 AM
Hi Gregg,
I fully agee. I had the same problem some days ago and I implemented a workaround solution with a pop-up box and field-symbols. If you need such a workaround solution, I can post it here. But nevertheless an ootb solution would be nice and is long overdue.
Regards
Björn
Yes SAP please add this function to the SALV model. It would make development much easier. especially if the edit function needs to be added to an existing report (based on SALV).
agree
I Agree
Please add my name to the list.
Regards,
José Paquette
Count me in.
well the functionality would be useful
but let me tell you that it is not this functionality which is the more important
the missing one is building the field catalog automatically (automagically) based on internal table definition
I made this several years ago and encapsulated the functionality into a OO class which does the display also
and guess what, the display is done through function REUSE_ALV_GRID_DISPLAY_LVC
this is the most convenient way to do it and is far more optimized that this crazy SLIS type pool ![]()
if you need to access to ALV grid object you still are able to do so with function GET_GLOBALS_FROM_SLVC_FULLSCR
I am a OO ABAP enthousiast but when some "good old" solution works...
TOTALLY agreed.
Yes! We can!
Here in Brazil, also support this initiative: http://abap101.com/2011/01/31/cl_salv_table-editavel-faca-parte-desta-corrente/
Regards,
Flávio Furlan
Agree!
Agree
Count me too....
Cheers!!!!
Vinit
I Agree
Yes please
Agree!
Agree
Agree!
Agree
Agree
Agree. SAP Please take a look into this request.
Thanks,
Greetson
Hi All,
In my requirement I need to display first output in ALV grid and second detail output in plain list containg 3 section one common header info and two detail tables with the enabled system -> list -> saving option.
So in such scenario i can not use CL_GUI_ALV_GRID class .when i go for CL_SALV_TABLE I am facing some difficulty to make it editable.
SAP may not have thought of implementing editable functionality in CL_SALV_TABLE class cause the main purpose is to use this class in background processing.
But in the above requirement I have to go for CL_SALV_TABLE.
I am very new in ABAP world.So my understanding may not be fully correct.Please suggest me the solution for such scenarios and take a vote from my side.
Thanks,
Edited by: Sarkar11 on May 26, 2011 11:39 AM
I agree
I agree
I agree
I agree
I agree
Agree.
Another thing is better handling of checkboxes and consistency of the same with all ALV types.
agree !
Agree
Agree
Agree
Agree
I Agree
I would also really apreciate it
Hi all
Thanks for the support
I copied THIS from one of the Blogs -- it's an UNOFFICIAL and probably not a recommended way but it will provide some limited edit functionality -- however full edit stuff like ON DATA CHANGE etc isn't readily implementable even using this get around
(Thanks to the original blogger --can't remember who it was however).
PROGRAM z_salv_test_selection.
Simple ALV display using cl_SALV factory class but with added EDIT functionality
FIELD-SYMBOLS:
<f_tabl> TYPE STANDARD TABLE.
PARAMETERS:
p_tname TYPE tabname16 OBLIGATORY,
p_rows(5) TYPE c DEFAULT '300'.
*
----
Define the Local class inheriting from the CL_SALV_MODEL_LIST
to get an access of the model, controller and adapter which inturn
provides the Grid Object
----
CLASS lcl_salv_model DEFINITION INHERITING FROM cl_salv_model_list.
PUBLIC SECTION.
DATA: o_control TYPE REF TO cl_salv_controller_model,
o_adapter TYPE REF TO cl_salv_adapter.
METHODS:
grabe_model
IMPORTING
io_model TYPE REF TO cl_salv_model,
grabe_controller,
grabe_adapter.
PRIVATE SECTION.
DATA: lo_model TYPE REF TO cl_salv_model.
ENDCLASS. "LCL_SALV_MODEL DEFINITION
----
Event handler for the added buttons
----
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_event_handler DEFINITION
----
Local Report class - Definition
----
CLASS lcl_report DEFINITION.
PUBLIC SECTION.
TYPES: ty_zps_ccmap TYPE STANDARD TABLE OF zps_ccmap.
DATA: t_data TYPE ty_zps_ccmap.
DATA: o_salv TYPE REF TO cl_salv_table.
DATA: o_salv_model TYPE REF TO lcl_salv_model.
METHODS:
get_data
EXCEPTIONS no_data_found,
check_selection "Dynamic table definition
EXCEPTIONS invalid_table,
generate_output.
PRIVATE SECTION.
TYPE-POOLS: abap.
DATA: tab TYPE REF TO cl_abap_structdescr,
wa_tab TYPE REF TO cl_abap_structdescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
i_tab TYPE REF TO cl_abap_tabledescr,
i_table TYPE REF TO data.
ENDCLASS. "lcl_report DEFINITION
----
Global data
----
DATA: lo_report TYPE REF TO lcl_report.
AT SELECTION-SCREEN.
CREATE OBJECT lo_report.
CALL METHOD lo_report->check_selection
EXCEPTIONS
invalid_table = 1.
IF sy-subrc <> 0.
MESSAGE e001(00) WITH
p_tname ' is not a Transparant Table'.
ENDIF.
START-OF-SELECTION.
----
Start of selection
----
START-OF-SELECTION.
IF lo_report IS INITIAL.
CREATE OBJECT lo_report.
ENDIF.
CALL METHOD lo_report->get_data
EXCEPTIONS
no_data_found = 1.
IF sy-subrc <> 0.
MESSAGE i001(00) WITH 'No data found'.
lo_report->get_data( ).
ELSE.
lo_report->generate_output( ).
ENDIF.
----
Local Report class - Implementation
----
CLASS lcl_report IMPLEMENTATION.
METHOD check_selection.
SELECT COUNT( * )
FROM dd02l
WHERE tabname = p_tname
AND as4local = 'A'
AND tabclass = 'TRANSP'.
IF sy-subrc <> 0.
RAISE invalid_table.
ENDIF.
ENDMETHOD. "check_selection
METHOD get_data.
tab ?= cl_abap_typedescr=>describe_by_name( p_tname ).
comp_tab = tab->get_components( ).
wa_tab = cl_abap_structdescr=>create( comp_tab ).
i_tab = cl_abap_tabledescr=>create( wa_tab ).
CREATE DATA i_table TYPE HANDLE i_tab.
ASSIGN i_table->* TO <f_tabl>.
IF p_rows IS INITIAL.
p_rows = '50000'.
ENDIF.
*Get data
SELECT * FROM (p_tname)
INTO TABLE <f_tabl>
UP TO p_rows ROWS.
IF sy-subrc <> 0.
RAISE no_data_found.
ENDIF.
ENDMETHOD. "get_data
METHOD generate_output.
*...New ALV Instance ...............................................
TRY.
cl_salv_table=>factory(
EXPORTING
r_container = w_alv1
list_display = abap_false
IMPORTING
r_salv_table = o_salv
CHANGING
t_table = <f_tabl> ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
*...PF Status.......................................................
Add MYFUNCTION from the report SALV_DEMO_TABLE_EVENTS
o_salv->set_screen_status(
pfstatus = 'SALV_STANDARD'
report = 'SALV_DEMO_TABLE_EVENTS'
set_functions = o_salv->c_functions_all ).
*...Event handler for the button.....................................
DATA: lo_events TYPE REF TO cl_salv_events_table,
lo_event_h TYPE REF TO lcl_event_handler.
event object
lo_events = o_salv->get_event( ).
event handler
CREATE OBJECT lo_event_h.
setting up the event handler
SET HANDLER lo_event_h->on_user_command FOR lo_events.
*...Get Model Object ...............................................
DATA: lo_alv_mod TYPE REF TO cl_salv_model.
Narrow casting
lo_alv_mod ?= o_salv.
object for the local inherited class from the CL_SALV_MODEL_LIST
CREATE OBJECT o_salv_model.
grabe model to use it later
CALL METHOD o_salv_model->grabe_model
EXPORTING
io_model = lo_alv_mod.
*...Generate ALV output ...............................................
o_salv->display( ).
ENDMETHOD. "generate_output
ENDCLASS. "lcl_report IMPLEMENTATION
----
LCL_SALV_MODEL implementation
----
CLASS lcl_salv_model IMPLEMENTATION.
METHOD grabe_model.
save the model
lo_model = io_model.
ENDMETHOD. "grabe_model
METHOD grabe_controller.
save the controller
o_control = lo_model->r_controller.
ENDMETHOD. "grabe_controller
METHOD grabe_adapter.
save the adapter from controller
o_adapter ?= lo_model->r_controller->r_adapter.
ENDMETHOD. "grabe_adapter
ENDCLASS. "LCL_SALV_MODEL IMPLEMENTATION
----
Event Handler for the SALV
----
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_user_command.
DATA: lo_grid TYPE REF TO cl_gui_alv_grid,
lo_full_adap TYPE REF TO cl_salv_fullscreen_adapter.
DATA: ls_layout TYPE lvc_s_layo.
CASE e_salv_function.
Make ALV as Editable ALV
WHEN 'MYFUNCTION'.
Contorller
CALL METHOD lo_report->o_salv_model->grabe_controller.
Adapter
CALL METHOD lo_report->o_salv_model->grabe_adapter.
Fullscreen Adapter (Down Casting)
lo_full_adap ?= lo_report->o_salv_model->o_adapter.
Get the Grid
lo_grid = lo_full_adap->get_grid( ).
Got the Grid .. ?
IF lo_grid IS BOUND.
Editable ALV
ls_layout-edit = 'X'.
Set the front layout of ALV
CALL METHOD lo_grid->set_frontend_layout
EXPORTING
is_layout = ls_layout.
refresh the table
CALL METHOD lo_grid->refresh_table_display.
ENDIF.
ENDCASE.
ENDMETHOD. "on_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Agree.
I couldn't agree more!
You're welcome! ![]()
Although I have to aver, that SAP doesn't support this kind of "workaround"!!!
AGREE
Agreed. Has it been added to idea place yet?
Hi Custodio,
not yet, still waiting for my idea to create a new chapter for "ABAP stack" on Idea place. Else I don't know where to place the idea. Duhh, many "ideas" and "places" in this sentence ![]()
Regards, Uwe
Hi Uwe,
is there already an idea to create the ABAP area? But you can use the Area https://cw.sdn.sap.com/cw/community/ideas/sap_netweaver as ABAP is one incarnation of NetWeaver.
Best regards
Gregor
is there already an idea to create the ABAP area?
Yes, since October: https://cw.sdn.sap.com/cw/ideas/6046
But you can use the Area https://cw.sdn.sap.com/cw/community/ideas/sap_netweaver as ABAP is one incarnation of NetWeaver.
Will do.
Gregor: seams that it's not possible to post ideas on a main session (Netweaver) just in sub-sessions.
Now I posted this idea on "Suggest new topics"
Maybe this helps for my other idea ("ABAP stack")
Here is the idea: https://cw.sdn.sap.com/cw/ideas/8349
thanks , nice development the abap ideas. just voted for the cl_salv edit functionality
I really don't understand why SAP wants developers to stick with the old and very usefull functions instead of adopting OO which can do half of what the function did in the past ? I thought they wanted everybody to adapt OO ?
kind regards
arthur
So... did we win? ![]()
Agree.
Agree !!
I agree.
Add me.
Agree!
Any news from SAP?
Hi guys
I agree and if I can push my luck, I would like to have the possibility to have more than one line as column header.
It is over 10 years I am waiting for that feature. ![]()
Daniel, did you try with the hierseq version of SALV?
Regards.
Hello Nahuel
If I am right, the hierseq version is displaying the information like the old "Display list" format and not like an ALV format.
My point is: Using the ALV format (Grid or worksheet format), it will be interesting to have the possibility to have 2 lines for each columns that is requiring longer header column without having to enlarge those ones to fit it.
Regards
Daniel
over 5 years later ...
And where are we now?
Yes, I would also prefer to have only one ALV model with all kinds of possibilities !?
still same situation ?!
I also would like to have an edit functionallity.
In my opinion it is extremly strange that SAP didn't made this possible for years. Editing is just a basic functionallity for a lot of ALV applications and if it is not supported the SALV class is just not useable. Sorry SAP, but not providing a mayor function requested by hunderts of developers for several years is just dishonorable for a big software company!