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

Editable ALV and update database

former_member220801
Participant
0 Likes
1,583

I have binded a table to a ALV grid, and copying the code from BCALV_EDIT_02. I can successfully make some of fields editable. But how can I capture the edited field values and use it for updating the database table? Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
754

hi ,

create object of alv .... V_OBJ_ALV

CALL METHOD V_OBJ_ALV->SET_TABLE_FOR_FIRST_DISPLAY.
 EXPORTING
                           I_SAVE                        = 'A'
                          CHANGING
                            IT_OUTTAB                     =                                  " internal table
                            IT_FIELDCATALOG               =                            " field catalog table
       .

after that

method for editable alv....through object

*----------------------------FUNCTION FOR EDITABLE ALV

    CALL METHOD V_OBJ_ALV->REGISTER_EDIT_EVENT
      EXPORTING
        I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
      EXCEPTIONS
        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.

*----


handel the event on the editable alv in secondry list display

CASE sy-ucomm.
 
   WHEN 'OK'.
*------logic to handel the event
 CALL METHOD V_OBJ_ALV->CHECK_CHANGED_DATA.

  CALL METHOD CL_GUI_CFW=>FLUSH.

  CALL METHOD CL_GUI_CFW=>DISPATCH.

* handel the user command for the smartform button in secondlist
    WHEN 'SF'.    "function code for smart form callin button
*--logic to handel the smartform button
     
ENDCASE.

regards

Gaurav

4 REPLIES 4
Read only

Former Member
0 Likes
754

yes..

in PF status you can create a button for your use and use that FCODE in user_command event and update the data base..

Read only

Former Member
0 Likes
755

hi ,

create object of alv .... V_OBJ_ALV

CALL METHOD V_OBJ_ALV->SET_TABLE_FOR_FIRST_DISPLAY.
 EXPORTING
                           I_SAVE                        = 'A'
                          CHANGING
                            IT_OUTTAB                     =                                  " internal table
                            IT_FIELDCATALOG               =                            " field catalog table
       .

after that

method for editable alv....through object

*----------------------------FUNCTION FOR EDITABLE ALV

    CALL METHOD V_OBJ_ALV->REGISTER_EDIT_EVENT
      EXPORTING
        I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
      EXCEPTIONS
        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.

*----


handel the event on the editable alv in secondry list display

CASE sy-ucomm.
 
   WHEN 'OK'.
*------logic to handel the event
 CALL METHOD V_OBJ_ALV->CHECK_CHANGED_DATA.

  CALL METHOD CL_GUI_CFW=>FLUSH.

  CALL METHOD CL_GUI_CFW=>DISPATCH.

* handel the user command for the smartform button in secondlist
    WHEN 'SF'.    "function code for smart form callin button
*--logic to handel the smartform button
     
ENDCASE.

regards

Gaurav

Read only

Former Member
0 Likes
754

HI,

READ TABLE it_item INDEX rs_selfield-tabindex INTO wa_item.

from this code u can get data of the curser and go to the T code by skiping fst screen

Regards

Read only

Former Member
0 Likes
754

Hi,

Use this link and try to read the sample given by me, it will definitely help you as it did help the one in that post.

regards,

Abhijit G. Borkar