SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Updating the Internal Table -After Edit in ALV



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Sep 13, 2008 6:02 pm    Post subject: Updating the Internal Table -After Edit in ALV Reply with quote

Author: Vijay Babu Dudla

Description:

In ALV Editable Grid using the Function module, the Editable content is not Transferred to Internal table. To update the Internal table with Updated content Function modue

GET_GLOBALS_FROM_SLVC_FULLSCR is useful. check the sample code for how to use that Function in the ALV programs.

Sample code.

Code:
REPORT  zalv_edit.
TYPE-POOLS: slis.
DATA: x_fieldcat  TYPE slis_fieldcat_alv,
      it_fieldcat TYPE slis_t_fieldcat_alv.

data: BEGIN OF itab OCCURS 0,
        vbeln LIKE vbak-vbeln,
        posnr LIKE vbap-posnr,
        kwmeng LIKE vbap-kwmeng,
      END OF itab.
SELECT vbeln
       posnr
       kwmeng
  FROM vbap
  UP TO 20 ROWS
  INTO TABLE itab.

x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 1.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'KWMENG'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
x_fieldcat-input = 'X'.
x_fieldcat-edit = 'X'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program       = sy-repid
    i_callback_pf_status_set = 'STATUS'
    i_callback_user_command  = 'USER_COMMAND'
    it_fieldcat              = it_fieldcat
  TABLES
    t_outtab                 = itab
  EXCEPTIONS
    program_error            = 1
    OTHERS                   = 2.
IF sy-subrc NE 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

FORM status USING p_extab TYPE slis_t_extab.
  "Set the Button using the staus
  "Copy the Standard status from the program SAPLKKBL status
  " STANDARD using SE41, and use that here.
  "Pf status
  SET PF-STATUS 'STATUS' EXCLUDING p_extab.
ENDFORM. " STATUS
FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.
  DATA: gd_repid LIKE sy-repid,
        ref_grid TYPE REF TO cl_gui_alv_grid.
  IF ref_grid IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        e_grid = ref_grid.
  ENDIF.
  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->check_changed_data .
  ENDIF.
  CASE r_ucomm.
    WHEN 'SAVE'.
      "Here you will get the data(along with modified rows/data)
      "Filter the modified rows and update to DB using BAPI/BDC
      "Accordingly
  ENDCASE.
  rs_selfield-refresh = 'X'.
ENDFORM. "USER_COMMAND
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.