Editable ALV list
All,
In release 4.7 there is a possibility to create an editable ALV list (see programs BCALV_EDIT_xx).
Now I want to use this functionality also in release 4.6B but I don't find these programs.
Is this not possible in this release?
Has someone already programmed an editable ALV list in this release?
Regards,
Kris
Hello Kris,
I must make myself clearer. There is a chance that these programs have got a slightly different name in 4.6B. So, just try and see if there's something in the development class SLIS through SE80.
If you have already done that, then you just have to copy the code from 4.7 and paste it in the 4.6B system. hopefully, there will not be any syntax errors.
Even if there are, When you have seen the program in 4.7, I don't see what the problem is in trying to write a similar program in 4.6B. It is the concept that matters, right ?
Regards,
Anand Mandalika.
Similar Messages
-
Add(Copy)/Change/Delete in editable ALV list
I want to add a column to my ALV list where the user can enter an 'A' to Copy, 'C' to Change or 'D' to Delete. If the user enters an 'A', the code needs to insert a new line into the ALV list. After the user makes the changes on the screen and selects Save, I need the program to perform different functions depending on whether the user entered an 'A', 'C' or 'D' in the column. I have never used an editable ALV list and would like to have some sample code to get started. Does anyone have any code similar to what I am trying to do?
Thanks.
SandyHi,
check this code... if you trying with ALV FM, and editable grid then check this code.
REPORT ZTESTDFALV1 .
*Data Declaration
DATA: BEGIN OF T_EKKO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
* FLAG TYPE C,
* HANDLE_STYLE TYPE LVC_T_STYL,
END OF T_EKKO.
DATA: GD_REPID LIKE SY-REPID, "Exists
REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new
DATA: BEGIN OF IT_EKKO OCCURS 0.
INCLUDE STRUCTURE T_EKKO.
DATA: END OF IT_EKKO.
DATA: BEGIN OF IT_BACKUP OCCURS 0.
INCLUDE STRUCTURE T_EKKO.
DATA: END OF IT_BACKUP.
*ALV data declarations
TYPE-POOLS: SLIS. "ALV Declarations
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
*Start-of-selection.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
IT_BACKUP[] = IT_EKKO[].
PERFORM DISPLAY_ALV_REPORT.
*& Form build_fieldcatalog
* text
FORM BUILD_FIELDCATALOG.
REFRESH FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'EBELN'.
FIELDCATALOG-SELTEXT_M = 'Purchase Order'.
FIELDCATALOG-INPUT = 'X'.
FIELDCATALOG-EDIT = 'X'.
FIELDCATALOG-COL_POS = 2.
APPEND FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'EBELP'.
FIELDCATALOG-SELTEXT_M = 'PO Item'.
FIELDCATALOG-COL_POS = 3.
APPEND FIELDCATALOG.
CLEAR FIELDCATALOG.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
FORM BUILD_LAYOUT.
"Permet d'ajuster les colonnes au text
* gd_layout-colwidth_optimize = 'X'.
* GD_LAYOUT-TOTALS_TEXT = 'Totals'(201).
* gd_layout-box_fieldname = 'SELECT'.
* gd_layout-box_tabname = 'IT_EKKO'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
FORM DISPLAY_ALV_REPORT .
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
* i_callback_top_of_page = 'TOP-OF-PAGE'
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* i_grid_title = 'My Title'
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
TABLES
T_OUTTAB = IT_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE:/ SY-SUBRC.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
FORM DATA_RETRIEVAL.
SELECT EBELN EBELP
UP TO 10 ROWS
FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE IT_EKKO.
ENDFORM. " DATA_RETRIEVAL
* FORM SET_PF_STATUS *
FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD_FULLSCREEN1' EXCLUDING RT_EXTAB.
ENDFORM. "set_pf_status
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
<b>
*then insert the following code in your USER_COMMAND routine...
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA
ENDIF.</b>*modify
CASE R_UCOMM.
WHEN '&IC1'.
CHECK RS_SELFIELD-TABINDEX > 0.
IF RS_SELFIELD-VALUE EQ '6000000001'.
CALL TRANSACTION 'ZDF2'.
ENDIF.
WHEN 'REFRESH'.
READ TABLE IT_EKKO INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
READ TABLE IT_BACKUP INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
IF IT_EKKO <> IT_BACKUP.
* then do your check
ENDIF.
ENDIF.
ENDIF.
PERFORM DATA_RETRIEVAL.
RS_SELFIELD-REFRESH = 'X'.
ENDCASE.
ENDFORM. "user_command
regards
vijay -
Scrolling-problem in an editable ALV-list
Hi,
I have built an <b>ALV-list</b> with one of the fields <b>open for input</b>. The user wants to use the arrow to scroll <u>down</u> through the table and update that particular field in every row. I have <b>2</b> questions about this:
- First of all, the cursor moves in a strange way. The first number of rows it stays in the right column, but then, out of the blue, it jumps back and forth to other columns after scrolling.
- Secondly, the field I want to edit is always in Insert-mode. Is there any way I can get it into Overwrite-mode? I cannot use the Tab-key, because of the lead-selection.
Thanks in advance for your help.
Kind regards,
Andre MoniharaponHi Vijay,
please don't get me wrong, I really appreciate your attempts to help me, but my problem is that when I press the Down-arrow it <u>doesn't</u> always go to the next cell in the <i>same</i> column. It sometimes goes to the next cell in <i>another</i> column. And if I can't force it to stay in the same column in some way, than my problem cannot be solved and I must think of another solution. So, I don't want the cursor to stay in the same field, I want it to go to the next cell in the same column. You got that right. Again, I really appreciate your help, but it looks more and more that there's no solution to my problem.
Kind regards,
Andre -
How to save edited ALV List.
hi all,
i have created a program which displays two ALV LISTS and i made some of the fileds editable by using input key. Now when i press the SAVE button ,i couldnt capture the edited fileds contents .
have a look at the code below .
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'.
*---------------------for top of page----------------*
xs_event-name = slis_ev_top_of_page.
xs_event-form = 'TOP_OF_PAGE'.
append xs_event to IT_events.
xs_event-name = slis_ev_top_of_page.
xs_event-form = 'TOP_OF_PAGE1'.
append xs_event to IT_events1.
*---------------------appending 1st alv---------------*
if not it_DATA is initial.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = gd_layout
it_fieldcat = it_fieldcat
i_tabname = 'IT_DATA'
it_events = IT_events
tables
t_outtab = it_DATA.
endif.
*---------------------appending 2nd alv---------------*
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = gd_layout1
it_fieldcat = it_fieldcat1
i_tabname = 'IT_PEND'
it_events = IT_events1
tables
t_outtab = IT_PEND.
*---------------------ALV Display------------------------------*
gt_print-reserve_lines = 2.
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
exporting
is_print = gt_print.
endform. " report_output
regards,
Venkati was able to get the changed data in ALV grid by this code
data: gd_repid like sy-repid,
ref_grid type ref to cl_gui_alv_grid.
if ref_grid is initial.
call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
importing
e_grid = ref_grid.
endif.
if not ref_grid is initial.
call method ref_grid->check_changed_data .
endif.
is there any equivalent code for ALV LIST like the above code?? -
Search Help For An Editable ALV List
Hi,
All ABAP Gurus !!
I have made an Editable ALV with the fields of ZTable. In ALV I want the search help in one of the columns.The entry in that should come from the standard table name-TVM5 and the field which should come is MVGR5. MVGR5 does not contain the search help .Following are the description for my ZTable-------
Field Name - MC_NO,
Data Element - ZZMC_NO1,
Domain -ZZMC_NO1.
While creating this ZTable, in the Entry help/check tab I have also mention Input help with fixed values in the column- Origin of the input help and entered the entries also.
About ALV (Only one alv column is shown here for reference in which search help or input help is needed of all the possible entries)---
DATA: INT_FIELDCATALOG2 TYPE LVC_T_FCAT WITH HEADER LINE.
DATA: WA_FIELDCATALOG2 TYPE LVC_S_FCAT ,
WA_LAYOUT2 TYPE SLIS_LAYOUT_ALV ,
GD_LAYOUT2 TYPE LVC_S_LAYO. "slis_layout_alv.
WA_FIELDCATALOG2-FIELDNAME = 'MC_NO'.
WA_FIELDCATALOG2-TABNAME = 'T_ITAB2'. " T_ITAB2 contains all the other fields
WA_FIELDCATALOG2-SCRTEXT_M = 'Machine No.'.
WA_FIELDCATALOG2-EDIT = 'X'.
WA_FIELDCATALOG2-F4AVAILABL = 'X'.
WA_FIELDCATALOG2-REF_FIELD = 'MVGR5'.
WA_FIELDCATALOG2-REF_TABLE = 'TVM5'.
APPEND WA_FIELDCATALOG2 TO INT_FIELDCATALOG2.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS1'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT_LVC = INT_FIELDCATALOG2[]
IS_LAYOUT_LVC = GD_LAYOUT2
TABLES
T_OUTTAB = T_ITAB2.
Please explain in detail
Thanks to all in advance.Please check the following links :
F4 help -- on editable alv field.
F4 help in editable ALV
ALV Editable Grid Control F4 help problem
And search the forum for f4 help on editable alv
KR
Veeranji Reddy P. -
ALV list which is editable ? :-) :-)
Hi Team,
Can you please guide me on how to Create an editable ALV list output (step by step,, Please).
I am only familiar with normal ALV list.
Thanks...Aby JacobHi Sükrü
Thanks,that was a really fast answer.
Your suggestion ( BCALV_EDIT_**)
was really helpful in solving my problem.
warm regards......Aby -
Editable ALV issue: When Delete/Modify a row, ztable doesnt reflect changes
Greeting Fellow Abapers,.
I have been running into an issue that I need some advice on. I am allowing users to edit a Ztable via ALV. When the quantity field is updated everything is fine. However, when the field "lic_plate" is edited the code appends another row into the Ztable instead of modifying it. Also, when the delete row functionality of the grid is used the row is not deleted from the Ztable.
Here is the ztable structure. The fields I allow to be edited are in BOLD...
ZPALLET-VBELN
ZPALLET-MATNR
ZPALLET-LINE_NUM
ZPALLET-LIC_PLATE
ZPALLET-LOT_NUMBER
ZPALLET-PAL_TYPE
ZPALLET-MAN_DATE
ZPALLET-QUANTITY
ZPALLET-PROC_DATE
Here is the source code that the APPEND is taking place...
FORM save_database .
Getting the selected rows index*
CALL METHOD o_grid->get_selected_rows
IMPORTING
et_index_rows = i_selected_rows.
Through the index capturing the values of selected rows*
LOOP AT i_selected_rows INTO w_selected_rows.
READ TABLE itab INTO wa INDEX w_selected_rows-index.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa TO w_modified.
APPEND w_modified TO i_modified.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
MODIFY zpallet FROM TABLE i_modified.
ENDIF.
ENDFORM.
Please help. I am in your debt.
...as always, points will be awarded.
Best,
DanHello Dan
When you are using an editable ALV for table maintenance you have to take care that the users
- cannot edit the key fields of existing DB records and
- every new record (row) does not match any existing record (i.e. has identical key field values)
Instead of relying on selected rows for the DB update I would recommend to store a "PBO image" of your data and compare this with the "PAI image" of the data as soon as the user pushes the SAVE button.
Example:
DATA:
gt_outtab_pbo TYPE < your table type>, " PBO image
gt_outtab TYPE < your table type>. " PAI image
" 1. Select data from DB table and store in both itabs:
SELECT * ... INTO TABLE gt_outtab.
gt_outtab_pbo = gt_outtab.
" 2. Display editable ALV list -> user modifies gt_outtab
" 3. SAVE function requested
" ... compare gt_outtab vs. gt_outtab_pbo
" .... INSERT, UPDATE, or DELETE DB records
" Finally set:
gt_outtab_pbo = gt_outtab.
" 2. User continues with editing
In order to compare PBO vs. PAI data you may have a look at my sample coding:
[Comparing Two Internal Tables - A Generic Approach|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/comparing%2btwo%2binternal%2btables%2b-%2ba%2bgeneric%2bapproach]
Regards,
Uwe -
How to edit particular field in alv list display-urgent
HI ALL,
my requirement is i am displaying output using alv list display. now my rewuirement :
i am displaying out in edit mode only. when user clicks one particular field
for example record is like
runrate a01 maheed -> if user clicks on a01 this field should be editable. i have a following code
w_field-edit = w_edit.
w_field-input = 'X'. -> using this code i can able to display entire colomn in edit mode. this not suits my requirement.anybody can send me the sample code please.
thanks,
maheedhar.tCan you please send me the sample code plz.
i am sending my code below.
type-pools : slis.
tables : zuser_secobjects.
data : t_header1 like zuser_secobjects.
data : begin of it_secobjects occurs 0.
include structure t_header1.
data : checkbox type c value 'X',
action type c,
end of it_secobjects.
data : begin of it_secobjects1 occurs 0.
include structure ZUSER_SECOBJECTS.
data : checkbox type c VALUE 'X',
end of it_secobjects1.
data : wa_ita like line of it_secobjects.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : it_filt type slis_t_filter_alv with header line,
it_evts type slis_t_event with header line.
DATA : is_vari type disvariant.
constants : c_default_vari value 'X',
c_save_vari value 'U',
c_checkfield type slis_fieldname value 'ACTION',
c_f2code type sy-ucomm value '&ETA'.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
p_edate(10) default '12/31/9999',
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
form user_command using p_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case p_ucomm.
when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
loop at it_secobjects into wa_ita.
wa_ita-checkbox = 'X'.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
when 'DESLCT_ALL'.
loop at it_secobjects into wa_ita.
wa_ita-checkbox = ' '.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
is_lout-f2code = c_f2code.
is_lout-box_fieldname = c_checkfield.
is_lout-get_selinfos = 'X'.
is_lout-detail_popup = 'X'.
is_lout-detail_initial_lines = 'X'.
maheed-start.
*when 'SAVE'.
*LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
APPEND IT_SECOBJECTS1.
CLEAR IT_SECOBJECTS1.
DELETE IT_SECOBJECTS.
*ENDLOOP.
*DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
WHEN 'DELETE'.
loop at it_SECOBJECTS where checkbox eq 'X'.
delete it_SECOBJECTS.
endloop.
*RS_SELFIELD-REFRESH = 'X'.
maheed-end.
maheed-start. apr 13
WHEN 'DELETE'.
loop at it_SECOBJECTS where checkbox eq 'X'.
MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
APPEND IT_SECOBJECTS1.
delete it_SECOBJECTS.
endloop.
RS_SELFIELD-REFRESH = 'X'.
when 'SAVE'.
DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
commit work.
refresh :IT_SECOBJECTS1.
maheed-end. apr 13
*when 'SAVE'.
*LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
APPEND IT_SECOBJECTS1.
CLEAR IT_SECOBJECTS1.
DELETE IT_SECOBJECTS.
*ENDLOOP.
*DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
ENDCASE.
endform.
*& Form delete
form delete.
data : begin of is_secobjects occurs 0.
include structure zuser_secobjects.
data : checkbox type c.
data : end of is_secobjects.
is_secobjects-checkbox = 'X'.
modify is_secobjects
from it_secobjects
transporting checkbox
where checkbox = 'X'.
endform.
*& Form get_data
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " get_data
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog." USING w_edit TYPE any.
data : w_edit type c.
clear w_edit.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-EDIT = 'X'. "maheed
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_PARTNER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m03.
w_field-edit = w_edit.
w_field-input = 'X'.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'INACTIVE'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 3.
append w_field to i_field.
clear w_field.
endform. " prepare_fieldcatalog
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
DATA : LC_GLAY TYPE LVC_S_GLAY.
LC_GLAY-EDT_CLL_CB = 'X'.
i_repid = sy-repid.
is_lout-box_fieldname = 'CHECKBOX'.
it_filt-fieldname = 'ACTION'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_filter = it_filt[]
it_events = it_evts[]
i_default = c_default_vari
i_save = c_save_vari
is_variant = is_vari
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form display
text
-->P_I_OBJECT text
form display using object.
case object.
ENDCASE.
endform. " display
thanks,
maheedhar.t -
Editable field in alv list display
i WANT TO GIVE COLOR FOR EDITABLE FIELD IN ALV LIST DISPLAY.i TRIED WITH EMPHASIZE IN FIELD CATALOGUE ASSIGNING.bUT,IT IS NOT WORKING.HOW TO DO.tHANX IN ADVANCE.........
HI,
Please refer the link below:
http://www.****************/Tutorials/ALV/Edit/demo.htm
http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
Thanks,
Sriram Ponna. -
HI,
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-TABNAME = 'GT_OUT'.
WA_FIELDCAT-FIELDNAME = 'DATAINS2'.
WA_FIELDCAT-SELTEXT_M = 'POD'.
WA_FIELDCAT-EDIT = 'X'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-EDIT = 'X'.
I USED THIS ONE BUT IAM GETTING SYNERROR WA_FIELDCAT DONT HAVE THIS COMPONENT.Refer to this related thread
Re: how to edit particular field in alv list display-urgent -
Editable alv: add custom validation and display "errors" in protocol list
Hi,
What I want to do:
PAI validation of editable alv with displaying error's in the protocol list by adding custom entries to the existing protocol object.
What is my problem:
After registering "data_changed event", the protocol list don't appear.
My understanding is, that the object "er_data_changed" is passed by the event "data_changed"
an so I thought I can add some more entries to the protocol list.
After "de-registering" the "data_changed" event, the protocol appears with the standard errros messages (e.g. "input to numeric" by enter charachters)
One more hint:
By creating a new object "er_data_changed" in the handler method the protocol list works, but I would like to append entries to the object that was passed with the event.
Probably I've misunderstand something, please help !
My coding:
PAI:
trigger event "data_changed" -> calls handler method
CALL METHOD r_myalv->check_changed_data
IMPORTING
e_valid = is_valid.
stop processing
IF is_valid NE 'X'.
MESSAGE 'invalid input' TYPE 'E' .
ENDIF.
handler method:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING e_ucomm
er_data_changed.
METHOD handle_data_changed.
data: ls_mod_cell type lvc_s_modi.
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = 'SU'
i_msgty = 'E'
i_msgno = '000'
i_msgv1 = 'This is a test !'
i_fieldname = ls_mod_cell-fieldname.
er_data_changed->refresh_protocol( ).
er_data_changed->DISPLAY_PROTOCOL( ).
ENDMETHOD. "handle_data_changedDear Olaf,
If understood correctly, you want to Edit an ALV and do some data validations when some data is changed in an ALV. To do this follow the following steps:
1. Before displaying ALV, Register the edit event.
* Set cell modified to trigger data_changed
CALL METHOD go_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
2. Register the event DATA_CHANGED of class CL_GUI_ALV_GRID & handle the event.
SET HANDLER lo_event_receiver->handle_data_changed FOR go_alv_grid.
The event DATA_CHANGED of class CL_GUI_ALV_GRID has a parameter ER_DATA_CHANGED which is of type CL_ALV_CHANGED_DATA_PROTOCOL.
This er_data_changed has internal table MT_MOD_CELLS(contains index of records changed ) & MP_MOD_ROWS(contains the changed row), using these update your internal table accordingly.
DATA : wa_mod_cell TYPE lvc_s_modi.
FIELD-SYMBOLS: <fs> TYPE table.
LOOP AT er_data_changed->mt_mod_cells INTO wa_mod_cell.
ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
READ TABLE <fs> INTO wa_output INDEX wa_mod_cell-tabix.
MODIFY lt_output FROM wa_output INDEX wa_mod_cell-row_id.
ENDLOOP.
3. Here it self you can do the required data validations(No need of any PAI modules) as below.
IF wa_orders-zfstfirmtyp = c_9.
MESSAGE s288(zcsp).
DELETE er_data_changed->mt_mod_cells.
EXIT.
ENDIF.
Regards
Kesava -
Drop-down list in editable ALV
Hello all,
Does anyone know how to display the values instead of the internal values when using the alias table to specify a drop-down list in an editable ALV grid ?
Apparently the BC_ALV* examples have the same problem.
thx
PieterHi,
These links will help you to implement a drop down list...
http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm
Also refer the pgm:
RSDEMO_DROPDOWN_LISTBOX
BCALV_TEST_GRID_F4_HELP
Also take a look the SAP example program BCALV_TEST_GRID_EDITABLE. It has a working Drop Down List Box.
You have to fill a table of type lvc_t_drop. In this you set a handle and value for every item you want to have in a all possible drop down lists. You will later connect a sub set of this data to your grid display data by joining on this handle. You can then send this table to your ALV grid using the method SET_DROP_DOWN_TABLE. You will also want to set the DRDN_FIELD in your field catalog to the field name in your data table that will contain the handle for the values in your drop down table you want to expose. You will need to add this field to your data table.
Best Regards,
Anjali -
How to edit particular field in alv list display
hi,
i am displaying output using alv list display. my as follows.
runrate maheed a01.
here if i click a01 it has to show iin edit mode earlier it has to show display mode only. when i select by that time it has to show edit mode there i will change into a02 and i will click save button this is my requirement.
anybody can send me the sample code please.
thanks,
maheedhar.tfollowing is my field cata log
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
now i am writng like this
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-EDIT = 'X'. "maheed
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
eventhough it is not allowing me to edit the field when i click that field in the output.
thanks,
maheedhar.t -
Editable column in ALV list report
Hi,
I developed a ALV list block report. I want to make some of column editable in my alv list report.I set WA_FIELDCAT-EDIT = 'X' in fieldcatalog but it's not working.
Could you please sugest.
Regards,
MohitHi Mohit ,
please check WA_FIELDCAT-EDIT = 'X' fieldcat which you are passing to ALV grid function module is same or different .
or use in this way
perform get_fieldcat using 'QUANTITY' 'Enter.Qty' 12 'R' 'N' '000' 'N' 'N' 'N' 'N' 'N' 'N' .
get_fieldcat using p_fieldname
p_txtname
p_length
p_justfy
p_keyfld
p_color
p_hotspt
p_total
p_sort
p_subtot
p_para1
p_zero .
clear ms_fieldcat .
ms_fieldcat-fieldname = p_fieldname .
ms_fieldcat-seltext_l = p_txtname .
ms_fieldcat-ddictxt = 'L' .
ms_fieldcat-outputlen = p_length .
ms_fieldcat-just = p_justfy .
ms_fieldcat-lzero = 'X' .
ms_fieldcat-checkbox = 'X' .
ms_fieldcat-edit = 'X' .
if p_fieldname = 'CHK' .
ms_fieldcat-checkbox = 'X'.
ms_fieldcat-edit = 'X'.
else.
ms_fieldcat-checkbox = ' '.
ms_fieldcat-edit = ' '.
endif.
if p_fieldname = 'QUANTITY' .
ms_fieldcat-edit = 'X'.
endif.
regards
Deepak. -
Can we edit alv output list.
hi happy new year to everybody ......
can anybody tell me that can we create aditable alv list ...
how can we.....Hi,
Yes you can create an Editable ALV.
I am giving you an example of Editable ALV in OOPs.
Example:
Take a Custom container in Screen 100 and name it "LIST_AREA".
REPORT ZSB_ALV_EDITABLE_SAMPLE.
TABLES: SFLIGHT.
DATA: gc_container TYPE scrfname VALUE 'LIST_AREA',
gc_custom_container TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
gc_grid TYPE REF TO CL_GUI_ALV_GRID,
gs_layout TYPE LVC_S_LAYO,
gt_fieldcat TYPE LVC_T_FCAT.
DATA: ok_code TYPE SY-UCOMM.
DATA: gt_outtab TYPE TABLE OF SFLIGHT.
*DYNPRO
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
CREATE OBJECT gc_custom_container
EXPORTING
container_name = gc_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
CREATE OBJECT gc_grid
EXPORTING
i_parent = gc_custom_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5 .
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
PERFORM prepare_layout CHANGING gs_layout .
PERFORM get_alv_display.
ENDMODULE.
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
OK_CODE = SY-UCOMM.
IF OK_CODE = 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR OK_CODE.
ENDIF.
ENDMODULE.
FORM prepare_field_catalog CHANGING gt_fieldcat TYPE LVC_T_FCAT.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
I_STRUCTURE_NAME = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fieldcat[].
ENDFORM.
FORM prepare_layout changing p_gs_layout TYPE lvc_s_layo.
p_gs_layout-zebra = 'X'.
p_gs_layout-edit = 'X'.
ENDFORM. " prepare_layout
FORM get_alv_display .
SELECT * FROM sflight INTO TABLE gt_outtab UP TO 10 ROWS.
CALL METHOD gc_grid->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = gs_layout
CHANGING
it_outtab = gt_outtab
IT_FIELDCATALOG = gt_fieldcat
ENDFORM. " get_alv_display
Regards,
Sachin
Maybe you are looking for
-
I have 3 iPods: 1 Touch and 2 Classics. The Touch and 1 of the Classics are both working fine; the other Classic is not showing up in iTunes, My Computer, or in Device Manager. While I CAN do a simple reset, it accomplishes nothing, and I am UNABL
-
Why am I getting an error when I sync my iPhone 5S?
The error message "The iPhone "iPhone name" cannot be synced. An unknown error occurred (-54)." came up when I have been syncing my new iPhone 5S. This didn't start happening until last night, when I restored my iPhone from an old back-up I had from
-
Problem with Viewsonic external screen
Hi everyone, I have the new MBP and miniDP > DVI cable, but nothing shows up on my external Viewsonic vx2035. The same combination works with other monitor, also the Viewsonic works with my old MBP... Any idea? Thanks. John
-
I don't understand the new iTunes. How do I drag downloaded music and drop it into my ipod from a site other than the itunes store
-
is it possible to create a transparent button? I want to place a button on top of an image, but I want to be able to see the image through the button.