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

Синхронизация данных во внутренней таблице и ALV frontend



 
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: 1640

PostPosted: Wed Oct 31, 2007 10:18 am    Post subject: Синхронизация данных во внутренней таблице и ALV frontend Reply with quote

Чтобы при редактировании данных в ячейке ALV, после нажатия Enter они обновились во внутренней таблице поможет вызов метода
CALL METHOD L_GRID->CHECK_CHANGED_DATA

Code:
TYPE-POOLS: SLIS, KKBLO.

DATA: LT_EVENTS TYPE SLIS_T_EVENT,
      LS_EVENT TYPE SLIS_ALV_EVENT.
DATA: LS_LAYOUT TYPE SLIS_LAYOUT_ALV,
      LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA:   GT_FIELDCATALOG TYPE LVC_T_FCAT,
          IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV,
        PRN LIKE SY-REPID,
        IT LIKE LINE OF IT_FIELDCAT,
        GT LIKE LINE OF GT_FIELDCATALOG.


  CLEAR: LT_EVENTS. REFRESH LT_EVENTS.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE = 1
    IMPORTING
      ET_EVENTS   = LT_EVENTS.

  CLEAR LS_EVENT.
  READ TABLE LT_EVENTS WITH KEY NAME = 'DATA_CHANGED'
       INTO LS_EVENT.
  IF SY-SUBRC = 0.
    DELETE LT_EVENTS WHERE NAME = 'DATA_CHANGED'.
    MOVE 'DATA_CHANGED' TO LS_EVENT-NAME.
    MOVE 'EDITDATA' TO LS_EVENT-FORM.
    APPEND LS_EVENT TO LT_EVENTS.
  ENDIF.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = PRN
      IS_LAYOUT                = LS_LAYOUT
      I_SAVE                   = 'A'
      IT_EVENTS                = LT_EVENTS[]
      IT_FIELDCAT              = IT_FIELDCAT[]
      I_CALLBACK_USER_COMMAND  = 'USCOM'
      I_CALLBACK_PF_STATUS_SET = 'SETPF'
    TABLES
      T_OUTTAB                 = TB.



FORM EDITDATA USING RR_DATA_CHANGED TYPE REF TO
                                          CL_ALV_CHANGED_DATA_PROTOCOL.
* Здесь можно вообще ничего не писать,
* данные всё равно обновятся
ENDFORM.                    "EDITDATA


FORM USCOM USING R_UCOMM     LIKE SY-UCOMM
                        RS_SELFIELD TYPE SLIS_SELFIELD.

  DATA: L_GRID TYPE REF TO CL_GUI_ALV_GRID.

* Это нужно, чтобы данные обновились,
* при нажатию на пользовательскую кнопку

  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      E_GRID = L_GRID.

  CALL METHOD L_GRID->CHECK_CHANGED_DATA.
   RS_SELFIELD-REFRESH = 'X'.
ENDFORM.
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.