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

как делать User Exit?


Goto page Previous  1, 2
 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
july7
Старший специалист
Старший специалист



Joined: 10 Oct 2007
Posts: 109
Location: Киров

PostPosted: Thu Dec 13, 2007 5:43 pm    Post subject: Reply with quote

"Фокус" в том, что ваше событие USEREXIT_MOVE_FIELD_TO_VBAK срабатывает несколько раз во время редактирования строк таблицы, поставьте точку останова внутри обработчика и всё будет понятно. Возможно, лучше использовать другое событие, хотя я не знаю Вашей задачи.
Back to top
View user's profile Send private message
cbw07
Старший специалист
Старший специалист



Joined: 30 Nov 2007
Posts: 127

PostPosted: Thu Dec 13, 2007 5:56 pm    Post subject: Reply with quote

да, я знаю про фокус.
А задача такая: при вводе/изменении мат-ла в таблице проверять, что этот материал имеется в таблице MVKE с определенным MVKE-VKORG. И если его нет, то ставить VBAK-FAKSK на этот заказ.

Я пробовал ставить вызов и в USEREXIT_MOVE_FIELD_TO_VBAK, и в USEREXIT_MOVE_FIELD_TO_VBAP. И в обоих сразу.
Back to top
View user's profile Send private message
july7
Старший специалист
Старший специалист



Joined: 10 Oct 2007
Posts: 109
Location: Киров

PostPosted: Thu Dec 13, 2007 6:12 pm    Post subject: Reply with quote

Попробуйте делать проверку при сохранении: USEREXIT_SAVE_DOCUMENT или USEREXIT_SAVE_DOCUMENT_PREPARE. Обратите внимание на поле XVBAP-UPDKZ (если оно содержит D - значит, запись удалена и ее не нужно обрабатывать, I=вставка записи, U=изменение, "пусто" - никаких манипуляций с записью не проводили).
Back to top
View user's profile Send private message
cbw07
Старший специалист
Старший специалист



Joined: 30 Nov 2007
Posts: 127

PostPosted: Thu Dec 13, 2007 6:44 pm    Post subject: Reply with quote

А у вас не найдется какого-нибудь примера?
Back to top
View user's profile Send private message
vga
Мастер
Мастер


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

PostPosted: Thu Dec 13, 2007 10:07 pm    Post subject: Reply with quote

Code:
form userexit_save_document_prepare.
 
  data: lv_flag(1)   type c.
 
* exit if not SAVE
  if sy-ucomm <> 'SICH'.
    leave to screen sy-dynnr.
  endif.
 
* check line items
  clear lv_flag.
  loop at xvbap where updkz <> 'D'.
*   this checks for quantity less than 2
    if xvbap-kwmeng < 2000.
      message i000(fb) with 'text for message'.
      lv_flag = 'X'.
      clear sy-ucomm.
      exit.
    endif.
  endloop.
 
  if lv_flag = 'X'.
    leave to screen sy-dynnr.
  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
Goto page Previous  1, 2
Page 2 of 2

 
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.