Application Development and Automation 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: 
Read only

Editing functionality in the ALV Grid control

Former Member
0 Likes
898

hi,

This is ram . i made a editing field in the ALV Grid control . for this i made fieldcat-edit for that purticular field in the fieldcatalog . in layout i added p_st_layout-EDIT = 'X'.

p_st_layout-EDIT_MODE = 'X'.

i am able see the changes in the internal table but all fields in the field catalog turn to edit mode. so please help me out in this ..

11 REPLIES 11
Read only

Former Member
0 Likes
858

Instead of using EDIT_MODE use the "EDIT" option in the field catalog for the individual fields.This way you can control the editing at the field level

Read only

Former Member
0 Likes
858

For example :

  • Asset capitalization date

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'AKTIV'.

ls_fieldcat-ref_table = 'ANLA'.

ls_fieldcat-edit = 'X'.

ls_fieldcat-checktable = '!'

APPEND ls_fieldcat TO gt_fieldcat.

Read only

dani_mn
Active Contributor
0 Likes
858

HI,

just use the edit for that field in fieldcatalog.

don't use edit = 'X' for layout it will make the whole grid editiable.

<b>Just use this during field catalog build for specific field

fieldcat-edit = 'X'.

don't use this.

p_st_layout-EDIT = 'X'</b>

Regards,

Read only

Former Member
0 Likes
858

ya fine .how to captue the edited field data in the internal table ...

Read only

Former Member
0 Likes
858
  • The method CHECK_CHANGED_DATA checks all new cells syntactically, raises event DATA_CHANGED and looks then for any entriesin the error protocol. If any exist the parameter e_valid is initial ('X' in the other case).

CALL METHOD gv_grid->check_changed_data

IMPORTING

e_valid = ls_valid.

This will update your internal table with the changed data

Read only

Former Member
0 Likes
858
hi in the usercommand , use this

*Function module to display the ALV report
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    I_CALLBACK_PROGRAM                = W_REPID
    I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND           = <b>'USER_COMMAND'</b>


FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                        P_SELFLD TYPE SLIS_SELFIELD.
CASE P_UCOMM.

 WHEN 'SAVE'.

  Data ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data

 *write ur code here


ENDCASE.
ENDFORM.
Read only

dani_mn
Active Contributor
0 Likes
858

HI,

HI, try the following method in PAI module it will update the internal table with changed data from grid.

MODULE PAI INPUT.
  DATA: l_valid TYPE c.
 
 <b>CALL METHOD grid1->check_changed_data
               IMPORTING e_valid = l_valid.</b>
ENDMODULE.   

If your earliar problem was solved then please assign the points and close this thread.

and open a new thread for new problems.

Regards,

Read only

Former Member
0 Likes
858

DATA: l_valid TYPE c.

CALL METHOD grid1->check_changed_data IMPORTING e_valid = l_valid.

after using this i am getting dump . will i need to pass any value for L_valid

Read only

Former Member
0 Likes
858

add this code

DATA: l_valid TYPE c.

<b>Data grid1 type ref to cl_gui_alv_grid.</b>

CALL METHOD grid1->check_changed_data IMPORTING e_valid = l_valid.

<b>have u tried my previous post , it will work fine</b>

Read only

Former Member
0 Likes
858

hi,

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'LIFNR'.

wa_fieldcat-tabname = 'ITAB'.

wa_fieldcat-edit = 'X'.

APPEND wa_fieldcat TO it_fieldcat.

hope this helps,

do reward if it helps,

priya.

Read only

0 Likes
858

hi priya,

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'LIFNR'.

wa_fieldcat-tabname = 'ITAB'.

wa_fieldcat-edit = 'X'.

APPEND wa_fieldcat TO it_fieldcat.

after editing how to capture the edited field value in the internal table