Skip to Content
0
Former Member
Feb 12, 2009 at 08:42 AM

Help needed in Form userexit_save_document_prepare include MV45AFZZ

31 Views

Hi Experts,

I need to check the values entered in table control under sales tab in VA01.

If the item category for a material is 'TANN' it should save if not it should not save and display an error message and then it should alow the user to edit the table control values.

how do i achieve it in Form userexit_save_document_prepare include MV45AFZZ.

this is what I have done. kindly check the logic and help me further.

case sy-ucomm.

when 'SICH'.          " On Save action
if vbak-vtweg eq 'HA'.  " Check Distribution channel
  flg_dh = 'X'.         " Sets if DC is 'HA'.
endif.

if flg_dh eq 'X'.
  if vbap-pstyv eq 'TANN'.    " Check item category
    flg_itmc = 'X'.            " Set if item cat is 'TANN'.
  else.
  message 'SO could not be created Please enter brokerage material' type 'E'.
  endif.