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

Normal ALV grid

Former Member
0 Likes
851

Hello,

I am editing a field in alv grid but I am not able to save.

I am using normal ALV and not OOALV.

I am able to get the row which I am edit but how do i get modified cell.

7 REPLIES 7
Read only

Former Member
0 Likes
816

Hi Dear,

have you mentioned the key word EDIT for fieldcat.

thanks,

kat.

Read only

0 Likes
816

I can edit alv grid but cannot save the data.

I am not programming in oo.

Read only

0 Likes
816

On the ALV Grid Tool Bar You will have a refresh Button.The data will be save when that Button is clicked.

The Function Code for Refresh Button Is %REFRESH.

Regards,

Gurpreet

Read only

0 Likes
816

Ya Gurpreet I tried the refresh button top-left corner. The grid is getting refresh but data is not getting stored in database.

Read only

sarbajitm
Contributor
0 Likes
816

Hi try to get the concept from the below code snippet. keep a checkbox in your final itab that you want to show using ALV.then mark the checkbox for the line you want to edit a field.


WHEN '&ZXZ'.
      CLEAR l_cntr.
      CLEAR WA_final.
      LOOP AT IT_final INTO WA_final.
        IF WA_final-chk = 'X'.
          l_cntr = l_cntr + 1.
        ENDIF.
      ENDLOOP.
      IF l_cntr GT 1.
        MESSAGE i011.
      ELSEIF l_cntr = 1.

        READ TABLE IT_final INTO WA_final WITH KEY chk = 'X'.
        CALL FUNCTION 'POPUP_TO_GET_VALUE'
          EXPORTING
           fieldname                 = 'MENGE'
            tabname                  = 'EKPO'
            titel                    = 'PO Quan.'
            valuein                  = WA_final-menge
          IMPORTING
*           ANSWER                    =
           valueout                  = l_out_string
         EXCEPTIONS
           fieldname_not_found       = 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.

        CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
          l_out_final = l_out_string.
        ENDCATCH.
        IF sy-subrc = 1.
          MESSAGE i012 DISPLAY LIKE 'E'.
        ELSE.
          WA_final-menge = l_out_final.
          MODIFY IT_final FROM WA_final TRANSPORTING menge
          WHERE chk = 'X'.
          CLEAR WA_final.
          PERFORM disp_alv.
        ENDIF.
      ELSE.
        MESSAGE i010.
      ENDIF.

I have kept this code snippet for the subroutine used corresponding to the pf-status.

Regards.

Sarbajit

Read only

Former Member
0 Likes
816

But I want to fetch data from alv grid and not from a popup screen

Read only

0 Likes
816

Hi at first you display your ALV............ok.Then you select a row and click the button that you created on toolbar..ok?Then the popup will come with the value that you want to change.then you change the value and when submit, it update the internal table. My logic in the above code snippet is something like that.

Regards.

Sarbajit.