MV45AFZB

<< Click to Display Table of Contents >>

Navigation:  All About ABAP Technique > Indonesia > ABAP Tutorial > ABAP Workbench Tools  > User Exits > Contoh User Exits >

MV45AFZB

***INCLUDE MV45AFZB .
 
************************************************************************
*                                                                      *
* This include is reserved for user modifications                      *
*                                                                      *
* Forms for sales document processing                                  *
*                                                                      *
* The name of modification modules should begin with 'ZZ'.             *
*                                                                      *
************************************************************************
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHECK_XVBAP_FOR_DELET
*&---------------------------------------------------------------------*
*                                                                     *
*       Additional examination can be entered in this form, before    *
*       the position is released for deletion.                        *
*                                                                     *
*       US_ERROR  - Flag that controls displaying messages            *
*       US_EXIT   - If this flag is set, an item is not allowed       *
*                   to be deleted                                     *
*                                                                     *
*       This form is called from form XVBAP_LOESCHEN_PRUEFEN.         *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_XVBAP_FOR_DELET USING US_ERROR
                                         US_EXIT.
 
* Example
 
* IF US_ERROR NE SPACE.
*   MESSAGE ......
* ENDIF.
 
* IF .......
*   US_EXIT = CHARX.
* ENDIF.
*{   INSERT         WDVK900922                                        1
 
**** Free Goods Item tidak boleh dihapus manually.
IF SY-UCOMM = 'YES'.
  IF XVBAP-VWPOS = 'FREE' and VBAP-UEPOS is not initial.
     US_EXIT = CHARX.
    message w905.
  ELSE.
    DATA: lv_redetermine type c.
    lv_redetermine = 'X'.
    export lv_redetermine to memory id 'ZFG_RECALCULATE_FREEGOODS'.
 
  ENDIF.
ENDIF.
*
*}   INSERT
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHECK_XVBEP_FOR_DELET
*&---------------------------------------------------------------------*
*                                                                     *
*       Additional examination can be entered in this form, before    *
*       the schedule line is released for deletion.                   *
*                                                                     *
*       US_EXIT   - If this flag is set, an item is not allowed       *
*                   to be deleted                                     *
*                                                                     *
*       This form is called from form XVBEP_LOESCHEN_PRUEFEN          *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_XVBEP_FOR_DELET USING US_EXIT.
 
* Example
 
* IF .......
*   US_EXIT = CHARX.
* ENDIF.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHECK_VBAK
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to add additional logic for         *
*       checking the header for completeness and consistency.         *
*                                                                     *
*       US_DIALOG  -  Indicator, that can be used to suppress         *
*                     dialogs in certain routines, e.g. in a          *
*                     copy routine.                                   *
*                                                                     *
*       This form is called from form VBAK_PRUEFEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_VBAK USING US_DIALOG.
*{   INSERT         WDVK900010                                        1
**** Check whether sales employee has been entered
data: xpernr like xvbpa-pernr.
xpernr = 0.
loop at xvbpa where parvw = 'VE'.
  xpernr = xvbpa-pernr.
endloop.
****>>>>error<<<*******
if xpernr is initial and sy-tcode = 'VA01'.
    MESSAGE E901.
endif.
 
xpernr = 0.
loop at xvbpa where parvw = 'KB'.
  xpernr = xvbpa-pernr.
endloop.
****>>>>warning<<<*******
if xpernr is initial and sy-tcode = 'VA01'.
    MESSAGE W915 with VBAK-KUNNR.
endif.
****
 
*** Check NPWP and PKP code in customer master (BP).
tables: kna1vv.
 
loop at xvbpa where parvw = 'RE'.
  select single * from kna1vv where kunnr = xvbpa-kunnr
                              and vkorg = vbak-vkorg
                              and vtweg = vbak-vtweg.
  if sy-subrc = 0.
    move kna1vv-konda to vbkd-konda.
    if vbkd-konda ne '02' and kna1vv-stceg is initial.
        message e904.
    endif.
  endif.
 
endloop.
*}   INSERT
*{   INSERT         WDVK902433                                        2
**** Check authority based on sales office  *****
*
data: gw_actvt(2).
 
IF SY-TCODE = 'VA01'.
 gw_actvt = '01'.
ELSEIF SY-TCODE = 'VA02'.
 gw_actvt = '02'.
ENDIF.
IF gw_actvt is initial.
 gw_actvt = '03'.
ENDIF.
 
AUTHORITY-CHECK OBJECT 'Z_VKBUR'
        ID 'VKBUR' FIELD VBAK-VKBUR
        ID 'ACTVT' FIELD gw_actvt.
 
 
IF SY-SUBRC ne 0.
    message e907 with VBAK-VKBUR VBAK-AUART.
ENDIF.
 
*AUTHORITY-CHECK OBJECT 'Z_VKB_AAT'
*         ID 'VKBUR' FIELD VBAK-VKBUR
*         ID 'AUART' FIELD VBAK-AUART
*         ID 'ACTVT' FIELD gw_actvt.
*
*
*  IF SY-SUBRC ne 0.
*     message e907 with VBAK-VKBUR VBAK-AUART.
*  ENDIF.
 
*
*}   INSERT
*{   INSERT         WDVK902468                                        3
**** Check CO-PA Derivation Rules *****
Tables: K9RWDV1000006, K9RWDV1000005.
**>> Determine ASM
select single * from K9RWDV1000006
    where SOUR1_FROM le VBAK-VKGRP
      and SOUR1_TO   ge VBAK-VKGRP
      and SOUR2_FROM le VBAK-VKBUR
      and SOUR2_TO   ge VBAK-VKBUR
      and SOUR3_FROM le VBAK-SPART
      and SOUR3_TO   ge VBAK-SPART
      and DELETE_FLG = space.
if sy-subrc ne 0.
    message e908 with VBAK-VKGRP VBAK-VKBUR VBAK-SPART.
else.
  select single * from K9RWDV1000005
    where SOUR1_FROM le K9RWDV1000006-TARGET1
      and SOUR1_TO   ge K9RWDV1000006-TARGET1
      and DELETE_FLG = space.
  if sy-subrc ne 0.
    message e909 with K9RWDV1000006-TARGET1.
  endif.
endif.
 
**>> Determine RSM
 
 
 
*}   INSERT
 
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHECK_VBAP
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to add addtional logic for          *
*       checking the position for completeness and consistency.       *
*                                                                     *
*       US_DIALOG  -  Indicator, that can be used to suppress         *
*                     dialogs in certain routines, e.g. in            *
*                     copy mode.                                      *
*                                                                     *
*       This form is called from form VBAP_PRUEFEN_ENDE.              *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_VBAP USING US_DIALOG.
 
*{   INSERT         WDVK900168                                        1
**** Check Item division for Building Material
if vbak-vkorg = 'A202' and vbak-spart ne vbap-spart.
message e370 with vbak-spart vbap-spart.
endif.
*VVBAP-KWMENG
*
*}   INSERT
*{   INSERT         WDVK900446                                        3
***** Check double entry on items
IF vbak-vtweg ne '07' and vbap-uepos is initial.
Loop at xvbap where matnr = vbap-matnr
                and UPDKZ <> 'D'
                and posnr ne vbap-posnr
                and uepos is initial.
  if xvbap-vrkme = vbap-vrkme.
    message w903 with xvbap-posnr.
  endif.
endloop.
ENDIF.
 
*****
*}   INSERT
*{   INSERT         WDVK900964                                        4
*
**** IF Order Qty = 0, error message
IF VBAP-KWMENG = 0 and VBAP-LFREL = 'X'.
  MESSAGE E906.
ENDIF.
 
*}   INSERT
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHECK_VBKD
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to add additional logic for         *
*       checking the sales details for completeness and consistency.  *
*                                                                     *
*       US_DIALOG  -  Indicator, that can be used to suppress         *
*                     dialogs in certain routines, e.g. in a          *
*                     copy routine.                                   *
*                                                                     *
*       This form is called from form VBKD_PRUEFEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_VBKD USING US_DIALOG.
 
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CHECK_VBEP
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to add additional logic for         *
*       checking the schedule lines for completeness and consistency. *
*                                                                     *
*       US_DIALOG  -  Indicator, that can be used to suppress         *
*                     dialogs in certain routines, e.g. in a          *
*                     copy routine.                                   *
*                                                                     *
*       This form is called from form VBEP_PRUEFEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_VBEP USING US_DIALOG.
 
 
ENDFORM.
*eject
 
*---------------------------------------------------------------------*
*      Form  USEREXIT_CHECK_VBSN
*---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to add additional logic for         *
*       checking the serial numbers for completeness and consistency. *
*                                                                     *
*       US_DIALOG  -  Indicator, that can be used to suppress         *
*                     dialogs in certain routines, e.g. in a          *
*                     copy routine.                                   *
*                                                                     *
*       This form is called from form VBSN_PRUEFEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_VBSN USING US_DIALOG.
 
 
ENDFORM.
*eject
 
*---------------------------------------------------------------------*
*      Form  USEREXIT_CHECK_XVBSN_FOR_DELET
*---------------------------------------------------------------------*
*                                                                     *
*       Additional examination can be entered in this form, before    *
*       the serial number is released for deletion.                   *
*                                                                     *
*       US_EXIT   - If this flag is set, an item is not allowed       *
*                   to be deleted                                     *
*                                                                     *
*       This form is called from form XVBSN_LOESCHEN_PRUEFEN          *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CHECK_XVBSN_FOR_DELET USING US_EXIT.
 
* Example
 
* IF .......
*   US_EXIT = CHARX.
* ENDIF.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_FILL_VBAP_FROM_HVBAP
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to fill addtional data into VBAP    *
*       from the main item (HVBAP), i.e. this Userexit is called      *
*       when an item is entered with reference to a main item.        *
*                                                                     *
*       This form is called from form VBAP_FUELLEN_HVBAP.             *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_FILL_VBAP_FROM_HVBAP.
 
* VBAP-zzfield = HVBAP-zzfield2.
*{   INSERT         WDVK906693                                        1
*** free goods get storage location from high level item
IF VBAP-WERKS = '2012' and HVBAP-LGORT is not initial.
  IF VBAP-MATKL cp '04*' and VBAP-UEPVW = 'C'.
     VBAP-LGORT = HVBAP-LGORT.
  ENDIF.
ENDIF.
*}   INSERT
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_TVCOM_H
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to fill addtional data into TVCOM   *
*                                                                     *
*       E.g. the fields of the following workareas can be moved to    *
*            table TVCOM: VBAK                                        *
*                         VBKD                                        *
*                         ...                                         *
*                                                                     *
*       This form is called from form VBAK_FUELLEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_TVCOM_H.
 
* Examples:
* TVCOM-zzfield = VBAK-zzfield2.
* TVCOM-zzfield = VBKD-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_TVCOM_I
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to fill additional data into TVCOM  *
*                                                                     *
*       E.g. the fields of the following workareas can be moved to    *
*            table TVCOM: VBAP                                        *
*                         VBKD                                        *
*                         ...                                         *
*                                                                     *
*       This form is called from form VBAP_FUELLEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_TVCOM_I.
 
* Examples:
* TVCOM-zzfield = VBAP-zzfield2.
* TVCOM-zzfield = VBKD-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_COBL
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to fill addtional data into         *
*       table account assignment COBL.                                *
*                                                                     *
*       US_VBAK  - Workarea VBAK                                      *
*       US_VBAP  - Workarea VBAP                                      *
*       CH_COBL  - Workarea COBL                                      *
*                                                                     *
*       This form is called from form COBL_FUELLEN.                   *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_COBL USING US_VBAK STRUCTURE VBAK
                                      US_VBAP STRUCTURE VBAP
                            CHANGING CH_COBL STRUCTURE COBL.
 
* Examples
* CH_COBL-zzfield = US_VBAK-zzfield2.
* CH_COBL-zzfield = US_VBAP-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_COBL_RECEIVE_VBAK
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to move data from table COBL        *
*       to table VBAK.                                                *
*                                                                     *
*       This form is called from form COBL_RECEIVE_VBAK.              *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_COBL_RECEIVE_VBAK.
 
* VBAK-zzfield = COBL-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_COBL_RECEIVE_VBAP
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to move data from table COBL        *
*       to table VBAP.                                                *
*                                                                     *
*       This form is called from form COBL_RECEIVE_VBAP.              *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_COBL_RECEIVE_VBAP.
 
* VBAP-zzfield = COBL-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_COBL_SEND_ITEM
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to move data to the communication-  *
*       table INT_COBLF that is used in the function COBL_SEND_PBO.   *
*                                                                     *
*       This form is called from form COBL_SEND_PBO_VBAP.             *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_COBL_SEND_ITEM.
 
*  This example shows how to select fields that are shown in the
*  account assignment block
 
*  INT_COBLF-FDNAM = zzfield1.
*  INT_COBLF-OUTPUT = '1'.
*  IF T180-TRTYP NE CHARA AND
*     VBAP-KZVBR NE KZVBR_P.
*    INT_COBLF-INPUT    = '1'.
*    INT_COBLF-REQUIRED = '1'.
*  ENDIF.
*  INT_COBLF-ACTIVE = '1'.
*  APPEND INT_COBLF.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_COBL_SEND_HEADER
*&---------------------------------------------------------------------*
*                                                                     *
*       This Userexit can be used to move data to the communication-  *
*       table INT_COBLF that is used in the function COBL_SEND_PBO.   *
*                                                                     *
*       This form is called from form COBL_SEND_PBO_VBAK.             *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_COBL_SEND_HEADER.
 
*  This example shows how to select fields that are shown in the
*  account assignment block
 
*  INT_COBLF-FDNAM = zzfield1.
*  INT_COBLF-OUTPUT = '1'.
*  IF T180-TRTYP NE CHARA AND
*     VBAP-KZVBR NE KZVBR_P.
*    INT_COBLF-INPUT    = '1'.
*    INT_COBLF-REQUIRED = '1'.
*  ENDIF.
*  INT_COBLF-ACTIVE = '1'.
*  APPEND INT_COBLF.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_SOURCE_DETERMINATION
*&---------------------------------------------------------------------*
*       This Userexit is used to add additional logic for finding      *
*       the source of the plant or the item category.                  *
*                                                                      *
*       This form is called from form VBAP_FUELLEN                     *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_SOURCE_DETERMINATION.
 
* set source
* VBAP-WERKS          = zzfield1.
 
* set item category
* VBAP-PSTYV          = zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_ME_REQ
*&---------------------------------------------------------------------*
*       This Userexit can be used to move additional data to the       *
*       requisition-table EBAN or to the account-assignment-table      *
*       for requisitions EBKN.                                         *
*                                                                      *
*       This form is called from form EBAN_FUELLEN                     *
*                                     BESCHAFFUNG_FUELLEN              *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_ME_REQ.
 
* Example
* EBAN-LIFNR = zzfield1.
* EBKN-KOSTL = zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_GET_FIELD_TO_SDCOM
*&---------------------------------------------------------------------*
*       This userexit can be used to get additional fields from the    *
*       communication structure between sales order and variant        *
*       configuration.                                                 *
*                                                                      *
*       Fields included in structure SDCOM can be used for further     *
*       processing in the sales order.                                 *
*                                                                      *
*       This form is called from CONFIGURATION_PROCESSING              *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_GET_FIELD_FROM_SDCOM USING SDCOM STRUCTURE SDCOM.
 
* Example
 
*  US_zzfield = SDCOM-zzfield.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_WORKAREA_TO_SDWA
*&---------------------------------------------------------------------*
*       This userexit can be used to move additional work areas to     *
*       the communication table between sales order and variant        *
*       configuration.                                                 *
*                                                                      *
*       Work areas included in table SDWA can be used read only !      *
*       The cannot be changed during the configuration process and     *
*       are not passed back to the sales order.                        *
*                                                                      *
*       This form is called from CONFIGURATION_PROCESSING              *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_MOVE_WORKAREA_TO_SDWA.
 
* Example
 
* sdwa-tname = 'ZZZZZZZZZZ'.
* sdwa-table = ZZZZZZZZZZ.   append sdwa.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_VBAKKOM
*&---------------------------------------------------------------------*
*       This userexit can be used to move additional fields into the   *
*       sales document header workarea VBAK                            *
*                                                                      *
*       This form is called at the end of form VBAK_FUELLEN_VBAKKOM.   *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_VBAKKOM.
 
*  VBAK-zzfield = US_VBAKKOM-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_VBAPKOM
*&---------------------------------------------------------------------*
*       This userexit can be used to move additional fields into the   *
*       sales document line workarea VBAP                              *
*                                                                      *
*       This form is called at the end of form VBAP_FUELLEN_VBAPKOM.   *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_VBAPKOM.
 
*  VBAP-zzfield = US_VBAPKOM-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_MOVE_FIELD_TO_VBEPKOM
*&---------------------------------------------------------------------*
*       This userexit can be used to move additional fields into the   *
*       sales document schedule line workarea VBEP                     *
*                                                                      *
*       SVBEP-TABIX = 0:  Create schedule line                         *
*       SVBEP-TABIX > 0:  Change schedule line                         *
*                                                                      *
*       This form is called at the end of form VBEP_FUELLEN_VBEPKOM.   *
*                                                                      *
*----------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_VBEPKOM.
 
*  VBEP-zzfield = US_VBEPKOM-zzfield2.
 
ENDFORM.
*eject
 
*---------------------------------------------------------------------*
*       FORM USEREXIT_MOVE_FIELD_TO_VBSN                              *
*---------------------------------------------------------------------*
*       This userexit can be used to move some fields into the sales  *
*       document workarea VBSN.                                       *
*                                                                     *
*       SVBAK-TABIX = 0:  Create data                                 *
*       SVBAK-TABIX > 0:  Change data                                 *
*                                                                     *
*       This form is called at the end of form VBSN_FUELLEN.          *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_VBSN.
 
*  vbsn-zzfield = xxxx-zzfield2.
 
ENDFORM.
*eject
 
*---------------------------------------------------------------------*
*       FORM USEREXIT_MOVE_FIELD_TO_KOMKH                             *
*---------------------------------------------------------------------*
*       This userexit can be used to move some fields into the        *
*       communication workarea for the batch determination.           *
*                                                                     *
*       This form is called from form KOMKH_KOMPH_FUELLEN.            *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_KOMKH.
 
*  KOMKH-zzfield = xxxx-zzfield2.
 
ENDFORM.
*eject
 
*---------------------------------------------------------------------*
*       FORM USEREXIT_MOVE_FIELD_TO_KOMPH                             *
*---------------------------------------------------------------------*
*       This userexit can be used to move some fields into the        *
*       communication workarea for the batch determination            *
*                                                                     *
*       This form is called from form KOMKH_KOMPH_FUELLEN.            *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_MOVE_FIELD_TO_KOMPH.
 
*  KOMPH-zzfield = xxxx-zzfield2.
 
ENDFORM.
*eject
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_CUST_MATERIAL_READ
*&---------------------------------------------------------------------*
*       This userexit can be used to read a different customer-       *
*       material-record.                                              *
*                                                                     *
*       US_KUNNR  - customer number that can be set in order to read  *
*                   a different customer-material-record.             *
*                                                                     *
*       This form is called from form RV_CUSTOMER_MATERIAL_READ.      *
*                                                                     *
*---------------------------------------------------------------------*
FORM USEREXIT_CUST_MATERIAL_READ USING US_KUNNR.
 
* US_KUNNR = xxxx-zzfield1.
*{   INSERT         WDVK900010                                        1
**** get customer material info from customer hierarchy
loop at xvbpa where parvw = '1A'.
  US_KUNNR = xvbpa-kunnr.
endloop.
*
*}   INSERT
 
ENDFORM.
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_NEW_PRICING_VBAP
*&---------------------------------------------------------------------*
*       This userexit can be used to perform new pricing, dependant   *
*       on the change of datafields.                                  *
*       This routine is not called, when the material number has been *
*       changed.                                                      *
*       Available data-fields:                                        *
*         vbak - header data                                          *
*         vbap - item data     (changed)                              *
*         *vbap - item data (old, before the change)                  *
*                                                                     *
*       Parameter new_pricing controls the new pricing in the calling *
*       form. It can be filled according the the allowed values       *
*       of domain KNPRS (Pricing type), for example:                  *
*       ' ' = no new pricing                                          *
*       B   = Carry out new pricing                                   *
*       C   = Copy manual pricing elements and redetermine the others
*---------------------------------------------------------------------*
FORM USEREXIT_NEW_PRICING_VBAP CHANGING NEW_PRICING.
 
* Example: new pricing, when field 'Route' is changed
* if vbap-route ne *vbap-route.
*   new_pricing = 'B'.
* endif.
*{   INSERT         WDVK900886                                        1
**** Do not allow qty changes if delivery exist for local only
if vbak-vtweg ne '07' and vbak-vbtyp = 'C'.
  if vbup-lfsta > 'A'.
    if *vbap-kwmeng lt vbap-kwmeng
      or *VBAP-VRKME <> VBAP-VRKME.
        message e902.
    endif.
  endif.
endif.
*
*}   INSERT
 
ENDFORM.
 
*&---------------------------------------------------------------------*
*&      Form  USEREXIT_NEW_PRICING_VBKD
*&---------------------------------------------------------------------*
*       This userexit can be used to perform new pricing, dependant   *
*       on the change of datafields                                   *
*                                                                     *
*       Available data-fields:                                        *
*         vbak - header data                                          *
*         vbkd - business data (changed)                              *
*         *vbkd - business data (old, before the change)              *
*                                                                     *
*       Field vbkd-posnr is the item-number of the business data.     *
*       If the field is initial, then vbkd contains the business      *
*       header data.                                                  *
*                                                                     *
*       Parameter new_pricing controls the new pricing in the calling *
*       form. It can be filled according the the allowed values       *
*       of domain KNPRS (Pricing type), for example:                  *
*       ' ' = no new pricing                                          *
*       B   = Carry out new pricing                                   *
*       C   = Copy manual pricing elements and redetermine the others
*---------------------------------------------------------------------*
FORM USEREXIT_NEW_PRICING_VBKD CHANGING NEW_PRICING.
 
* Example: new pricing, when Price list type is changed
* if vbkd-pltyp ne *vbkd-pltyp.
*   new_pricing = 'B'.
* endif.
*{   INSERT         WDVK900010                                        1
*** determine new pricing if PO number changed
 
if vbak-auart NP 'ZEX*'.
  if vbkd-bstkd ne *vbkd-bstkd
            and vbak-vbtyp = 'C'
            and vbap-vgbel is initial.
    new_pricing = 'C'.
  endif.
endif.
 
*}   INSERT
 
ENDFORM.
*{   INSERT         WDVK900922                                        1
*
*}   INSERT