Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the grid display values and how to save the edited values

Former Member
0 Kudos

HI all,

afterg ernerating the grid display values, some of the fields have the option to edit and if any changes done to the fields has to be saved in data base tables, please let me know if any body has come across the scenario.

Regards,

Tirumal.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

if RG is the reference variable for ur grid then use this method in PAI.

if rg is not initial.

call method rg->check_changed_data.

endif.

this will reflect the changes in the grid into the internal table passed in set_table_for_first_display as it_outtab[].

You have to call method rg->check_changed_data( ) at PAI of your screen. This will trigger event DATA_CHANGED if data of the editable ALV have been changed.

Edited by: Kamini Rawat on Feb 7, 2008 10:04 AM

4 REPLIES 4

Former Member
0 Kudos

hi,

if RG is the reference variable for ur grid then use this method in PAI.

if rg is not initial.

call method rg->check_changed_data.

endif.

this will reflect the changes in the grid into the internal table passed in set_table_for_first_display as it_outtab[].

You have to call method rg->check_changed_data( ) at PAI of your screen. This will trigger event DATA_CHANGED if data of the editable ALV have been changed.

Edited by: Kamini Rawat on Feb 7, 2008 10:04 AM

0 Kudos

HI,

thanku very much.. if u have any piece of code, can u send across to me. and i want to have F4 HELP for the date fields, that help is not coming, canu give me any answer.

Regards

tirumal.

0 Kudos

Hi,

to get f4 help for date fields the fields which u have defined in fieldcatalog ,they should refer to the fields of type dats(in database table).

then f4 help automatically comes.

otherwise if u want ur owen f4 help .

then declare a method for the event of handle on f4.

refer to class cl_gui_alv_grid for this event and all the methods ucan use for alv grid.

Former Member
0 Kudos

&----


*& Module STATUS_9001 OUTPUT

&----


*PBO of detailed screen.

----


MODULE status_9001 OUTPUT.

SET TITLEBAR '002'.

SET PF-STATUS 'STATUS_9001'.

IF rc IS INITIAL. "reference for container for alv.

*Creating objects for the container and grid.

CREATE OBJECT rc

EXPORTING container_name = 'CONTAINER1'.

CREATE OBJECT rg "ref for grid

EXPORTING i_parent = rc

i_appl_events = C_X.

*Display grid.

rg->set_table_for_first_display( EXPORTING

i_structure_name = 'STRUCT_GRID'

is_layout = ls_layo

it_toolbar_excluding = it_excluded_functions

CHANGING

it_outtab = itab_grid[]

it_fieldcatalog = itab_f[] ).

endif.

ENDMODULE. " STATUS_9001 OUTPUT

&----


*& Module USER_COMMAND_9001 INPUT

&----


*PAI of detailed screen.

----


MODULE user_command_9001 INPUT.

save_ok = ok_code.

CLEAR ok_code.

*If user clicks on save button.

CASE save_ok.

WHEN 'F4'.

IF rg IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

  • ET_EXCLUDING =

  • E_REPID =

  • E_CALLBACK_PROGRAM =

  • E_CALLBACK_ROUTINE =

e_grid = rg.

ENDIF.

IF rg IS NOT INITIAL.

CALL METHOD rg->check_changed_data.

IF itab_grid[] IS NOT INITIAL.

FREE itab_details.

LOOP AT itab_grid.

itab_grid-zfield2 = project.

itab_grid-zfield6 = category.

itab_grid-zfield3 = tic_date.

modify itab_grid[] from itab_grid index sy-tabix.

*Validation of data entered by the user in the grid.

PERFORM validate.

*If user has created child ticket.

if itab_grid-zfield7 is not initial.

itab_details-zproject_code = project.

split itab_grid-zfield1 at c_hyphen into tic_no tic_four.

itab_details-zticket_no = tic_no.

itab_details-zchild_ticket_no = itab_grid-zfield1.

itab_details-zchld_tic_status = itab_grid-zfield4.

append itab_details.

clear itab_details.

endif.

ENDLOOP.

ENDIF.

endif.

ENDMODULE. " USER_COMMAND_9001 INPUT

take this as a sample code i have deleted many lines from this.

there may be many syntax errors in this.

just follow the code for itab_grid[] "table for alv grid.

and rg and rc.

u will definetly get an idea now.