ALV Grid Editable - Edit and Save Entries [english]

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ก.ย. 2021
  • In this video I show how to:
    1. create an ALV Grid
    2. make columns and entries editable and
    3. save the changes in the database.
    If you want to know how to add or insert a record in a ALV Grid have a look at this video:
    ➡ • Add, Insert or Copy Ro...
    #alv #editable
    ▬▬ Literature 📚 ▬▬▬▬▬▬▬▬▬▬▬▬▬
    ▶ ABAP: An Introduction 2020 amzn.to/45CLTqk
    ▶ Complete ABAP 2023 amzn.to/45D5UNM
    ▶ ABAP to the Future 2022 amzn.to/42cgWGs
    ▶ Clean ABAP 2022 amzn.to/3KAqmow
    ▬▬ My Hardware 💻 ▬▬▬▬▬▬▬▬▬▬▬▬▬
    ▶ Microphone: amzn.to/3zj2UIz
    ▶ Headphone: amzn.to/3GUBRFg
    ▬▬ My Software (free) 💾 ▬▬▬▬▬▬▬▬▬▬▬
    ▶ Video Recorder: bit.ly/678fgh6
    ▶ Video Editor: bit.ly/38Rj9lb
    ▶ Thumbnail: bit.ly/CustAndCodeThumbnail
    ▶ Gamma AI: bit.ly/3nsdvgr
    ▬▬ Further Links 🔗 ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ⭐Become my subscriber: bit.ly/CustAndCodeSub
    🎬All videos in English: bit.ly/CustAndCodeENG
    ☕Buy me a Coffee 😀: bit.ly/3dih2cl
    *The links are affiliate links. There are no additional costs.

ความคิดเห็น • 78

  • @sankeshankar
    @sankeshankar 9 หลายเดือนก่อน

    As always a great and simple to follow video. Thanks !

    • @CustAndCode
      @CustAndCode  9 หลายเดือนก่อน

      Thank you very much for your feedback! 🤗😀

  • @buchle
    @buchle 2 ปีที่แล้ว +2

    Congrats!!! Great Video!

  • @AdrianGarcia-vn7ye
    @AdrianGarcia-vn7ye ปีที่แล้ว

    Muchas Gracias!!!!! me fue de mucha utilidad, saludos desde México.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Me alegra oírlo. Siempre me sorprende el alcance de mis vídeos. 😀🤗

  • @Jackissimus
    @Jackissimus ปีที่แล้ว

    Sincere thanks for this video.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +1

      Thank you very much for the comment and the nice feedback! 🤗😀

  • @KK-ut7mr
    @KK-ut7mr 6 หลายเดือนก่อน

    THANK YOU SO MUCH !! it's been very helpful to me

    • @CustAndCode
      @CustAndCode  6 หลายเดือนก่อน

      Great to hear! 🤗 you are welcome! 😀

    • @CustAndCode
      @CustAndCode  6 หลายเดือนก่อน

      Great to hear! 🤗 you are welcome! 😀

  • @PraxPMusic
    @PraxPMusic 2 ปีที่แล้ว +1

    Thanx its detailed 👌

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว +2

      Thanks for your feedback! 🤗

  • @mamillaramesh6849
    @mamillaramesh6849 8 หลายเดือนก่อน

    great explination bro....❤

    • @CustAndCode
      @CustAndCode  8 หลายเดือนก่อน

      Thank you very much! 🤗🤩

  • @adityasengupta7868
    @adityasengupta7868 ปีที่แล้ว

    Amazing! Thanks!

  • @VikasKumar-nt1wi
    @VikasKumar-nt1wi ปีที่แล้ว

    Thank you, thank you so much.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      You're very welcome! 🤗😀

  • @jsmichael1251
    @jsmichael1251 2 ปีที่แล้ว

    Thank you 💗 bro😍

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Thanks for your feedback! 😀

  • @tikammolo3052
    @tikammolo3052 ปีที่แล้ว

    Thank you ver much ❤️

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Thank you for your feedback! 🤗

  • @nathanfertipar
    @nathanfertipar 6 หลายเดือนก่อน

    it was amazyn

    • @CustAndCode
      @CustAndCode  6 หลายเดือนก่อน

      Awesome to hear. And thank you for watching! 🤗

  • @duhanferdiansyah5545
    @duhanferdiansyah5545 ปีที่แล้ว

    Many thanks, you've got a new subscriber :D

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      Thank you very much! I am glad! 😀

  • @user-sv9ro1yt5b
    @user-sv9ro1yt5b หลายเดือนก่อน

    Thank you for the video!!!❤
    I have some question, how can I display the Table-Field menu in 05:07?

    • @CustAndCode
      @CustAndCode  หลายเดือนก่อน

      Thank you! 🤗 Press Ctrl + Space 👋

  • @dileepsj1873
    @dileepsj1873 4 หลายเดือนก่อน

    Such a beautifull video ❤ explained veru clearly..i have tried this with marc table by taking matnr,werks,mmsta but f4 help drop down is not coming for mmsta field..can you please explain

    • @CustAndCode
      @CustAndCode  4 หลายเดือนก่อน

      I'm glad you liked it. And thank you for watching! 🤗 Other F4 help is working?

  • @nguyenhieu1249
    @nguyenhieu1249 2 ปีที่แล้ว +5

    Excellent video. Could you do the video using the method cl_gui_alv_grid?

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว +1

      Thank you! Currently I have a few other videos I want to make. But I will have a look at it in the future. 🤗

  • @jv2556
    @jv2556 2 หลายเดือนก่อน

    hello, I'd like to know how to leave editing locked by default, and only enable it if I click a button

    • @CustAndCode
      @CustAndCode  2 หลายเดือนก่อน

      A normal maintenance view is not an option? There you have this functionality. On the other hand you can set the function of editing for every column in the field catalog. 🤗

  • @muhammadfahim2627
    @muhammadfahim2627 ปีที่แล้ว

    Good video. But I am now confused as to which method I should be using for ALV report development. ALV using FM or Class. I opted to learn ALV through class as I thought SAP recommends class method instead of FM. Could you please make a same video using ALV OOPs?

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +2

      To display data in an ALV I always use the SALV_TABLE Class. This case or video is special because we edit some data in the ALV. With the SALV Table is this not possible. That is the difference. Hope that helps. 🤗😀

    • @ITheOfficialChrisI
      @ITheOfficialChrisI ปีที่แล้ว +1

      Even if you edit values in the ALV, I recommend you use the cl_gui_alv_grid class instead of the FM.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@ITheOfficialChrisI Thanks for your input. I will check it asap. 🤗

  • @TheSilverKinogarten
    @TheSilverKinogarten ปีที่แล้ว

    Would this work for salv_alv? To catch event of clicking on a custom added button and make cells editable to be able to edit and save to the database table.
    Sorry if it's a stupid question.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      As far as I know this is not possible with a SALV table. I have found some code on github (extended SALV) but I have never tested this. And hey there are no stupid questions! 🤗😀

    • @TheSilverKinogarten
      @TheSilverKinogarten ปีที่แล้ว

      @@CustAndCode Thanks for the reply. I also know that it is not possible to do what I wanted with the salv. This is what I get for not wanting to use the REUSE haha.
      By the way, you are helping a lot of people with these videos. Keep on doing so and thank you.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@TheSilverKinogarten Thank you very much for the kind feedback. I also hope that the videos will help many people. 🤗😃

  • @dimphorapulane9142
    @dimphorapulane9142 ปีที่แล้ว

    how do you display error messages in alv ( wxception log)

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      I haven't implemented a exception log yet, not for an ALV. 🤔

  • @adrijasamanta7949
    @adrijasamanta7949 4 หลายเดือนก่อน

    Why this select row from report option not coming for me in report unlike yours ?

    • @CustAndCode
      @CustAndCode  4 หลายเดือนก่อน

      Have you set the Layout? Which release do you use? 🤔

  • @jsmichael1251
    @jsmichael1251 2 ปีที่แล้ว +3

    Please upload the code also and give the code link it is very useful for us bro

    • @CustAndCode
      @CustAndCode  2 ปีที่แล้ว +8

      Here you are: 🤗
      REPORT z_alv_edit_save.
      "declaration
      DATA: it_spfli TYPE TABLE OF spfli,
      wa_spfli TYPE spfli.
      DATA: it_spflicp TYPE STANDARD TABLE OF spfli,
      it_changes TYPE STANDARD TABLE OF spfli.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv,
      it_fieldcat TYPE slis_t_fieldcat_alv,
      ls_layout TYPE slis_layout_alv.
      PERFORM get_data.
      "make fieldcat
      DATA: lv_index TYPE int1.
      lv_index = 0.
      wa_fieldcat-fieldname = 'CARRID'.
      wa_fieldcat-seltext_m = 'CarrId'.
      wa_fieldcat-col_pos = lv_index + 1.
      wa_fieldcat-outputlen = 10.
      wa_fieldcat-key = 'X'.
      wa_fieldcat-just = 'L'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'CONNID'.
      wa_fieldcat-seltext_m = 'ConnId'.
      wa_fieldcat-col_pos = lv_index + 1.
      wa_fieldcat-outputlen = 10.
      wa_fieldcat-key = 'X'.
      wa_fieldcat-just = 'C'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'CITYFROM'.
      wa_fieldcat-seltext_m = 'City From'.
      wa_fieldcat-col_pos = lv_index + 1.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-just = 'L'.
      wa_fieldcat-edit = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'CITYTO'.
      wa_fieldcat-seltext_m = 'City To'.
      wa_fieldcat-col_pos = lv_index + 1.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-just = 'L'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      "show ALV Grid
      it_spflicp[] = it_spfli[].
      ls_layout-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      i_callback_program = sy-repid
      i_callback_pf_status_set = 'PF_STATUS_SET'
      i_callback_user_command = 'USER_COMMAND'
      is_layout = ls_layout
      it_fieldcat = it_fieldcat
      TABLES
      t_outtab = it_spfli.
      "Form GUI Status
      FORM pf_status_set USING extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD'.
      ENDFORM.
      "Form SAVE Data
      FORM f_save_data.
      DATA: wa_spflicp TYPE spfli,
      wa_spfli_tmp TYPE spfli.
      CLEAR it_changes[].
      LOOP AT it_spfli INTO wa_spfli.
      READ TABLE it_spflicp INTO wa_spflicp INDEX sy-tabix.
      IF wa_spflicp NE wa_spfli.
      APPEND wa_spfli TO it_changes.
      MOVE-CORRESPONDING wa_spfli TO wa_spfli_tmp.
      MODIFY spfli FROM wa_spfli_tmp.
      ENDIF.
      CLEAR wa_spflicp.
      ENDLOOP.
      ENDFORM.
      "form delete data
      FORM f_delete_data USING wa_spfli TYPE spfli.
      DELETE FROM spfli
      WHERE carrid = wa_spfli-carrid
      AND connid = wa_spfli-connid.
      IF sy-subrc = 0.
      MESSAGE 'Record deleted!' TYPE 'S'.
      ELSE.
      MESSAGE 'There was an error!' TYPE 'E'.
      ENDIF.
      ENDFORM.
      "Form USER_COMMAND
      FORM user_command USING p_ucomm TYPE sy-ucomm
      p_selfield TYPE slis_selfield.
      CASE p_ucomm.
      WHEN '&DATA_SAVE'.
      PERFORM f_save_data.
      WHEN '&DEL'.
      READ TABLE it_spfli INTO wa_spfli INDEX p_selfield-tabindex.
      PERFORM f_delete_data USING wa_spfli.
      PERFORM get_data.
      ENDCASE.
      p_selfield-refresh = 'X'.
      p_selfield-row_stable = 'X'.
      p_selfield-col_stable = 'X'.
      ENDFORM.
      "get data
      FORM get_data.
      SELECT *
      FROM spfli
      INTO TABLE it_spfli.
      ENDFORM.

  • @inhchienthi4430
    @inhchienthi4430 7 หลายเดือนก่อน

    Good morning. I have a problem why does "col_pos = lv_index + 1" match with every column increase for every fieldcat? Thanks!

    • @inhchienthi4430
      @inhchienthi4430 7 หลายเดือนก่อน

      Please help me explain this trick. Thanks!

    • @CustAndCode
      @CustAndCode  7 หลายเดือนก่อน

      I do this because If I add a column in the middle of the fieldcat I have to change all column positions. With this I have nothing to do because the varaible will aleways be increased by 1. 🤗

    • @CustAndCode
      @CustAndCode  7 หลายเดือนก่อน

      @@inhchienthi4430 I already did, it is just a counter variable for the colmun postion. Instead of using 1, 2, 3, 4, 5, .... 😀

    • @inhchienthi4430
      @inhchienthi4430 7 หลายเดือนก่อน

      @@CustAndCode modify to update spfli database, I know this statement. But at the same time, it also updates(save) for ALV table (it_spfli). I don't know why it's made like that

    • @inhchienthi4430
      @inhchienthi4430 7 หลายเดือนก่อน

      @@CustAndCode This problem, according to my way of thinking, is not increasing by 1,2,3... but remains the same 1,1,1...

  • @pallavivaval8536
    @pallavivaval8536 หลายเดือนก่อน

    hello sir can you please tell me what is used of ls_layout and wa_filedcat-key='X'...please tell me..

    • @CustAndCode
      @CustAndCode  หลายเดือนก่อน

      These are my key fields, carrid, connid like in the table itself. 🤗

    • @pallavivaval8536
      @pallavivaval8536 หลายเดือนก่อน

      @@CustAndCode Thank you for your valuable reply but is use of it.. also I want insert record in my user defined table from alv report.which one your video is should I prefer.. please help me Sir..

    • @CustAndCode
      @CustAndCode  หลายเดือนก่อน

      Have a look at this video: th-cam.com/video/mFkPlN-6Uhk/w-d-xo.html 🤗

    • @pallavivaval8536
      @pallavivaval8536 หลายเดือนก่อน

      @@CustAndCode sorry for typing mistake sir.. I would like to say that ls_layout =x why is required and key=x what is used of it .. please let me know

    • @pallavivaval8536
      @pallavivaval8536 หลายเดือนก่อน

      @@CustAndCode thank you so much Sir

  • @gpsyking
    @gpsyking ปีที่แล้ว

    Could you please make a video about GUI Status?

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +1

      The GUI Status is nothing special. I use it always like in this video. I copy a GUI Status from another program to my program and I add or change the button I need. Do you have any special needs? 🤗

    • @gpsyking
      @gpsyking ปีที่แล้ว

      @@CustAndCode oh I see, no I don't need anything special, if you manage just with this I should be fine as well, thank you!

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +1

      @@gpsyking good to hear! 🤗

  • @sarathmohanan8829
    @sarathmohanan8829 11 หลายเดือนก่อน

    Why did you used it_changes?

    • @CustAndCode
      @CustAndCode  11 หลายเดือนก่อน

      In this internal table are the changes of the ALV Grid stored. 🤗

  • @pratyushm5337
    @pratyushm5337 ปีที่แล้ว

    Hey man great tutorial, however I have a few questions - what's the use of wa_header_tmp and it_changes? The append to it_changes and move corresponding to wa_tmp seemed redundant and made the code unnecessarily complicated. I excluded those and still the program worked as intended. Here's the simplified code if anyone is interested.
    FORM F_SAVE_DATA.
    DATA: WA_HEADERCP TYPE zpm_t_marksheeth.
    LOOP AT IT_HEADER INTO WA_HEADER.
    READ TABLE IT_HEADERCP INTO WA_HEADERCP INDEX SY-TABIX.
    IF WA_HEADERCP NE WA_HEADER.
    MODIFY zpm_t_marksheeth FROM WA_HEADER.
    ENDIF.
    CLEAR WA_HEADERCP.
    ENDLOOP.

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว +1

      Hi, thanks for your feedback!
      1: The internal table it_changes is only for better understanding. In the debugger you can see here which entries were changed.
      2: The wa_spfli_tmp can be used to add here the information of user and date. So you know which user has changed the record last.
      Unfortunately, I did not show this in the example.
      If you only want to change entries and it doesn't matter who did it then you can also use your code. 🤗 Thanks!

    • @pratyushm5337
      @pratyushm5337 ปีที่แล้ว

      @@CustAndCode Thanks for the explanation, makes sense. I'm new to SAP, just one month in so just needed to implement the database value changing part. Thanks again for the wonderful guide!

    • @CustAndCode
      @CustAndCode  ปีที่แล้ว

      @@pratyushm5337 Glad to hear that! Thanks and have fun with your future work! 😀