User input in ALV Grid
Hello All,
Is it possible to have a user input in ALV grid. I know there can be editable columns/cells but suppose the application demands an input field to be placed in ALV Grid where the user will enter some value.
Could someone please suggest if this can be done.
Regards
Indrajit
Here's THE definitive way to do it.
This little proggy demonstrates the following.
1) Create a DYNAMIC FCAT for an internal table with USER defined fields (i.e non ddic) and colour some columns in the FCAT.
2) Create a DYNAMIC TABLE.
3) Define a subclass of CL_GUI_ALV_GRID so you can access some very useful protected methods and attributes - you can get original and changed table IN ROWS which is a lot easier sometimes than messing around with individual
cells.
4) Create extra buttons on the toolbar.
5) Define EVENT handlers including data change so you can get control when the user enters data. YOU DON'T NEED PAI anymore with event handlers.
6) Call methods in your subclass of CL_GUI_ALV_GRID (you can also call methods in CL_GUI_ALV_GRID by virtue of Inheritance) from methods in your event handler class.
7) Display an editable Grid.
This method will work for almost any conditions you need to use.
I'm sure this covers all the bases -- please reply if any queries.
Run the program, click on the EDIT button and enter your data. Press ENTER when done.
All you need to do is copy this code and create one empty screen (SE51) with a custom container called CCONTAINER1 with the following logic in it.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
(In the program you don't actually do anything in the PAI as the event handler takes care of this)
Now here's the program
PROGRAM zdynfieldcat.
class zcltest definition deferred. "For field symbol reference.
Simple test of dynamic ITAB with user defined (not ddic) fields
Build dynamic fcat
Table structure obtained via new RTTI functionality
use ALV grid to display and edit.
Create a blank screen 100 with a custom container called CCONTAINER1.
Define field symbols as these can't be defined in classes
field-symbols: <dyn_table> type standard table,
<g2> type ref to zcltest,
<g1> type ref to cl_gui_custom_container,
<actual_tab> type standard table,
<outtab> type table,
<fs1> type ANY,
<FS2> TYPE TABLE,
<fs3> type table,
<fs4> type table,
<fs5> type table.
class zcltest definition inheriting from cl_gui_alv_grid.
define this as a subclass so we can access the protected attributes
of the superclass cl_gui_alv_grid
public section.
types: g4 type ref to cl_gui_custom_container.
types: g3 type ref to cl_alv_changed_data_protocol.
data: i_parent type g4,
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
zog like line of lr_rtti_struc->components. "RTTI
types: struc like zog.
types: struc1 type table of struc.
methods:
constructor
importing i_parent type g4,
disp_tab
importing p_er_data_changed type g3,
create_dynamic_fcat
importing zogt type struc1
exporting it_fldcat type lvc_t_fcat.
Protected section.
data: stab type ref to data,
wa_it_fldcat type lvc_s_fcat,
c_index type sy-index.
endclass.
class zcltest implementation.
METHOD constructor.
CALL METHOD super->constructor
EXPORTING
i_appl_events = 'X'
i_parent = i_parent.
endmethod.
method disp_tab.
mt_outtab is the data table held as a protected
attribute in class cl_gui_alv_grid.
assign me->mt_outtab->* TO <outtab>. "Original data
assign p_er_data_changed->mp_mod_rows TO <FS1>.
stab = p_er_data_changed->mp_mod_rows.
assign p_er_data_changed->mt_inserted_rows to <fs3>.
assign p_er_data_changed->mt_deleted_rows to <fs4>.
assign p_er_data_changed->mt_mod_cells to <fs5>.
assign stab->* TO <fs2>.
do whatever you want with <outtab>
contains data BEFORE changes each time.
Note that NEW (Changed) table has been obtained
already by call to form
check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Entered data is in table defined by <fs2>
In this method you can compare original and changed data.
Easier than messing around with individual cells.
do what you want with data in <fs2> validate / update / merge etc
endmethod.
method create_dynamic_fcat.
loop at zogt into zog.
c_index = c_index + 1.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
if c_index eq 2.
wa_it_fldcat-emphasize = 'C411'.
endif.
if c_index eq 3.
wa_it_fldcat-emphasize = 'C511'.
endif.
append wa_it_fldcat to it_fldcat .
endloop.
endmethod. "create_dynamic_fcat
endclass. "zcltest IMPLEMENTATION
class lcl_grid_event_receiver definition.
public section.
note that zcltest inherits all of events etc from
class cl_gui_alv_grid so specify event handler for
zcltest.
methods:
handle_data_changed
for event data_changed of zcltest
importing er_data_changed,
toolbar
for event toolbar of zcltest
importing e_object
e_interactive,
user_command
for event user_command of zcltest
importing e_ucomm.
endclass.
class lcl_grid_event_receiver implementation.
method handle_data_changed.
code whatever required after data entry.
various possibilites here as you
can get back Cell(s) changed
columns or the entire updated table.
Data validation is also possible here.
Note here the field sybol <g2> contains our
instance of class zcltest so we can now
call any methods / access
attributes of that class from this method
in our event handler class.
call method <g2>->disp_tab
EXPORTING
p_er_data_changed = er_data_changed.
endmethod. "handle_data_changed
method toolbar.
data : ls_toolbar type stb_button.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EDIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Edit' to ls_toolbar-text.
move icon_change_text to ls_toolbar-icon.
move 'Click2Edit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'UPDA' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Update' to ls_toolbar-text.
move icon_system_save to ls_toolbar-icon.
move 'Click2Update' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Exit' to ls_toolbar-text.
move icon_system_end to ls_toolbar-icon.
move 'Click2Exit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
endmethod. "toolbar
method user_command.
case e_ucomm .
when 'EDIT'. "From Tool bar
perform set_input.
perform init_grid.
when 'UPDA'. "From Tool bar
perform refresh_disp.
perform update_table.
when 'EXIT'. "From Tool bar
leave program.
endcase.
endmethod. "user_command
endclass. "lcl_grid_event_receiver IMPLEMENTATION
program data
include <icon>.
define any old internal structure NOT in DDIC
types: begin of s_elements,
anyfield1(20) type c,
anyfield2(20) type c,
anyfield3(20) type c,
anyfield4(20) type c,
anyfield5(11) type n,
end of s_elements.
data: wa_element type s_elements,
wa_data type s_elements.
Note new RTTI functionality allows field detail
retrieval at runtime for dynamic tables.
data:
grid1 type ref to zcltest,
grid_handler type ref to lcl_grid_event_receiver,
c_dec2 type s_elements-anyfield5,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat,
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
ls_comp LIKE LINE OF lt_comp, "RTTI
zog like line of lr_rtti_struc->components, "RTTI
struct_grid_lset type lvc_s_layo,
l_valid type c,
new_table type ref to data.
types: struc like zog.
data: zogt type table of struc,
grid_container1 type ref to cl_gui_custom_container,
g_event_receiver type ref to lcl_grid_event_receiver,
ok_code like sy-ucomm,
i4 type int4.
start-of-selection.
call screen 100.
module status_0100 output.
if grid_container1 is initial.
create object grid_container1
exporting
container_name = 'CCONTAINER1'.
assign grid_container1 to <g1>.
create object grid1
exporting i_parent = grid_container1.
we need reference to this instance so we can use
Methods etc of zcltest class and alv (superclass)
in our event receiver class.
assign grid1 to <g2>.
create object grid_handler.
set handler:
grid_handler->user_command for grid1,
grid_handler->toolbar for grid1,
grid_handler->handle_data_changed for grid1.
Get the Internal table structure
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
Build field catalog just use basic data here
colour specific columns as well
zogt[] = lr_rtti_struc->components.
call method grid1->create_dynamic_fcat
EXPORTING
zogt = zogt
IMPORTING
it_fldcat = it_fldcat.
Create dynamic internal table and assign
to field symbol.
Use dynamic field catalog just built.
call method cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = new_table.
assign new_table->* to <dyn_table>.
perform populate_dynamic_itab.
perform init_grid.
perform register_enter_event.
set off ready for input initially
i4 = 0.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endif.
endmodule. "status_0100 OUTPUT
module user_command_0100 input.
*PAI not needed in OO ALV anymore as User Commands
are handled as events
*in method user_command.
we can also get control if any data was entered
and the ENTER is pressed by
raising an event.
Control then returns to method handle_data_changed.
endmodule. "user_command_0100 INPUT
form populate_dynamic_itab.
load up a line of the dynamic table
c_dec2 = c_dec2 + 11.
wa_element-anyfield1 = 'Tabbies'.
wa_element-anyfield2 = 'ger.shepards'.
wa_element-anyfield3 = 'White mice'.
wa_element-anyfield4 = 'Any old text'.
wa_element-anyfield5 = c_dec2.
append wa_element to <dyn_table>.
endform. "populate_dynamic_itab
form exit_program.
call method grid_container1->free.
call method cl_gui_cfw=>flush.
leave program.
endform. "exit_program
form refresh_disp.
call method grid1->refresh_table_display.
endform. "refresh_disp
form update_table.
The dynamic table here is the changed table
read from the grid
after user has changed it
Data can be saved to DB or whatever.
loop at <dyn_table> into wa_element.
do what you want with the data here
endloop.
switch off edit mode again for next function
i4 = 0.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endform. "update_table
form set_input.
i4 = 1.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endform. "set_input
form switch_input.
if i4 = 1.
i4 = 0.
else.
i4 = 1.
endif.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endform. "switch_input
form init_grid.
Enabling the grid to edit mode,
struct_grid_lset-edit = 'X'. "To enable editing in ALV
struct_grid_lset-grid_title = 'Jimbos Test'.
call method grid1->set_table_for_first_display
EXPORTING
is_layout = struct_grid_lset
CHANGING
it_outtab = <dyn_table>
it_fieldcatalog = it_fldcat.
endform. "init_grid
form register_enter_event.
call method grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Instantiate the event or it won't work.
create object g_event_receiver.
set handler g_event_receiver->handle_data_changed for grid1.
endform. "register_enter_event
Have fun with this
Cheers
jimbo
Similar Messages
-
How i can show the user input in alv list on the top
hi all,
please tell me how i can show the user input in alv list on the top.
and also tell me how i can hide the toolbar in alv.
regards
vikas sainiHi,
Use the Below Code.
form top_of_page.
data : it_header type slis_t_listheader,
is_header type slis_listheader.
is_header-typ = c_h.
is_header-key = space.
is_header-info = 'Pending Order Information Report'(018).
append is_header to it_header.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_header.
endform. "top_of_page
and finally pass it to .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
Regards.
Arbind -
ALV Grid: event for user return in ALV Grid Control
Hi developers,
i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
Best regards christianHi Christian
ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
To set this attribute:
CALL METHOD gr_alvgrid->register_edit_event
EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
This way "data_changed" event will be triggered whenever you press the return key while editing.
For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
How to make a field mendatory input in ALV grid
Hi All,
I am using CALL METHOD g_alv_grid_0200->set_table_for_first_display for diplay in an ALV Grid.
I have made few fields in the ALV grid as EDITABLE. Now I want to make them as MENDATORY FOR INPUT.
Can somebody please suggest me how can I do it using any field of field catalogue or any other way !
Timely inputs will be highly appreciated.
Thanks in Advance!!
Chandanhi
we the option of making the field as not mandatory or making the field ready for input or edit
but dont have the option to make the edited field as mandatory.
types: begin of slis_fieldcat_alv_spec,
key_sel(1) type c, " field not obligatory
input(1) type c, " input
edit(1) type c, " internal use only
end of slis_fieldcat_alv_spec.
Regards -
Hi
I am displaying the output of a report in the ALV grid.
I have used REUSE_ALV_LIST_DISPLAY in my code as follows.
FORM DISPLAY_ALV_LIST.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SYREPID
IS_LAYOUT = FIELDLAYOUT
I_CALLBACK_USER_COMMAND = 'USER-COMMAND'
IT_FIELDCAT = FIELDCATALOG[]
I_SAVE = 'X'
IT_EVENTS = EVENTSTAB[]
TABLES
T_OUTTAB = ITAB_1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. " DISPLAY_ALV_LIST
When I try to call a transaction at the user command with sy-ucomm = &IC1 sys gives a message 'Not valid'.
FORM USER-COMMAND USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
READ TABLE ITAB_1 INDEX SELFIELD-TABINDEX.
CHECK SY-SUBRC = 0.
CASE UCOMM.
WHEN '&IC1'.
CASE SELFIELD-SEL_TAB_FIELD.
WHEN 'ITAB_1-VBELN'.
SET PARAMETER ID 'VF' FIELD ITAB_1-VBELN.
CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
WHEN 'ITAB_1-MATNR'.
SET PARAMETER ID 'MAT' FIELD ITAB_1-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDCASE.
ENDFORM. "USER_COMMAND
Kindly let me know what am I missing in the above code. As this FORM USER-COMMAND is at all called during the user-command.
Regds
Priyathe Code what u are given is WRONG , check this one.
put like this , it will solve ur probs.
check r_ucomm = '&IC1'. "User Double Clicked on Some field
check not rs_selfield-value is initial.
case rs_selfield-fieldname.
when 'AUFNR'.
if rad4 ne 'X'.
read table itab_order index rs_selfield-tabindex.
else.
read table itab_order2 index rs_selfield-tabindex.
itab_order-aufnr = itab_order2-aufnr.
endif.
if sy-subrc eq 0.
set parameter id 'ANR' field itab_order-aufnr.
set parameter id 'VGN' field '10'.
call transaction 'CO14' and skip first screen.
endif. " IF SY-SUBRC EQ 0
endcase.
Regards
Prabhu
Message was edited by: Prabhu Peram -
Pf status & user-command in alv grid
Hi Friends,
I have one query for ALV grid.
Actually my requirement is like that
Whenever the user double click on grid the control moves to transaction 'VA01' tcode.
I also wanted to set the gui status in ALV grid.
How to do it??
Plz tell me in detail.Very simple....
copy paste this code.... remember I have created a GUI Status called ZALV_STATUS.
So u will have to create this status to run ur program.
U can come back if u have any doubts...
*& Report Z_ALV_TRAINING_LIST_HOTSPOT
REPORT Z_ALV_TRAINING_LIST_HOTSPOT.
Type Pools Used **********
TYPE-POOLS : SLIS.
Internal Tables Declare ************
DATA : it_document type standard table of bkpf initial size 0 with header line,
IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
it_alv_event type SLIS_T_EVENT,
fl_layout type slis_layout_alv.
Select Data ***********
start-of-selection.
select * from bkpf into table it_document.
Make Field Catalog ******
PERFORM MAKE_FIELD_CATALOG.
Make Layout *********
perform sub_fill_layout.
Make Events Table *******
perform sub_Fill_alv_event.
Display ALV *********
PERFORM DISPLAY_ALV_LIST.
*& Form make_field_catalog
text
--> p1 text
<-- p2 text
FORM MAKE_FIELD_CATALOG .
data : wa type slis_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'bkpf'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = it_field_cat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
read table it_field_cat into wa index 3.
wa-hotspot = 'X'.
modify it_field_cat index 3 from wa.
ENDFORM. " make_field_catalog
*& Form display_alv_list
text
--> p1 text
<-- p2 text
FORM DISPLAY_ALV_LIST .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_MY_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = fl_layout
IT_FIELDCAT = it_field_cat[]
IT_SORT =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT = '/TEST_VV'
IT_EVENTS = it_alv_event
TABLES
T_OUTTAB = it_document.
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_alv_list
*& Form sub_my_pf_event
text
--> p1 text
<-- p2 text
FORM sub_my_pf_event using p_comm type sy-ucomm p_sEL_FIELD TYPE SLIS_SELFIELD.
read table it_document index p_sel_field-tabindex.
set parameter id 'BLN' field it_document-belnr.
set parameter id 'BUK' field it_document-bukrs.
set parameter id 'GJR' field it_document-gjahr.
case p_comm.
when 'PICK'.
call transaction 'FB03' and skip first screen.
endcase.
ENDFORM. " sub_my_pf_event
*& Form sub_Fill_alv_event
text
--> p1 text
<-- p2 text
FORM sub_Fill_alv_event .
data : wa type slis_alv_event.
wa-name = 'USER_COMMAND'.
wa-form = 'SUB_MY_PF_EVENT'.
append wa to it_alv_event.
ENDFORM. " sub_Fill_alv_event
*& Form sub_fill_layout
text
--> p1 text
<-- p2 text
FORM sub_fill_layout .
fl_layout-f2code = 'PICK'.
fl_layout-box_fieldname = 'BELNR'.
ENDFORM. " sub_fill_layout
*& Form SET_MY_PF_STATUS
text
--> p1 text
<-- p2 text
FORM SET_MY_PF_STATUS USING p_rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZALV_STATUS'.
ENDFORM. " SET_MY_PF_STATUS
Plz award points if it was helpful....
Message was edited by:
Varun Verma -
Newly Appended rows are not ready for input in ALV Grid
Hi,
I created a ALV Grid using OO ALV ,
I made a condition for editable rows and I have succeded in it.
in the applicaton tool bar of the ALV I have the ADD and DELETE rows Buttons.
When I click on the Add row button I am having it Disabled for Input.
But I want the whole line Enabled for Input
How to get that
Regards"data Declarations
TYPES: BEGIN OF ty_sto.
INCLUDE STRUCTURE zarp_sto.
TYPES: celltab TYPE lvc_t_styl,
END OF ty_sto.
DATA:it_sto TYPE TABLE OF ty_sto,
wa_sto TYPE ty_sto,
alv_grid TYPE REF TO cl_gui_alv_grid,
container TYPE REF TO cl_gui_custom_container,
it_fieldcat TYPE lvc_t_fcat,
wa_layout TYPE lvc_s_layo.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
IF container IS INITIAL.
CREATE OBJECT container
EXPORTING
container_name = 'CONTROL'.
CREATE OBJECT alv_grid
EXPORTING
i_parent = container.
ENDIF.
PERFORM fetch_data.
PERFORM fill_fieldcat.
wa_layout-stylefname = 'CELLTAB'.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_layout
CHANGING
it_outtab = it_sto
it_fieldcatalog = it_fieldcat.
CALL METHOD alv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Data Fetch and Filling Field cat
FORM fetch_data .
DATA: lt_sto TYPE TABLE OF zarp_sto,
ls_sto TYPE zarp_sto.
SELECT *
FROM zarp_sto
INTO TABLE lt_sto.
LOOP AT lt_sto INTO ls_sto .
PERFORM fill_cell_tab USING ls_sto
CHANGING wa_sto.
MOVE-CORRESPONDING ls_sto TO wa_sto.
APPEND wa_sto TO it_sto.
ENDLOOP.
ENDFORM.
FORM fill_cell_tab USING ls_sto TYPE zarp_sto
CHANGING wa_sto TYPE ty_sto .
DATA: l_mode TYPE raw4,
ls_celltab TYPE lvc_s_styl.
IF ls_sto-manual_entry IS INITIAL.
l_mode = cl_gui_alv_grid=>mc_style_disabled.
ELSE.
l_mode = cl_gui_alv_grid=>mc_style_enabled.
ENDIF.
ls_celltab-fieldname = 'CONTRIBUTION'.
ls_celltab-style = l_mode.
INSERT ls_celltab INTO TABLE wa_sto-celltab.
ls_celltab-fieldname = 'TOT_CONTRIBUTION'.
ls_celltab-style = l_mode.
INSERT ls_celltab INTO TABLE wa_sto-celltab.
ls_celltab-fieldname = 'AVG_CONTRIBUTION'.
ls_celltab-style = l_mode.
INSERT ls_celltab INTO TABLE wa_sto-celltab.
ENDFORM.
FORM fill_fieldcat .
DATA: ls_fieldcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZARP_STO'
CHANGING
ct_fieldcat = it_fieldcat.
LOOP AT it_fieldcat INTO ls_fieldcat .
IF ls_fieldcat-fieldname = 'CONTRIBUTION' OR
ls_fieldcat-fieldname = 'TOT_CONTRIBUTION' OR
ls_fieldcat-fieldname = 'AVG_CONTRIBUTION'.
ls_fieldcat-edit = 'X'.
ls_fieldcat-checktable = '!'.
ELSE.
ls_fieldcat-auto_value = 'X'.
ls_fieldcat-checktable = '!'.
ENDIF.
MODIFY it_fieldcat FROM ls_fieldcat .
ENDLOOP.
ENDFORM.
Please help in this issue
Edited by: SAP LEARNER on Dec 17, 2009 7:32 AM -
Hello, I have a report with an selection screen with a few input parameters. This results in an alv grid being displayed. The users downloads the alv grid to excel. This works fine.
I'd like to include the input parameters as the top row in the downloaded excel, on top of the result set. Is this possible? How do you do it?
Best regards /OttoThis data would have to be included in the ALV grid itself(assuming that you are using the standard excel functionality embedded into the ALV grid).
There are others ways to get around this. You could add a new button to the applicatoin toolbar, where then you would handle the building of the excel file in your custom code.
REgards,
Rich Heilman -
Hide alv grid PR custom subscreen
Hello All,
I have a custom subscreen on PR ( bulit via screen exit) with ALV grid and some screen elements ( to get input data from user) on it.
In create and change PR mode, I need to get the input ( could be multiple rows with the help of create next icon )from user and update ALV grid with the input values. But in PR display mode, I need to hide the ALV grid.
I tried using desctructor method FREE, but dint work.
Any suggestions?
Thanks,
ChandraI have a similiar problem:
I have a dynpro where there are different possibilities for ALV grids to be shown. I have 10 containers (that's the maximum number of ALV grids that can appear) and want to use the highest first. Now, it might be that I want to show another ALV in a container I have had an ALV before, therefore I must hide / delete / destroy the previous ALV in this container.
I use the FREE( ) method of the alv controls, I clear and free all references, but still, even after leaving and accessing the dynpro again, the ALV is shown. That's why I'd need some help here too...
Thanks in advance, Christopher -
I created an alv grid in my web dynpro...
Everything worked fine ! Then I needed to add a column to the alv grid...
SO
1 - Chnaged the structure un SE11
2 - Update component controller context so that the field is displayed
3 - Update all bindings
4 - Update biding between DATA and ALV Table
But the column is not displayed by default in the alv grid ! But if I go to settings, the colomn is available...
What should i do to display this column by default ???
Regards,
SteKamYatah !
I manage to show the columns by default !
We discovered it was stored in the user settings...
Then the question is ... "How do I disable user settings on ALV Grid"
Thanks in advance!
Stekam -
how to handle user command in alv grid?
if we want to select only one row, but we get a table from calling method
get_selected_rows.
is there any method or way of getting a single row which is selected?Hi,
This method indeed returns the table but only with the selected rows. Therefore when you select only one row, it will contain only one entry. For this use second parameter of the method ET_ROW_NO as the first one is obsolete. It will contain indexes of the selected rows.
Note!
You must use one of the these selection modes (A, C, D) in this case. The default one is B, so you have to change it in layout structure.
layout_structure-sel_mode = 'A'. "i.e.
See possible selection modes [here|http://help.sap.com/saphelp_erp2004/helpdata/en/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm]
Regards
Marcin -
Hi.
How can I make one column user-editable on ALV Grid?
Thanks in advance,
Brian GonsalesHi,
Check out the below links:
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
Thanks. -
Hi All,
I have a requirement to display one field in the ALV grid as input field,so that the user can enter value in that field when the ALV is displayed.I need to use this entered user value later in th eprg for further processing.
My worry is that i do not see any parameter such as "INPUT " or "EDIT " in the field catalog structure lvc_s_fcat for the ALV.
How can i acheive having editable input field in the ALV grid?
Please suggest.
Thanks,
SwatiEDIT field in field catalog is there, you must have ommited it.
ls_fieldcat-edit = 'X'. "set your desired column to be edited
Now you need to get entered value for further processing.
Define a class as a event receiver for data_changed or data_changed_finished events. Here is how to implement the latter method:
CLASS cl_alv_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
cell_changed FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells.
ENDCLASS.
CLASS cl_alv_event_receiver IMPLEMENTATION.
METHOD cell_changed.
check e_modified = 'X'. "if content of cell was changed
"here you check et_good_cells table, it will contain new values
"it is of type lvc_t_modi
ENDMETHOD.
ENDCLASS.
CREATE OBJECT cl_alv_event_receiver.
"now just indicate the handler for this event
SET HANDLER cl_avl_event_receiver->cell_changed FOR cl_gui_alv_grid.
Each time some action was perfomed on edit field, the method will be invoked and you can check inside what was changed and what is the new value.
Additionally after displaying your output table in alv, you need to register this event
"register edit events
CALL METHOD W_ROGRID->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Now all you need is to update appropraite records to your internal table in your METHOD cell_changed. -
For all users having probs with OO ALV Grid
I wanted to put this in the WIKI but it keeps bombing out when I try and save so I've put this here -- Maybe a MOD can move it for me.
This generic class should give you far more insite into using an EDITABLE ALV table than the standard documentation.
If you follow the steps you should be able to code very quickly a decent useable ALV OO program which can retrieve and manipulate data very easily. The events are (hopefully) well documented as are all the steps.
Once you understand the basics you can add more functionality like colouring Cells, adding hyperlinks etc etc.
I've always found that stupid SEAT / AIRLINE application SAP uses for its examples far too overblown and in reality who would ever use a SAP system for Airline reservations anyway.
The class here describes a much simpler application which CLEARLY (I hope) explains how the whole thing works.
Jimbo's generic class for using the OO ALV GRID Class CL_GUI_ALV_GRID
from an application program to display and manipulate ANY table
with minimal coding needed in the Calling application program.
Handles the following EVENTS
1) TOOLBAR BUTTONS
(you can add more to the toolbar method
if you need even more functionality).
2) DOUBLE CLICK
3) ENTER KEY PRESSED
4) DATA CHANGED
5) DATA CHANGED FINISHED
Methods available
PUBLIC METHODS ( Can be called directly from the application program).
1) display_grid displays grid with toolbar
Table and FCAT are built dynamically - user only needs to
define the table structure (can be DDIC or User fields)
2) change_title - changes title at the top of the Grid
3) refresh_grid - refreshes grid after table updated etc.
4) build_dynamic_structures - this method creates a dynamic table and a dynamic FCAT
using the structure defined in the calling application program
PRIVATE METHODS (Internal Methods used within the class)
1) verwerk - returns to FORM VERWERK in calling application program
(Via Toolbar). The application program can then do any special processing
at this point e.g update SAP tables etc.
2) download_to_excel (via Toolbar). This creates an EXCEL spreadsheet
directly which can be downloaded / saved to a file if required,
3) return_structure - internal method returns the structure
of the table defined in the calling application program. This is needed in order
to build the dynamic table and Field Catalog.
4) create_dynamic_table - creates a dynamic table from the structure defined in
the calling application program
5) create_dynamic_fcat - creates the dynamic field catalog from the structure
defined in the application program.
6) dubbleklik entered when user double clicks a cell
activated by EVENT DOUBLE_CLICK.
returns to FORM DUBBELKLIK in the
calling application program
COOKBOOK STEP BY STEP instructions on how to use this class
in your application program.
In the application program :
1) define a blank screen 100 - SE51 with a custom container
on it called CCONTAINER1.
you need the following logic in the screen
The PAI is only used if you have defined a STATUS with SE41 and you exit the
application program via the standard SAP buttons on the
top of the Screen (NOT the GRID toolbar).
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
2) (optional) define a STATUS with a titlebar - SE41
you only need this if you want the standard EXIT and menu buttons on the
top line of the screen
3) If you want to have your OWN colum names on the grid
add the following macro to the start of your program
DEFINE col_name.
read table it_fldcat into wa_it_fldcat index &1.
wa_it_fldcat-coltext = &2.
modify it_fldcat from wa_it_fldcat index &1.
END-OF-DEFINITION.
4) Define the following Field symbols
<fs1> TYPE ANY,
<fs2> TYPE STANDARD TABLE,
<fs3> TYPE ANY,
<field_catalog> TYPE STANDARD TABLE,
<dyn_table> TYPE STANDARD TABLE,
<orig_table> TYPE STANDARD TABLE,
<dyn_field>,
<dyn_wa>.
5) After the field-symbols add the code in this class
as an INCLUDE
e.g INCLUDE ZZJIMBOXX_INCL.
6) define your Internal table as follows
TYPES: BEGIN OF s_elements,
Your structure
your structure etc.
END OF s_elements.
For example
INCLUDE <icon>.
TABLES: VAPMA.
*TYPES: BEGIN OF s_elements,
vbeln TYPE vapma-vbeln,
posnr TYPE vapma-posnr,
matnr TYPE vapma-matnr,
kunnr TYPE vapma-kunnr,
werks TYPE vapma-werks,
vkorg TYPE vapma-vkorg,
vkbur TYPE vapma-vkbur,
status TYPE c,
*END OF s_elements.
7) Define the following data IN YOUR APPLICATION PROGRAM
(note here only data is described
that relates to using THIS CLASS. Data purely used internally
in the application program is NOT shown here).
DATA: z_object TYPE REF TO zcl_dog, "Instantiate our class
grid_container1 TYPE REF TO cl_gui_custom_container,
t_elements TYPE TABLE OF s_elements, "refers to our ITAB
wa_elements TYPE s_elements,
wa_dyn_table_line TYPE REF TO DATA,
it_fldcat TYPE lvc_t_fcat,
i_gridtitle TYPE lvc_title,
wa_it_fldcat TYPE lvc_s_fcat,
new_table TYPE REF TO DATA,
dy_table TYPE REF TO data,
dy_line TYPE REF TO data,
row_id TYPE sy-index.
8) insert the following code at the start of the application program.
*START-OF-SELECTION.
*CALL SCREEN 100.
*END-OF-SELECTION.
*MODULE status_0100 OUTPUT.
*ASSIGN wa_elements TO <fs1>.
*CREATE OBJECT z_object EXPORTING z_object = z_object. "Instantiate the class
*CALL METHOD z_object->build_dynamic_structures
CHANGING it_fldcat = it_fldcat.
9) if you inserted the macro in step 3) then
define your own column names as follws
col_name 1 'Name1'.
col_name 2 'Name2'.
etc. The number is the colum number you want and the name is
the name you want to assign to the column.
for example using the table shown above
col_name 1 'Order Nr'.
col_name 2 'Item'.
col_name 3 'Material'.
col_name 4 'Customer'.
col_name 5 'Plant'.
col_name 6 'Sales Org'.
col_name 7 'Sales Office'.
col_name 8 'Status'.
10) perform a routine that fills your dynamic table and
display the GRID. If you created a status with SE41 you can set
a title etc. Further processing is dependent on the users action
after the GRID is displayed for example if a Cell is double clicked,
dat is entered, a toolbar button is pressed or a SAP ICON on top of the screen is pressed.
PERFORM populate_dynamic_itab.
CALL METHOD z_object->display_grid
CHANGING it_fldcat = it_fldcat.
SET PF-STATUS '0001'.
SET TITLEBAR '000'.
ENDMODULE.
11) If you added a STATUS via SE41 you can exit the program via the
standard SAP buttons at the top of the screen
otherwise exit via the exit button on the toolbar.
You only need this piece of code if you defined a STATUS in the application program
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'RETURN'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.
12) to populate the dynamic table you only need to code something like this
remember the class has already created and structured the field-symbol <dyn_table>
so you don't have to do anything other than just select the fields you want
filled and from what data source(es).
*FORM populate_dynamic_itab.
*SELECT vbeln posnr matnr kunnr werks vkorg vkbur
UP TO 200 rows
FROM vapma
INTO CORRESPONDING FIELDS OF TABLE <dyn_table>.
if you want to keep the original table before making any changes etc code
the following
create 2nd Dyn table to hold original data. We can use
the same field catalog as for the original table
as we are just creating an identical copy here.
*CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <orig_table>.
CREATE DATA dy_line LIKE LINE OF <orig_table>.
ASSIGN dy_line->* TO <dyn_wa>.
<orig_table> = <dyn_table>.
ENDFORM.
13) you need these 2 processing routines in your application program.
FORM VERWERK. "Entered from VERW on toolbar
*break-point 1.
Orig table is in dynamic table <orig_table>
ALV GRID changed table is in <dyn_table>.
*Loop at <orig_table> into <dyn_wa>.
Do what you want here
end
endloop.
ENDFORM.
*form dubbleklik using "Entered when a cell is double clicked
e_row type LVC_S_ROW
e_column type LVC_S_col
es_row_no type lvc_s_roid.
break-point 1.
Get Row id into a variable for this program.
row_id = e_row.
SET TITLEBAR '001'. "If you defined a status in SE41
i_gridtitle = 'Grid Title Changed'.
CALL METHOD z_object->change_title
EXPORTING i_gridtitle = i_gridtitle.
PERFORM refresh.
endform.
The REFRESH routine is optional but after a double click I assume
you want to do some processing
and re-display the data
so as a sample code something like
*FORM refresh.
data: ord_nr TYPE vapma-vbeln. "Your data
*READ TABLE <dyn_table> index row_id into wa_elements.
ord_nr = wa_elements-vbeln.
You've now got the Row double clicked so pick out the data element(s)
you wnat to process and do your processing
*set parameter id 'AUN' field ord_nr.
*CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
You can update the dynamic table for example
*wa_elements-status = 'C'.
*modify <dyn_table> from wa_elements index row_id.
now redisplay the updated grid.
*CALL METHOD z_object->refresh_grid.
*ENDFORM.
*************Class ZCL_DOG*************
CLASS zcl_dog DEFINITION.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING
z_object TYPE REF TO zcl_dog,
display_grid
CHANGING
it_fldcat TYPE lvc_t_fcat,
build_dynamic_structures
CHANGING it_fldcat TYPE lvc_t_fcat,
change_title
IMPORTING
i_gridtitle TYPE lvc_title,
refresh_grid.
PRIVATE SECTION.
METHODS:
on_user_command FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm
sender,
on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object
e_interactive,
on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no,
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed,
handle_data_changed_finished
FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified
et_good_cells,
verwerk
IMPORTING program TYPE sy-repid,
download_to_excel,
dubbleklik
IMPORTING
e_row type LVC_S_ROW
e_column TYPE LVC_S_COL
es_row_no type lvc_s_ROID
program type sy-repid,
return_structure,
create_dynamic_fcat
EXPORTING it_fldcat TYPE lvc_t_fcat,
create_dynamic_table
IMPORTING it_fldcat TYPE lvc_t_fcat
EXPORTING dy_table TYPE REF TO DATA.
DATA:
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
zog LIKE LINE OF lr_rtti_struc->components, "RTTI
wa_it_fldcat TYPE lvc_s_fcat,
it_fldcat TYPE lvc_t_fcat,
dy_table TYPE REF TO data,
dy_line TYPE REF TO data,
struct_grid_lset TYPE lvc_s_layo,
e_row TYPE LVC_S_ROW,
e_column TYPE lvc_s_col,
es_rowid TYPE lvc_s_roid,
grid_container1 TYPE REF TO cl_gui_custom_container,
grid1 TYPE REF TO cl_gui_alv_grid,
ls_layout TYPE kkblo_layout,
lt_fieldcat_wa TYPE kkblo_fieldcat,
l_mode TYPE raw4,
celltab TYPE LVC_T_STYL,
wa_celltab TYPE lvc_s_styl,
lt_fieldcat TYPE kkblo_t_fieldcat,
l_tabname TYPE slis_tabname.
TYPES:
struc LIKE zog.
DATA:
zogt TYPE TABLE OF struc.
ENDCLASS.
CLASS zcl_dog IMPLEMENTATION.
METHOD constructor.
CREATE OBJECT grid_container1
EXPORTING
container_name = 'CCONTAINER1'.
CREATE OBJECT grid1
EXPORTING
i_parent = grid_container1.
SET HANDLER z_object->on_user_command for grid1.
SET HANDLER z_object->on_toolbar for grid1.
SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.
SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.
CALL METHOD grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
ENDMETHOD.
METHOD refresh_grid.
CALL METHOD cl_gui_cfw=>flush.
CALL METHOD grid1->refresh_table_display.
ENDMETHOD.
METHOD on_dubbelklik.
CALL METHOD me->dubbleklik
EXPORTING
e_row = e_row
e_column = e_column
es_row_no = es_row_no
program = sy-repid.
break-point 1.
ENDMETHOD.
METHOD handle_data_changed.
Insert user code here if required
this method is entered if user ENTERS DATA.
ENDMETHOD.
METHOD handle_data_changed_finished.
Insert user code here if required
Method entered here after data entry has finished.
ENDMETHOD.
METHOD return_structure.
lr_rtti_struc ?= cl_abap_structdescr=>DESCRIBE_BY_DATA( <fs1> ).
zogt[] = lr_rtti_struc->components.
ASSIGN zogt[] TO <fs2>.
ENDMETHOD.
METHOD create_dynamic_fcat.
LOOP AT <fs2> INTO zog.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
APPEND wa_it_fldcat TO it_fldcat .
ASSIGN it_fldcat[] TO <field_catalog>.
ENDLOOP.
ASSIGN it_fldcat[] TO <field_catalog>.
ENDMETHOD.
METHOD download_to_excel.
break-point 5.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = <field_catalog>
is_layout_lvc = m_cl_variant->ms_layout
is_tech_complete = ' '
IMPORTING
es_layout_kkblo = ls_layout
et_fieldcat_kkblo = lt_fieldcat.
LOOP AT lt_fieldcat INTO lt_fieldcat_wa.
CLEAR lt_fieldcat_wa-tech_complete.
IF lt_fieldcat_wa-tabname IS initial.
lt_fieldcat_wa-tabname = '1'.
MODIFY lt_fieldcat FROM lt_fieldcat_wa.
ENDIF.
l_tabname = lt_fieldcat_wa-tabname.
ENDLOOP.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
i_tabname = l_tabname
is_layout = ls_layout
it_fieldcat = lt_fieldcat
i_title = sy-title
TABLES
it_outtab = <dyn_table>
EXCEPTIONS
fatal_error = 1
no_display_possible = 2
others = 3.
IF sy-subrc <> 0.
message id sy-msgid type 'S' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMETHOD.
METHOD create_dynamic_table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = dy_table.
ENDMETHOD.
METHOD build_dynamic_structures.
CALL METHOD me->return_structure.
CALL METHOD me->create_dynamic_fcat
IMPORTING
it_fldcat = it_fldcat.
CALL METHOD me->create_dynamic_table
EXPORTING
it_fldcat = it_fldcat
IMPORTING
dy_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
ENDMETHOD.
METHOD display_grid.
struct_grid_lset-edit = 'X'. "To enable editing in ALV
struct_grid_lset-grid_title = 'Bulkwijzigingen inkoopprijzen'.
struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
struct_grid_lset-stylefname = 'CELLTAB'.
CALL METHOD grid1->set_ready_for_input
EXPORTING
i_ready_for_input = '1'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = struct_grid_lset
CHANGING
it_outtab = <dyn_table>
it_fieldcatalog = it_fldcat.
ENDMETHOD.
METHOD change_title.
CALL METHOD grid1->set_gridtitle
EXPORTING
i_gridtitle = i_gridtitle.
ENDMETHOD.
METHOD on_user_command.
CASE e_ucomm.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'EXCEL'.
CALL METHOD me->download_to_excel.
WHEN 'SAVE'.
WHEN 'VERW'.
CALL METHOD me->verwerk
EXPORTING
PROGRAM = SY-REPID.
ENDCASE.
ENDMETHOD. "on_user_command
METHOD on_toolbar.
User can add extra functionality by adding extra
buttons if required. Functionality can also be simplified by removing buttons.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXIT' TO ls_toolbar-function.
MOVE SPACE TO ls_toolbar-disabled.
MOVE icon_system_end TO ls_toolbar-icon.
MOVE 'Click2Exit' TO ls_toolbar-quickinfo.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'SAVE' TO ls_toolbar-function.
MOVE SPACE TO ls_toolbar-disabled.
MOVE icon_system_save TO ls_toolbar-icon.
MOVE 'Save data' TO ls_toolbar-quickinfo.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EDIT' TO ls_toolbar-function.
MOVE SPACE TO ls_toolbar-disabled.
MOVE icon_toggle_display_change TO ls_toolbar-icon.
MOVE 'Edit data' TO ls_toolbar-quickinfo.
MOVE 'EDIT' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'VERW' TO ls_toolbar-function.
MOVE SPACE TO ls_toolbar-disabled.
MOVE icon_businav_process to ls_toolbar-icon.
MOVE 'Verw.' TO ls_toolbar-quickinfo.
MOVE 'VERW' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 0 TO ls_toolbar-butn_type.
MOVE 'EXCEL' TO ls_toolbar-function.
MOVE SPACE TO ls_toolbar-disabled.
MOVE icon_xxl TO ls_toolbar-icon.
MOVE 'Excel' TO ls_toolbar-quickinfo.
MOVE 'EXCEL' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD verwerk.
PERFORM verwerk IN PROGRAM (program).
LEAVE PROGRAM.
ENDMETHOD.
METHOD dubbleklik.
PERFORM dubbleklik IN PROGRAM (program)
USING
e_row
e_column
es_row_no.
ENDMETHOD.
ENDCLASS.
Cheers
JimboHi Dinu,
Before analysing ALV, please cross check the behaviour of the calling program.
Is the control really going to the application server when you do all the above process?
If so, when user makes some changes are they saved in the data base / affected the internal table which you are using for ALV?
Regards
Surya. -
How can i validate on ALV grid for the user
Dear Freinds,
I have developed one custom report using ALV Grid program , as per the requirement i have to enter on the
data and when i press the value save the program sumits the data into my custom table . Till here every thing is fine
but one particular field i have declared as Char1 in my internal table , on the ALV output it is allowing me to enter
more than one character eg : it is allowing me to enter as Hyderabad .........even though i have declared as char 1 in the internal table ....however it is saving in the database table as H only that is correct.......but it is giving confusion to user
i want to validate that user shouldnt allow to enter more than one character in the alv output of the input field .
Please could any one let me know how can i validate.
regard
divyaHi,
check that field length in the final internal table .
might be that filed lenth in final internal table declartion is more than 1 char.
regards,
Rama reddy
Edited by: ram reddy on Jul 15, 2009 7:57 AM
Maybe you are looking for
-
Cannot Wi-Fi Sync iPad; Appears to see iMac but iMac does not see the iPad
Like many, I have upgraded my iPad (1st Gen) to iOS 5 and for the most part, it's been an easy transistion to learn the new features. However, I've not been able to overcome a Wi-Fi Sync issue. The iPad does recognize that it can Wi-Fi Sync with my i
-
Autocorrect sentence in quotes in word 2007?
When i start a sentence in quotes and the first letter of the first word is not capitalized it doesn't correct the first word. For example: "this is a blue color." doesn't autocorrect it to "This is a blue color." Can i make Word autocorrect the firs
-
Droid mini. How do you set up quick access to 2nd language?
Just got a Droid Mini and I use my second language often. It takes 7 steps to change the language to Swedish and 7 again to change back to English. How can I set up a one click switch from my home screen?
-
Essential transfer parameters missing while GR into a HU managed Sloc.
Hi Gurus, I am doing GR into a HU managed storage location. I am expecting the system to create an inbound delivery & HU internally. But the error is "Essential transfer parameters are missing in record: 45000XXXXX 000010 Message no. VL561". in
-
Display settings not reatained
I'm runing my thinkpad with dual monitors when docked, and it doesn't retain the resolution I set for either monitor when the system is restarted. Is there a way I can set a mandatory display resolution for both monitors?