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: 

alv

Former Member
0 Kudos
135

ho to all,

help me in this issue,

in alv out put i want two coulmns that end user should edit and keep his changes and this should be updated in the database.how can i do it.

thanks in advance.

kiran kumar

1 ACCEPTED SOLUTION

anversha_s
Active Contributor
0 Kudos
109

hi kiran,

go to se38.

give BCALV* -> press f4.

u will get some programs.

exactly ur requiremenst are added in that programs.

go thru that patientlly.

regards,

anver

if helped mark points

9 REPLIES 9

anversha_s
Active Contributor
0 Kudos
110

hi kiran,

go to se38.

give BCALV* -> press f4.

u will get some programs.

exactly ur requiremenst are added in that programs.

go thru that patientlly.

regards,

anver

if helped mark points

Former Member
0 Kudos
109

Hi Kiran Kumar,

Set Layout-Edit = 'X'. and also if you need to set for particular column then in FieldCatalog set fcat-edit = 'X' for that particular field that needs edit operation.

Hope this would have helped you.

Thanks,

Prashanth

Former Member
0 Kudos
109

hi Kiran,

Work out in a similar way ..

Regards,

Santosh

Former Member
0 Kudos
109

Hello,

While creating the field catalog there is one property called EDIT. So fill that property as X.

if ls_fcat-fieldname EQ 'XXX'.

ls_fcat-EDIT = 'X'.

endif.

Now press the save button, so in PAI u can handel the user command and according to the internal table u can do the update in database.

Regs,

Venkat Ramanan N

former_member181962
Active Contributor
0 Kudos
109

For the field which you want to make input enabled, make the fieldcatalog setting for editability edit = 'X'.

fldcat-edit = 'X'.

and then follow this logic:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

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

modify ztable from table itab.

endcase.

ENDFORM.

0 Kudos
109

REFER STANDERED PROGRAM

<b>BCALV_EDIT_04</b>

dani_mn
Active Contributor
0 Kudos
109

HI,

check the program doing the same.

REPORT Z_ALV_EDITABLE .

TYPE-POOLS: slis.

TABLES: CSKT .

DATA: itab like CSKT occurs 0 with header line.
data v_repid like sy-repid.
data: gs_layout type slis_layout_alv,
      olen TYPE i.
data itab_c type slis_fieldcat_alv occurs 0 with header line.


start-of-selection.

  v_repid = sy-repid.


  SELECT * FROM CSKT INTO TABLE itab.


  perform field_catalog.

  call function 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program      = v_repid
            i_callback_user_command = 'USER_COMMAND'
            it_fieldcat             = ITAB_C[]
            is_layout               = gs_layout
       TABLES
            t_outtab                = itab.


*

  " USER_COMMAND_1000  INPUT

*---------------------------------------------------------------------*
*       FORM field_catalog                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  FIELDCAT                                                      *
*---------------------------------------------------------------------*
form field_catalog.

  itab_c-col_pos      = 1.

  itab_c-fieldname    = 'SPRAS'.
  itab_c-tabname      = 'ITAB'.
  describe field itab-SPRAS output-length  olen.
  itab_c-seltext_l  = 'SPRAS'.
  append itab_c.
  clear itab_c.
*------------------------------------
  itab_c-col_pos      = 2.

  itab_c-fieldname    = 'KOKRS'.
  itab_c-tabname      = 'ITAB'.
  describe field ITAB-KOKRS output-length  olen.
  itab_c-seltext_l  = 'Kokrs'.
  append itab_c.
  clear itab_c.

*------------------------------------
  itab_c-col_pos      = 3.
  itab_c-fieldname    = 'KOSTL'.
  itab_c-tabname      = 'ITAB'.


  describe field ITAB-KOSTL output-length  olen.
  itab_c-seltext_l  = 'Kostl'.

  append itab_c.
  clear itab_c.

*------------------------------------
  itab_c-col_pos      = 4.

  itab_c-fieldname    = 'DATBI'.
  itab_c-tabname      = 'ITAB'.


  describe field ITAB-DATBI output-length  olen.
  itab_c-seltext_l  = 'Datbi'.
  append itab_c.
  clear itab_c.

*------------------------------------
  itab_c-col_pos      = 5.

  itab_c-fieldname    = 'KTEXT'.
  itab_c-tabname      = 'ITAB'.
<b>   itab_c-edit = 'X'.</b>
  describe field ITAB-KTEXT output-length  olen.
  itab_c-seltext_l  = 'Ktext'.
  append itab_c.
  clear itab_c.

*------------------------------------
  itab_c-col_pos      = 6.

  itab_c-fieldname    = 'LTEXT'.
<b>  itab_c-tabname      = 'ITAB'.
   itab_c-edit = 'X'.</b>
  describe field ITAB-LTEXT output-length  olen.
  itab_c-seltext_l  = 'Ltext'.
  append itab_c.
  clear itab_c.

*------------------------------------
  itab_c-col_pos      = 7.

  itab_c-fieldname    = 'MCTXT'.
  itab_c-tabname      = 'ITAB'.
  describe field ITAB-MCTXT output-length  olen.
  itab_c-seltext_l  = 'Mctxt'.
  append itab_c.
  clear itab_c.

endform.                    " field_catalog

*---------------------------------------------------------------------*
*       FORM user_command                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  R_UCOMM                                                       *
*  -->  RS_SELFIELD                                                   *
*---------------------------------------------------------------------*
form user_command using r_ucomm type sy-ucomm
                        rs_selfield type slis_selfield.
  if r_ucomm = '&DATA_SAVE'.

    message i000(SU) with 'saved'.

    MODIFY CSKT FROM TABLE itab.

    call function 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
              it_fieldcat = it_fieldcat[]
         TABLES
              t_outtab    = itab.
  endif.
endform.
*&---------------------------------------------------------------------*
*&      Form  field_catalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM field_catalog.

  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_program_name     = v_repid
            i_internal_tabname = 'ITAB'
            i_inclname         = v_repid
       CHANGING
            ct_fieldcat        = it_fieldcat[].


ENDFORM.                    " field_catalog

REgards,

Message was edited by: HRA

Former Member
0 Kudos
109

hi hra,

does i need to design screens to get my editable mode and saving.

dani_mn
Active Contributor
0 Kudos
109

HI Kiran,

no you don't need to design screens. because we are using FM approch. if we use Object oriented approch then we need to create screen.

Just copy and paste the above program to test the functinality it is changing in the text of cost center master table record.

this line is important.

<b> itab_c-edit = 'X'.</b>

Regards,