Save data in editable ALV
Hi all,
I am using an editable ALV in webdynpro using which I would like to save some data to a table. In the list of standard functions, I see only options like 'Insert row', 'Delete row' etc. There is no option to Save the edited data.
Even if I declare a user defined function, how do I specify the action it would trigger? Any help would be greatly appreciated. Thanks in advance.
Regards,
Nithya
Hi Nithya,
Once you edit an ALV, the data is automatically updated to the context node, you map in the DATA field of controller usage (of the component usage).
If you want to trigger event for change in ALV, see the below tutorial.
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bd28494a-0801-0010-45a3-fc359d82d3e8">Using Events with ALV Tables
in Web Dynpro for ABAP</a>
If you want to trigger a event for user defined function,
Create a event handler method in the view. Specify event,
ON_FUNCTION of the interface controller of ALV for the event handler method.
The importing parameter r_param of the method contains unique ID of the
function for which the UI element is assigned.
For reference see the below tutorial. It will be useful.
<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/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110">Generating Self-Defined Functions for ALV in Web Dynpro for ABAP</a>
Hope it Helps
Rakesh
Similar Messages
-
How to Transfer Data from editable ALV grid control to internal table?
Hi,
Can anyone give me a simple example by which I can transfer data from editable alv grid control back to the internal table. The ALV has been created by OO approach.
I would appreciate if the solution is provided without handling any events.
Regards,
AuroHello Auro
You simply need to call method <b>go_grid->check_changed_data</b> at PAI of the dynpro displaying the ALV grid. If data have been changed on the editable ALV grid then this method will raise event DATA_CHANGED. If you do not want or need to handle this event (e.g. for validating the edited values) then you do not define any event handler method.
Regards
Uwe -
Save changed data in editable ALV
Hi experts,
I have a problem with an editable ALV. I get data out of a table and show it with my web dynpro application in an alv. Now I made the alv editablke, so that I can change the content of each cell in the alv in the web browser. But how will this changed data be saved? I want that it will be changed after ENTER or clicking a save button. I have a button, but all I tried yet brought no success.
Which code has to be in which method? Have I to do something eith the context. How can I reach that the changed content is also changed in the table, so that after reload the web dynpro application, the changed content is shown?
It would be nice if you had an answer with code examples and the exact place where to put it in, because I am very new to ABAP and WD4A.
Thanks a lot!
Best Regards
IngmarIf you look on the following lokn, there is the tutorial "Editing ALV in Web Dynpr for ABAP".
There is described how to save the data. But in the implementation of On_data_check on page 8 and 9 the code detail for saving the data to database is missing, because the flight model shall not be changed.
Would the missing code be the solution? What is the code?
Thanks!!!
Best Regards Ingmar
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1 -
Get data in editable ALV back to internal table without data_changed ev?
Hi,
I have an editable ALV using classes to whch I have users the option to edit directly on the screen or upload data from an excel. The event data_changed gets triggered when users edit the table on the screen.
However when EXCEL is uploaded, I refresh the table display. So, I need a way to get the data from the ALV into a internal table to check which rows were update using the excel and save them into the db table.
PrakashHi!
For more information, inspect programs suiting the mask "BCALVEDIT*" and the thread with header "How to make a row of ALV editable " (I know this is some more steps further from your demand but it may be useful) at URL " How to make a row of ALV editable " .
If you want to study more BC412 "EnjoySAP Controls" may help you.
*--Serdar -
Update out_tab data in editable ALV
Hi,
I am working on editable ALV using oops. I want to insert the data into database tables after user insert the data in ALV based on the application tool bar button action.
How to refresh the data in out_tab, If user click the application tool bar button then I need to save the ALV grid data in database table.
Please give me the valuable suggestions.
- Rayudusolved my self
-
How to validate data in editable ALV report after making changes
Hi Folks,
My requirement is to display data in ALV format with quantity field is editable. Once we get the data in display mode only quantity field is enabled right. I am going to make changes to that quantity field and updating that modifed value to the database table. Before updating databse table i want to validate the data for perticluar field which I edidted(Quantity).
Can you guide me on this.
Currently I am using FM: GET_GLOBALS_FROM_SLVC_FULLSCR and calling the method CHECK_CHANGED_DATA.
I want to validate the quantity data.
If I entered negative value like -100 instead of 100. It should validate and show some popup screen or message.
Pls guide me on this or give some code to do that.
Thanks&Regards,
SurendraHey Surendra,
Check if this helps: Link:[Click here|Edit Field in Oops Alv;
There are many posts available for this requirement. Please look SDN/web for same.
Regards,
Santosh -
Save contents of editable alv into dbtable
Hi All,
I have an alv output with editable fields. This output has the contents some from an itab and some are hardcoded in the program. Now I have edited the contents in the alv o/p.
Now I want to save the contents of the alv o/p fully into the dbtable.
Please suggest how to do this.Hi,
STEP :1.
In the PBO of the Screen in Which you are designed your container for output - SET the PF-STATUS.
Example : SET PF-STATUS '1500'.
In this PF Status you activate the SAVE Button.
I think for SAVE Button the sy-ucomm = 'SPOS'.
STEP 2:
In the PAI of the Screen in Which you are designed your container for output.
Write the below code.
IF SY-UCOMM = 'SPOS'.
CALL METHOD G_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
IF L_VALID EQ 'X'.
CALL METHOD G_GRID->GET_SELECTED_ROWS
IMPORTING
ET_ROW_NO = LT_ROW_NO[].
ENDIF.
At this Point your output table will have the modified values.
Now you can proceed it to update the database table.
ENDIF.
Regards
Amir -
Validation of data in editable ALV report output for particular field
Hi Experts,
I have one input enabled field in ALV output. How to validate the data once user enters in that field and press enter? Is it possible to capture the value, hit the enter after user enters the data?
Thanks,
Surya PrakashHalo Prakash,
1 First you should registeer the ENTER Event.
call method g_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
2 Declare event handler method for Event data_changed of cl_gui_alv_grid.
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
3 Inside the Event handler method , you get the event parameter er_data_changed type ref to CL_ALV_CHANGED_DATA_PROTOCOL.
loop at er_data_changed->mt_good_cells into ls_good.
case ls_good-fieldname.
when 'FIELD1'.
call method check_FIELD1.
when 'FIELD2 '.
call method check_FIELD2
endcase.
endloop.
4 Inside the Method check_FIELD1 and check_FIELD2 you can do the validation check .
call method er_data_changed->get_cell_value( Passing the row no and field name).
if the check fails you can use add_protocol_entry to write the error.
5 Finally call
er_data_changed->display_protocol.
Regards
Arshad -
Regarding validating data in editable ALV in OOPS
I'm using the data_changed event in my ALV grid to validate the user's
entry in the ALV grid. My code finds the errors when the user originaly
enters the wrong data, highlights the errors in the grid, and popups u the
list of error messages.
My problem occurs when the user only fixes some of the errors and leavs
some data errors still in the grid. The data_changed will check the lnes
the user has fixed. However if they neglect to fix one of the errors,the
code doesn't reread the entry since the data didn't change from the
original entry. The error still exist and I don't want to allow the uer
to continue until they have fixed all of the errors. Is there another
event or coding that I can use to ensure the user fixes all of the errrs.
I know I could loop through the ALV grid table outside of my methods, ut
that would require rewriting all the checking again which seems very
inefficient.
Thanks,
Phani.Check this link if it is useful:
F4 Help in ALV Grid (using CL_GUI_ALV_GRID)
Regards
Neha -
Display in editable alv grid.
Hi,
This is my source code of uploading excel into sap and displaying the list.Please give the code for displaying the excel data in editable alv.
<<The code came from [here|https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-UploaddatafromExceltoSapusing+OO]>>
Thanks in advance.
am just a beginner in learning abap objects.pls help.
Edited by: Matt on Aug 6, 2009 4:26 PMIt wasn't your source code, was it?
Please take the time to read the rules of engagement. As it stands, your question is far too general. There are examples of editable alvs in many location on the net. You must search for them. Please note these are not training forums, they are expert forums. When you have a specific question, we'll be glad to assist.
Post locked
matt -
How to save data in ztable after editing in alv report
how to save data in ztable after editing in alv report?
Hi,
Please find the attachment below.This may be usefull to you.
[http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29]
Regards,
Ramakrishna Yella. -
How to save the editable alv data to another program ?
hi friends,
please solve this issue..
i have one editable alv grid report. after edit my data in the grid..
i want to
save those data (edited data )or
download those data into another internal table or
pass those data as input to another report program..
how can i do this ?The form switch to edit mode could be :
form p_edit.
data : is_fieldcatalog type lvc_s_fcat ,
it_ucomm type table of syucomm with header line ,
v_ucomm type syucomm.
* Switch Edit <-> Display
loop at it_fieldcatalog into is_fieldcatalog.
check is_fieldcatalog-fieldname ne 'NUM' and
is_fieldcatalog-fieldname ne 'RCODE'.
if is_fieldcatalog-edit eq 'X'.
clear is_fieldcatalog-edit.
else.
move 'X' to is_fieldcatalog-edit.
endif.
modify it_fieldcatalog from is_fieldcatalog.
endloop.
* Change the status of the grid.
if is_fieldcatalog-edit eq space.
move '&REFRESH' to v_ucomm.
call method obj_grid->set_function_code
changing c_ucomm = v_ucomm.
call method obj_grid->set_ready_for_input
exporting i_ready_for_input = '0'.
else.
call method obj_grid->set_ready_for_input
exporting i_ready_for_input = '1'.
endif.
* Modify the fieldcatalog.
call method obj_grid->set_frontend_fieldcatalog
exporting it_fieldcatalog = it_fieldcatalog.
* Refresh the display of the grid.
call method obj_grid->refresh_table_display.
* Set the column lines number.
perform p_set_lines_num.
* Clear the flag control.
clear v_flag_control.
* Messages.
if is_fieldcatalog-edit eq space.
move 'Passage en mode affichage.' to v_buff.
perform p_add_message
using v_buff
'ICON_DISPLAY'
else.
move 'Passage en mode édition.' to v_buff.
perform p_add_message
using v_buff
'ICON_CHANGE'
endif.
* Inactiv function.
if is_fieldcatalog-edit eq space.
set pf-status '100'.
else.
move '' to it_ucomm. append it_ucomm.
set pf-status '100' excluding it_ucomm.
endif.
endform. " P_EDIT.
and for the table:
data : w_id(60).
move 'ZTOTO' to w_id.
export it_table[] to memory id w_id.
in the other program, it's the same with the IMPORT instead of export. -
How can we find out data in an editable ALV grid has been changed or not?
Hi Experts,
How can we find out whether a data in an editable ALV grid has been changed or not.
I am using the
FM -> REUSE_ALV_GRID_DISPLAY_LVC
for ALV display.
I have to chekc whther data has been changed or not befor saving. if changed then only i want to
SAVE
. I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
So kindly sugest me an alternative.
Thanks and Regards,
ShahanaHi,
Thanks for your answer. I already saw this post.
See this method.
CALL METHOD reuse_alv_grid->check_changed_data
IMPORTING
e_valid = lv_check.
This will update the internal table with the edited values. Then we can go for internal table comparison.
But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
Regards,
Shahana -
Save Data in ALV Report .
Hello,
Given below is my code
*& Report ZALV_TEST_SA *
REPORT ZALV_TEST_SA NO STANDARD PAGE HEADING.
*----------------------TYPE POOL OF ALV--------------------------------*
TYPE-POOLS: SLIS.
*----------------------DATABASE TABLES---------------------------------*
TABLES: ZFLIGHTM_SA, ZFLIGHT_AVAIL_SA.
*-------------DATA DECLARATION-----------------------------------------*
DATA: BEGIN OF ITAB OCCURS 0,
ZFLIGHT_ID TYPE ZFLIGHT_ID,
ZCITY_FROM TYPE ZCITY_FROM,
ZCITY_TO TYPE ZCITY_TO,
ZDEP_DATE TYPE DATS,
ZTIME TYPE TIMS,
ZPRICE TYPE ZPRICE,
ZNUM_OF_PSNGRS(3) TYPE N,
ZAVAIL_SEATS(3) TYPE N,
END OF ITAB.
DATA: BEGIN OF ITABM OCCURS 0,
MANDT TYPE MANDT,
ZFLIGHT_ID TYPE ZFLIGHT_ID,
ZCITY_FROM TYPE ZCITY_FROM,
ZCITY_TO TYPE ZCITY_TO,
ZTIME TYPE TIMS,
ZPRICE TYPE ZPRICE,
END OF ITABM.
DATA: BEGIN OF ITAB_AVAIL OCCURS 0,
MANDT TYPE MANDT,
ZFLIGHT_ID TYPE ZFLIGHT_ID,
ZDEP_DATE TYPE DATS,
ZNUM_OF_PSNGRS(3) TYPE N,
ZAVAIL_SEATS(3) TYPE N,
END OF ITAB_AVAIL.
DATA: WA_ITAB LIKE LINE OF ITAB,
WA_ITABM LIKE LINE OF ITABM,
WA_ITAB_AVAIL LIKE LINE OF ITAB_AVAIL.
DATA: L_REPID LIKE SY-REPID,
L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV,
L_EVENTS TYPE SLIS_T_EVENT.
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*----------------SELECTION SCREEN SELECT-OPTIONS-----------------------*
SELECT-OPTIONS S_CITY FOR ZFLIGHTM_SA-ZCITY_FROM NO INTERVALS.
SELECT-OPTIONS D_CITY FOR ZFLIGHTM_SA-ZCITY_TO NO INTERVALS.
SELECT-OPTIONS D_DATE FOR ZFLIGHT_AVAIL_SA-ZDEP_DATE NO INTERVALS.
*----------------------SELECTION OF DATA-------------------------------*
PERFORM SELECT_DATA.
*----------------SETTING DATA IN TABLE FOR FIELD CATALOG---------------*
PERFORM CALL_FIELDCAT_MERGE.
*----------CALLING FUNCTION FOR DISPLAYING REPORT----------------------*
PERFORM DISPLAY_TABLE.
*----------------------AT SELECTION SCREEN EVENT-----------------------*
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'STORE'.
PERFORM SAVE_DATA.
WHEN 'PREVIOUS'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
*------------------------------FORMS-----------------------------------*
*& Form SELECT_DATA
* text
* --> p1 text
* <-- p2 text
FORM SELECT_DATA .
SELECT A~ZFLIGHT_ID ZCITY_FROM
ZCITY_TO ZDEP_DATE
ZTIME ZPRICE
ZNUM_OF_PSNGRS ZAVAIL_SEATS
FROM ZFLIGHTM_SA AS A INNER JOIN ZFLIGHT_AVAIL_SA AS B
ON A~ZFLIGHT_ID = B~ZFLIGHT_ID
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE A~ZCITY_FROM IN S_CITY
AND A~ZCITY_TO IN D_CITY
AND B~ZDEP_DATE IN D_DATE.
L_REPID = SY-REPID.
ENDFORM. " SELECT_DATA
*& Form CALL_FIELDCAT_MERGE
* text
* --> p1 text
* <-- p2 text
FORM CALL_FIELDCAT_MERGE .
* CLEAR WA_FIELDCAT.
* WA_FIELDCAT-TABNAME = ITAB.
* WA_FIELDCAT-FIELDNAME = 'ZFLIGHT_ID'.
* WA_FIELDCAT-KEY = 'X'. "sets key field
* APPEND WA_FIELDCAT TO L_FIELDCAT.
* WA_FIELDCAT-TABNAME = ITAB.
* WA_FIELDCAT-FIELDNAME = 'ZPRICE'.
* WA_FIELDCAT-KEY = 'X'. "sets key field
* APPEND WA_FIELDCAT TO L_FIELDCAT.
* WA_FIELDCAT-TABNAME = ITAB.
* WA_FIELDCAT-FIELDNAME = 'ZAVAIL_SEATS'.
* WA_FIELDCAT-KEY = 'X'. "sets key field
* APPEND WA_FIELDCAT TO L_FIELDCAT.
*--------------CALLING FUNCTION FOR FIELD CATALOG----------------------*
CLEAR L_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = L_REPID
I_INTERNAL_TABNAME = 'ITAB'
* I_STRUCTURE_NAME = 'WA_ITAB'
* I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = 'ZALV_TEST_SA'
I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = L_FIELDCAT
* 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.
*--------------EDITING FIELDS IN FIELD CATALOG ------------------------*
LOOP AT L_FIELDCAT INTO WA_FIELDCAT.
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'ZFLIGHT_ID'.
WA_FIELDCAT-COL_POS = '1'.
* WA_FIELDCAT-text_fieldname = 'Flight ID'.
WA_FIELDCAT-KEY = '3'.
WA_FIELDCAT-JUST = 'L'.
WA_FIELDCAT-NO_ZERO = 'X'.
WA_FIELDCAT-EMPHASIZE = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Flight ID'. "40 char long field name
WA_FIELDCAT-SELTEXT_M = 'Flight ID'. "20 char long field name
WA_FIELDCAT-SELTEXT_S = 'Flight ID'. "10 char long field name
WHEN 'ZCITY_FROM' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZCITY_TO' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZDEP_DATE' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZTIME' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZPRICE' .
WA_FIELDCAT-COL_POS = '2'.
* WA_FIELDCAT-text_fieldname = 'Flight ID'.
WA_FIELDCAT-KEY = '4'.
WA_FIELDCAT-JUST = 'L'.
WA_FIELDCAT-NO_ZERO = 'X'.
* WA_FIELDCAT-EMPHASIze = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Price'. "40 char long field name
WA_FIELDCAT-SELTEXT_M = 'Price'. "20 char long field name
WA_FIELDCAT-SELTEXT_S = 'Price'. "10 char long field name
WA_FIELDCAT-EDIT = 'X'.
WHEN 'ZNUM_OF_PSNGRS' .
WA_FIELDCAT-NO_OUT = 'X'.
WHEN 'ZAVAIL_SEATS' .
WA_FIELDCAT-COL_POS = '3'.
* WA_FIELDCAT-text_fieldname = 'Flight ID'.
WA_FIELDCAT-KEY = '4'.
WA_FIELDCAT-JUST = 'L'.
WA_FIELDCAT-NO_ZERO = 'X'.
* WA_FIELDCAT-EMPHASIze = 'X'.
WA_FIELDCAT-SELTEXT_L = 'Available Seats'.
"40 char long field
WA_FIELDCAT-SELTEXT_M = 'Available Seats'.
"20 char long field
WA_FIELDCAT-SELTEXT_S = 'Seats'. "10 char long field name
WA_FIELDCAT-EDIT = 'X'.
WHEN OTHERS.
WA_FIELDCAT-NO_OUT = 'X'.
ENDCASE.
MODIFY L_FIELDCAT FROM WA_FIELDCAT.
ENDLOOP.
ENDFORM. " CALL_FIELDCAT_MERGE
*& Form USER_COMMAND_ALV_SA
* text
* --> p1 text
* <-- p2 text
FORM USER_COMMAND_ALV_SA USING I_UCOMM LIKE SY-UCOMM
IS_SELFIELD TYPE SLIS_SELFIELD.
*****form frm_usercommand using r_ucomm like sy-ucomm
*****rs_selfield type slis_selfield.
****CASE I_UCOMM.
CASE sy-ucomm.
WHEN 'STORE'.
PERFORM SAVE_DATA ON COMMIT.
WHEN 'PREVIOUS'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
ENDCASE.
ENDFORM. "USER_COMMAND_ALV_SA
*& Form DISPLAY_TABLE
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_TABLE .
* L_FIELDCAT-input = 'X'.
* L_FIELDCAT-edit = 'X'.
* L_LAYOUT-Edit = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = L_REPID " report id
I_CALLBACK_PF_STATUS_SET = 'ZALV_TEST_SA' " to set pf-status
I_CALLBACK_USER_COMMAND = 'USER_COMMAND_ALV_SA' " to handle
" user command
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = ''
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = L_FIELDCAT " for field catalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = L_EVENTS "internal table with
" user events
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB "internal table with
" records
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
********* 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_TABLE
*-------------------------SET PF-STATUS--------------------------------*
*& Form ZALV_TEST_SA
* text
* --> p1 text
* <-- p2 text
FORM ZALV_TEST_SA USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ZALV_TEST_SA' .
ENDFORM. "ZALV_TEST_SA
*& Form SAVE_DATA
* text
* --> p1 text
* <-- p2 text
FORM SAVE_DATA.
LOOP AT ITAB INTO WA_ITAB.
****HIDE:WA_ITAB-ZFLIGHT_ID, WA_ITAB-ZCITY_FROM,
****WA_ITAB-ZCITY_TO, WA_ITAB-ZTIME,
****WA_ITAB-ZDEP_DATE, WA_ITAB-ZNUM_OF_PSNGRS,
****WA_ITAB-ZAVAIL_SEATS.
CLEAR: WA_ITABM,WA_ITAB_AVAIL.
WA_ITABM-ZFLIGHT_ID = WA_ITAB-ZFLIGHT_ID.
WA_ITABM-ZCITY_FROM = WA_ITAB-ZCITY_FROM.
WA_ITABM-ZCITY_TO = WA_ITAB-ZCITY_TO.
WA_ITABM-ZTIME = WA_ITAB-ZTIME.
WA_ITABM-ZPRICE = WA_ITAB-ZPRICE.
WA_ITAB_AVAIL-ZDEP_DATE = WA_ITAB-ZDEP_DATE.
WA_ITAB_AVAIL-ZNUM_OF_PSNGRS = WA_ITAB-ZNUM_OF_PSNGRS.
WA_ITAB_AVAIL-ZAVAIL_SEATS = WA_ITAB-ZAVAIL_SEATS.
APPEND WA_ITABM TO ITABM.
APPEND WA_ITAB_AVAIL TO ITAB_AVAIL.
ENDLOOP.
MODIFY ZFLIGHTM_SA FROM TABLE ITABM.
MODIFY ZFLIGHT_AVAIL_SA FROM TABLE ITAB_AVAIL.
COMMIT WORK.
ENDFORM. " SAVE_DATA
I want to edit a field--the price and save the changes. I have assigned a button STORE for this. But my data is not getting saved.
I searched the forum and wrote the code accordingly. I even referred the stored programs. Still I am not getting the output. Please help.
Regards,
Smruthi.
Edited by: Smruthi Acharya on Feb 10, 2009 3:31 PM
Edited by: Julius Bussche on Feb 10, 2009 12:16 PM
Please use code tagsHi,
You must have taken some function code for that STORE button (say you have taken it as MODIFY )
Use this code, it will modify the code in internal table from alv.
I have tried it, n its working:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort " sort info
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* i_save = 'A'
* is_variant = wa_variant " variant name
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final " internal table
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is MODIFY (STORE button) then save data
WHEN 'MODIFY'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
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.
" at this point your data in internal table is changed
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun -
Getting changed data back from editable ALV...
Hello Gurus,
I am working on ALV using standard ALV function module REUSE_ALV_GRID_DISPLAY. Now, To make the fields editale, I am using flag EDIT = 'X' in field catalog. This working fine.
Now, when the data is changed in ALV grid and user clicks on SAVE button that I have programmed in i_callback_usercommand, how can I get the changed data back from editable ALV so that I can change data in custom table ?
Please help.
Regards,
Rajesh.I see that the method CHECK_CHANGED_DATA is used. I am also doing it as follows. But how do I get the changed data back in table. There are no table parameters in
CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
DATA: 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.
Please guide
Maybe you are looking for
-
I have reset my iPod touch 4th generation and since yesterday, it is always trying tto reset
-
Render slow after neat video nested multi cam sequence
Guys this is silly, usually i am rendering like lightning, but after a really dark shoot i needed neat video which has saved my life but after creating a multi cam sequence every time i go back to change something in the synced sequence the whole tim
-
Not booting after creating a fat32 partition from windows 8 from boot camp
I have windows 8.1 on a boot camp partition. I created a fat32 partition from windows looking forward to be able to share files to Yosemite OSX. But now, neither the OSX or the windows are booting. When pressing options key is only abailable one opt
-
Start up script for EPM 11.1.2 in Unix or Windows...
Is there a sample start up script for starting required services in EPM 11.1.2 ? I saw that the Program Files item for EPM, has a link to some start up script but it starts everything and it seems to refer to many scripts and seem complicated. Is the
-
Premiere Elements9が再インストールできない
Premiere Elements9を起動すると.メニューバーだけの画面になり.新規プロジェクトあるいは作成済みのプロジェクトを選択しようとすると. 「重大なエラーが発生しました・・・」とダイアログが表示され.終了するしかなくなります. アンインストールして再起動後.再度インストールしても.同じ現象が出て.起動することができません. 何度か繰り返しましたが.何度やっても同じ現象になり.お手上げ状態です. なお.PCはWin7で.購入後間もなくPremiere Elements9をAdobeSto