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

Запрет на изменение части строк в table maintaince



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Andrey
Участник
Участник



Joined: 12 Oct 2007
Posts: 30

PostPosted: Mon Dec 24, 2007 11:53 am    Post subject: Запрет на изменение части строк в table maintaince Reply with quote

Доброе утро!
Стоит задача, в транзакцию ведения пользовательской таблицы sm30 вставить авторизационную проверку, чтобы пользовать мог добавлять, изменять, удалять только записи, в которые он авторизован по полю Company Code. Это возможно?
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 46
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Mon Dec 24, 2007 11:59 am    Post subject: Reply with quote

Можно все эти проверки вписать в PAI-логику сгенерированного экрана. Но нужно понимать, что в случае изменения структуры таблицы и перегенерации ракурса ведения все Ваши "добавления" исчезнут.
Back to top
View user's profile Send private message Blog
vga
Мастер
Мастер


Age: 165
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Mon Dec 24, 2007 12:51 pm    Post subject: Reply with quote

Также можете использовать стандартную возможность Table Maintenance Generator - События
http://help.sap.com/saphelp_470/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm
Тр. SE54
Меню Environment - Events
Создайте обработчики на 3 события.
01 Before saving the data in the database
03 Before deleting the data displayed
05 Creating a new entry

Code:
*"----------------------------------------------------------------------
* Event 1 handler for table ZTABLE
*"----------------------------------------------------------------------
FORM TABLE_EVENT_1.

  CONSTANTS: TEXT1(12) VALUE 'Company Code'.
  DATA: l_tmp(200).
  DATA:  BEGIN OF lt_bukrs OCCURS 0,
           bukrs TYPE t001-bukrs,
         END OF  lt_bukrs.

  TYPES: BEGIN OF tt.
         INCLUDE STRUCTURE ZTABLE.
  TYPES: ACTION TYPE C,
         MARK TYPE C,
         END OF tt.
  DATA: LINE(48).
  DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found

  DATA: l_er  TYPE C.

  field-symbols: <fs> TYPE tt.

  LOOP AT TOTAL INTO LINE.
    ASSIGN LINE TO <fs> CASTING.
    CHECK sy-subrc IS INITIAL.
    CHECK NOT <fs>-ACTION IS INITIAL.

    lt_bukrs-bukrs = <fs>-bukrs.
    AUTHORITY-CHECK OBJECT 'Z_BUKRS'
        ID 'BUKRS' FIELD lt_bukrs-bukrs
        ID 'TCODE' FIELD sy-tcode.

    IF NOT sy-subrc IS INITIAL.
      COLLECT lt_bukrs.
      l_er = 'X'.
      CLEAR <fs>-ACTION.
      MODIFY TOTAL FROM <fs>.
      READ TABLE EXTRACT WITH KEY TOTAL.
      IF SY-SUBRC EQ 0.
        F_INDEX = SY-TABIX.
        MODIFY EXTRACT FROM <fs> INDEX F_INDEX.
      ENDIF.
    ENDIF.

  ENDLOOP.

  IF NOT l_er IS INITIAL.
    LOOP AT lt_bukrs.
      CONCATENATE l_tmp lt_bukrs-bukrs INTO l_tmp SEPARATED BY SPACE.
    ENDLOOP.
    MESSAGE I003(zxxx) WITH TEXT1 l_tmp. "You do not have authorization to & & & &.
    SY-SUBRC = 4.
  ENDIF.

ENDFORM.

*"----------------------------------------------------------------------
* Event 3 handler for table ZTABLE
*"----------------------------------------------------------------------
FORM TABLE_EVENT_3.

  CONSTANTS: TEXT1(12) VALUE 'Company Code'.
  TYPES: BEGIN OF tt.
         INCLUDE STRUCTURE ZTABLE.
  TYPES: ACTION TYPE C,
         MARK TYPE C,
         END OF tt.
  DATA: LINE(48).
  field-symbols: <fs> TYPE tt.

  LOOP AT TOTAL INTO LINE.
    ASSIGN LINE TO <fs> CASTING.
    CHECK sy-subrc IS INITIAL.
    CHECK NOT <fs>-MARK IS INITIAL.
    AUTHORITY-CHECK OBJECT 'Z_BUKRS'
        ID 'BUKRS' FIELD <fs>-bukrs
        ID 'TCODE' FIELD sy-tcode.
    IF NOT sy-subrc IS INITIAL.
      MESSAGE E003(zxxx) WITH TEXT1 <fs>-bukrs.
    ENDIF.
  ENDLOOP.

ENDFORM.

*"----------------------------------------------------------------------
* Event 5 handler for table ZTABLE
*"----------------------------------------------------------------------
FORM TABLE_EVENT_5.
  CONSTANTS: TEXT1(12) VALUE 'Company code'.
  field-symbols: <fs> TYPE ZTABLE.

  ASSIGN <TABLE1> TO <fs>.
  IF sy-subrc IS INITIAL.
    IF <fs>-bukrs IS INITIAL.
      SY-SUBRC = 4.
      MESSAGE E043(zxxx) WITH TEXT1. "Empty & field is forbidden.
    ELSE.
      AUTHORITY-CHECK OBJECT 'Z_BUKRS'
        ID 'BUKRS' FIELD <fs>-bukrs
        ID 'TCODE' FIELD SY-TCODE.
      IF NOT sy-subrc IS INITIAL.
        MESSAGE E003(zxxx) WITH TEXT1 <fs>-bukrs. "You do not have authorization to & & & &.
      ENDIF.
    ENDIF.
  ENDIF.

ENDFORM.
Back to top
View user's profile Send private message Blog Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP 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.