SAP4TECH

SAP and ABAP Free Tutorials
Menu
  • SAP Technical
    • ABAP Code Snippets
    • ABAP WebDynPro
    • SAP GW
    • SAP IDOC (ALE)
    • SAP PI (XI)
    • SAP Screen Personas
    • SAP Workflow
  • SAP Functional
    • SAP FI
    • SAP FSCM
    • SAP HR
    • SAP SD & SAP MM
    • SAP PM
    • SAP PP
    • SAP PS
    • SAP QM
    • SAP VIM
    • SAP WM
  • SAP Fiori
  • SAP HANA
  • SAP BW
  • SAP CRM
  • SAP SRM
  • SAP4TECH
    • About Us
    • Contact Us
    • Terms & Conditions
    • Privacy and Cookie Policy

SAP4TECH » SAP Batch Management: User-exits and BAdIs

SAP SD & SAP MM

SAP Batch Management: User-exits and BAdIs

June 17, 2017 John

In this article, we will discuss in detail the different methods to enhance the standard process in SAP Batch Management.

The list of SAP Batch Exit and BAdIs will be classified by Business functionalities:

Batch Master, Batch Classification, Batch Numbering, Internal and external, Batch Status, SLED Management, Batch Information Cockpit Exit, Derivation and Batch Determination User-Exit and BAdI’s.

Table of Contents

  • SAP Batch Master User-Exists and BAdIs
    • BAdI BATCH_MASTER
    • EXIT_SAPLV01Z_013
    • EXIT_SAPMM07M_003
  • Batch Classification
    • EXIT_SAPLV01Z_012
    • EXIT_SAPLV01Z_014
    • EXIT_SAPMM07M_004
  • Batch Numbering – Internal
    • EXIT_SAPLV01Z_001
    • EXIT_SAPLV01Z_002
    • EXIT_SAPMM07M_010
  • Batch numbering – External
    • EXIT_SAPLV01Z_003
    • EXIT_SAPLV01Z_004
  • SAP Batch Management Status
  • SLED (shelf life expiration date)
    • BAdI VB_SLED_MANAGEMENT
    • SLED EXIT_SAPLVBMD_001 Userexit
  • Batch Information Cockpit
    • BIC_ADDITIONAL_DATA
    • BIC_FOLLOW_UP_ACTION
    • BIC_SELECTION
  • Batch Where-Used List
    • BAdI VB_BWUL_EXPLOSION
    • BAdI VB_GET_POS_PLANT
    • BAdI VB_GET_EXT_BATCHES
    • EXIT_SAPLCHVW_001
  • SAP Batch Determination BADis and Exit
    • BAdI VB_BD_SELECTION
    • BAdI VB_BD_SELECTION_CRITERIA
    • EXIT_SAPLV01F_001
    • EXIT_SAPLV01F_002

SAP Batch Master User-Exists and BAdIs

BAdI BATCH_MASTER

BATCH_MASTER: Enhancements for Batch Master Transactions
It is called in MSC1N and MSC2N to validate user’s input.

There is 4 methods for BATCH_MASTER BAdI:

  • CHECK_DATA_BEFORE_SAVE Check Batch Data at Save
  • CHECK_CLASSIF_BEFORE_SAVE Batch Classification Check When Saving
  • SINGLE_FIELD_CONTROL Field Selection Control
  • LOCK_BATCH_MASTER_IN_MIGO Influence Lock of Batch Master Record in MIGO

EXIT_SAPLV01Z_013

It is called in Function Modules VB_CREATE_BATCH and VB_CHANGE_BATCH to set/change master data.

It is also called in transaction MIGO.

ABAP
1
2
3
4
5
6
7
8
9
10
CALL FUNCTION 'EXIT_SAPLV01Z_013'
* EXPORTING
*   x_bncom =                   " bncom         Application Data from Business Transaction
*   mcha_old =                  " mcha          Original Batch Master Record
*   ref_material =              " mcha-matnr    Reference Material (for Information)
*   ref_batch =                 " mcha-charg    Source Batch (for Information)
*   ref_plant =                 " mcha-werks    Reference Plant (for Information)
* CHANGING
*   batch_master_data =         " mbcfc003      Modifiable Batch Master Record
*   batch_valuation_type =      " mcha-bwtar    Valuation Type of batch (if Split Valuation)

EXIT_SAPMM07M_003

It is called in MM coding (MB1A, MB1B, MB1C, etc) but only for new batches.

ABAP
1
2
3
4
5
6
7
8
9
10
11
CALL FUNCTION 'EXIT_SAPMM07M_003'
  EXPORTING
    i_matnr =                   " mara-matnr    Material Number of New Batch
    i_charg =                   " mch1-charg    New Batch Number
*   i_werks =                   " mcha-werks    Plant
    i_mseg =                    " mseg          Material Document Item
    i_vm07m =                   " vm07m         Additional Data for Material Document Item
    i_dm07m =                   " dm07m         Additional Data for Material Document Item
    i_mkpf =                    " mkpf          Material Document Header
  CHANGING
    batch_master_data =         " mbcfc003      Modifiable Batch Master Record

Batch Classification

EXIT_SAPLV01Z_012

It is called in Function Modules VB_CREATE_BATCH and VB_CHANGE_BATCH to determine whether classification and exits should be executed.

In other words, it’s possible make the system ignore the classification routines. Just set the parameters TYPE_OF_CLASSIFYING and EXTENDED_CLASSIFYING accordingly.

1
2
3
4
5
6
7
8
9
10
11
CALL FUNCTION 'EXIT_SAPLV01Z_012'
* EXPORTING
*   x_bncom =                   " bncom         Application Data from Business Transaction
*   x_mcha =                    " mcha          Workarea of New Batch
*   ref_material =              " mcha-matnr    Reference Material (for Information)
*   ref_batch =                 " mcha-charg    Source Batch (for Information)
*   ref_plant =                 " mcha-werks    Reference Plant (for Information)
* CHANGING
*   type_of_classifying =       " t156-kzcla    Type of Classification
*   extended_classifying =      " t156-xkcfc    Extended Classification EXIT_SAPLV01Z_014
*   no_check_of_qm_char = SPACE  " am07m-xselk  No Check Against QM Characteristics

EXIT_SAPLV01Z_014

It’s called in VB_CREATE_BATCH and VB_CHANGE_BATCH to set/change free characteristics.

Free characteristics are those that do not begin with ‘LOBM_’.

ABAP
1
2
3
4
5
6
7
8
9
10
11
CALL FUNCTION 'EXIT_SAPLV01Z_014'
* EXPORTING
*   x_bncom =                   " bncom         Application Data from Business Transaction
*   ref_material =              " mcha-matnr    Reference Material (for Information)
*   ref_batch =                 " mcha-charg    Source Batch (for Information)
*   ref_plant =                 " mcha-werks    Reference Plant (for Information)
* TABLES
*   characters =                " api_char      Attributes of Batch
*   attributes =                " api_ch_att    Attributes of Characteristics
*   max_values =                " api_val_i     Value Ranges of Characteristics
*   values =                    " api_val_i     Values of Characteristics

Check this scn thread about EXIT_SAPLV01Z_014. Changing characteristic values at Batch creation.

EXIT_SAPMM07M_004

It is used to fill the classification data in MM transactions.

ABAP
1
2
3
4
5
6
7
8
9
10
11
CALL FUNCTION 'EXIT_SAPMM07M_004'
  EXPORTING
    i_mseg =                    " mseg          Material Document Item
    i_vm07m =                   " vm07m         Additional Data for Material Document Item
    i_dm07m =                   " dm07m         Additional Data for Material Document Item
    i_mkpf =                    " mkpf          Material Document Header
  TABLES
    characters =                " api_char      Attributes of Batch
    attributes =                " api_ch_att    Attributes of Characteristics
    max_values =                " api_val_i     Value Ranges of Characteristics
    values =                    " api_val_i     Values of Characteristics

Batch Numbering – Internal

EXIT_SAPLV01Z_001

Replacement of the number range, decision for internal or external numbering.

For more information, check the help.sap.com page about Further information and examples for EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002

ABAP
1
2
3
4
5
6
7
8
9
10
11
CALL FUNCTION 'EXIT_SAPLV01Z_001'
* EXPORTING
*   x_bncom =                   " bncom         Application Data from Business Transaction
  IMPORTING
    cust_no_internal =          "               Suppress Internal Number Assignment
* CHANGING
*   nr_range_nr = '01'          " inri-nrrangenr  Number Range Number
*   object = 'BATCH_CLT'        " inri-object   Name of Number Range Object
*   subobject = SPACE           " inri-subobject  Value of Subobject of Number Range Object
*   toyear = '0000'             " inri-toyear   To Fiscal Year
*   message_when_auto = SPACE   " am07m-xselk   Sending a Confirmation Prompt

EXIT_SAPLV01Z_002

Assignment of customer-specific batch number. Also used to assign an existing batch (allow_existing_batch) via VB_CREATE_BATCH.

Further information and examples for EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002

ABAP
1
2
3
4
5
6
7
CALL FUNCTION 'EXIT_SAPLV01Z_002'
* EXPORTING
*   x_bncom =                   " bncom         Application Data from Business Transaction
  CHANGING
    new_charg =                 "               New Batch Number Assigned During Internal Number Assignment
  EXCEPTIONS
    CANCELLED = 1               "               Canceled

EXIT_SAPMM07M_010

Called in MM coding to assign existing batches.

ABAP
1
2
3
4
5
6
7
8
9
CALL FUNCTION 'EXIT_SAPMM07M_010'
  EXPORTING
    i_mseg =                    " mseg          Document Segment: Material
    i_vm07m =                   " vm07m         Fields: Update Control of Module Pool SAPMM07M
    i_dm07m =                   " dm07m         Dialog Control Fields for Module Pool SAPMM07M
    i_mkpf =                    " mkpf          Header: Material Document
    i_transfer =                " dm07m-kzuml   Stock Transfer/Transfer Posting
  IMPORTING
    e_charg =                   " mcha-charg    Batch Number

Batch numbering – External

EXIT_SAPLV01Z_003

Replacement of the number range, decision customer-specific check.

ABAP
1
2
3
4
5
6
7
8
9
10
CALL FUNCTION 'EXIT_SAPLV01Z_003'
* EXPORTING
*   new_charg =                 " mcha-charg    Batch Numbers to Be Checked
*   x_bncom =                   " bncom         Application Data from Business Transaction
* CHANGING
*   nr_range_nr = '02'          " inri-nrrangenr  Number Range Number
*   object = 'BATCH_CLT'        " inri-object   Name of Number Range Object
*   subobject = SPACE           " inri-subobject  Value of Subobject of Number Range Object
*   toyear = '0000'             " inri-toyear   To Fiscal Year
*   cust_no_check = ' '         "               Suppress Check Against Number Range

EXIT_SAPLV01Z_004

Check of batch number based on customer rules.

ABAP
1
2
3
4
5
6
CALL FUNCTION 'EXIT_SAPLV01Z_004'
  EXPORTING
    new_charg =                 " mcha-charg    Batch Numbers to Be Checked
*   x_bncom =                   " bncom         Application Data from Business Transaction
  IMPORTING
    cust_not_allowed =          "               Batch Number Is not Valid

SAP Batch Management Status

The SAP Batch Management Status exis EXIT_SAPLV01D_001 is used for Determination of the initial status of a batch.

SLED (shelf life expiration date)

BAdI VB_SLED_MANAGEMENT

VB_SLED_MANAGEMENT: Control of Shelf Life Expiration Date Processing

It’s used to set VFDAT/HSDAT and switch off SLED management
(method: MAINTAIN_SLED_PARAMETERS: Change Parameters of Minimum Shelf Life Processing)

SLED EXIT_SAPLVBMD_001 Userexit

It is typically based on similar functionality as BAdI VB_SLED_MANAGEMENT

ABAP
1
2
3
4
5
6
7
8
9
10
11
12
CALL FUNCTION 'EXIT_SAPLVBMD_001'
* EXPORTING
*   i_bncom =                   " bncom         Batch Number Allocation: Communication Block (Dialog)
* CHANGING
*   c_bezdt =                   " mcha-vfdat    Shelf Life Expiration Date
*   c_iprkz_hbd =               " mara-iprkz    Period Indicator for Shelf Life Expiration Date
*   c_iprkz_rlz =               " mara-iprkz    Period Indicator for Shelf Life Expiration Date
*   c_rdmhd =                   " mara-rdmhd    Rounding Rule for Calculation of SLED
*   c_geshb =                   " mara-mhdhb    Total Shelf Life
*   c_rstlz =                   " mara-mhdrz    Minimum Remaining Shelf Life
*   c_mhdat =                   " mcha-vfdat    Shelf Life Expiration Date
*   c_hsdat =                   " mcha-vfdat    Shelf Life Expiration Date

Batch Information Cockpit

BIC_ADDITIONAL_DATA

BIC_ADDITIONAL_DATA: BAdI: Batch Information Cockpit – Additional Data/Columns

Add additional columns to selection result master and selection result stock.

You will find the following methods :

  • MASTER_COLUMNS_ADD Add Columns for Additional Data for Selection Result:Batches
  • STOCK_COLUMNS_ADD Add Columns for Additional Data for Selection Result: Stock
  • MASTER_ADD_DATA_FILL_IN Add Additional Data to Selection Result: Batches
  • STOCK_ADD_DATA_FILL_IN Add Additional Data to Selection Result: Stock
  • MASTER_ADD_DATA_SELECT Select Additional Data for Selection Result: Batches
  • STOCK_ADD_DATA_SELECT Select Additional Data for Selection Result: Stock

BIC_FOLLOW_UP_ACTION

BIC_FOLLOW_UP_ACTION:Follow-On Actions in the Batch Information Cockpit

Allows defining actions for batches in the selection result (for example, change of batch status):

  • PASS_BATCHES_FOR_ACTION Transfers selected batches to follow-up actions
  • BUILD_LOG_PROFILE Constructs the field catalog for the application log
  • ADD_MSG_TO_LOG Adds a message to the application log
  • SAVE_LOG_TO_DB Saves the application log to the database

BIC_SELECTION

BIC_SELECTION: Selection Enhancement in the Batch Information Cockpit

Definition of custom selection screen and selection logic.

The Methods of BIC_SELECTION Batch BaDi are:

  • DEFINE_SUBSCREEN Definition of a free selection tab page
  • CHECK_SUBSCREEN_FOR_INPUT Checks free selection tab pages for user entries
  • RESET_SUBSCREEN Resets the selection criteria for the selection tab page
  • PRESELECT_BATCHES Customer-specific preselection of batches
  • REFINE_SELECTION_RESULT Deletes entries from the ‘Selection Results Batches’
  • ENRICH_MASTER_RESULT More details for the ‘Selection Results Batches’
  • ACTION_WITH_INFO_OBJECT Executes an action for a customer-specific info object
  • GET_SELID_FOR_ENHANCEMENT Procures ID of Selection Enhancement from Customizing
  • GET_SELID_FOR_ENHANCEMENT Procures ID of Selection Enhancement from Customizing
  • CHECK_FOR_OBLIGATORY_INPUT Check on Mandatory Entries for “Execute Selection”

Batch Where-Used List

BAdI VB_BWUL_EXPLOSION

Allows fine-tuning the selection for each object (batch, PO, production order).

The BADi BAdI VB_BWUL_EXPLOSION offers 5 methods :

  • BWUL_REF_TO_ORDER_MAINTAIN Process Batch Where-Used Records with Reference to Order
  • BWUL_REF_TO_PO_MAINTAIN Process Batch Where-Used Records with Ref. to Purchase Order
  • BWUL_REF_TO_BATCH_MAINTAIN Process Batch Where-Used Records with Reference to Batch
  • SELECTION_PARAMETER_ACTIVATE Activate Parameters for Extended Selection
  • COMPLETE_BWUL_MAINTAIN Process Complete Batch Where-Used List

BAdI VB_GET_POS_PLANT

Pre-determines plant for the selection screen of BWUL.
VB_GET_POS_PLANT: Enhancement of Automatic Plant Determination in transaction Code MB56.

The unique method for the BAdI VB_GET_POS_PLANT is GET_PLANT.

The signature of VB_GET_POS_PLANT->GET_PLANT is

  • I_EXPTP TYPE EXPTP Expansion category f. batch where-used list display
  • I_MATNR TYPE MATNR Material Number
  • I_CHARG TYPE CHARG_D Batch Numbervalue
  • ( E_WERKS ) TYPE WERKS_D Plant

BAdI VB_GET_EXT_BATCHES

VB_GET_EXT_BATCHES: Access to Customer-Specific Batch Usage Data
Allows reading external batches for a subcontracting process.

In this BADi VB_GET_BATCHES, there is 3 differents methods:

  • GET_BATCH_USAGE_A: Determine Batch Usage for Order
  • GET_BATCH_USAGE_B: Determine Batch Usage for Purchase Order
  • GET_BATCH_USAGE_C: Determine Batch Usage for Batch

EXIT_SAPLCHVW_001

Allows filling additional columns into Batch Where-Used List.

ABAP
1
2
3
4
CALL FUNCTION 'EXIT_SAPLCHVW_001'
  TABLES
    t_shadow =                  " chvwshadow
    .  "  EXIT_SAPLCHVW_001

SAP Batch Determination BADis and Exit

BAdI VB_BD_SELECTION

VB_BD_SELECTION: Preselection of Batches Within Batch Determination within SAP Batch Management

Can be used instead of the standard selection to select batches from stock. It?s important to point out that the standard batch selection won?t work after the BAdI activation.

You can use depending on your requirement one of these methods:

  • PRESELECT_BATCHES Preselection of Batches
  • PRESELECT_BATCHES Preselection of Batches
  • PRESELECT_STOCKS Preselection of Batch Stock Records
  • RESTRICT_CONF_CHARS Restrict Characteristics of Configuration
  • SET_CHAR_EXCLUDING Characteristic to Be Interpreted Exclusively

BAdI VB_BD_SELECTION_CRITERIA

VB_BD_SELECTION_CRITERIA: SAP Batch Management: Batch Determination Selection Criteria

It is used to change the selection criteria (it will generate a new CUOBJ) using the method

  • SEL_CRIT_CHANGE Change Selection Criteria for Batch Determination in SAP Batch Management

EXIT_SAPLV01F_001

It is used to change the selection criteria (will generate a new CUOBJ)

ABAP
1
2
3
4
CALL FUNCTION 'EXIT_SAPLV01F_001'
  TABLES
    characters =                " api_char      Characteristics of Selection Class
    values =                    " api_val_i     Valuation of Characteristics

EXIT_SAPLV01F_002

Allows changing the communication structures BDCOM, KOMKH, KOMPH used in function module VB_BATCH_DETERMINATION. For more information you can access document

ABAP
1
2
3
4
5
CALL FUNCTION 'EXIT_SAPLV01F_002'
  CHANGING
    c_bdcom =                   " bdcom         Batch Determination Communication Structure
    c_komkh =                   " komkh         Batch Determination Communication Block Header
    c_komph =                   " komph         Batch Determination: Communication Record for Item

Source: Userexits and BAdIs – Batch Management

Prev Article
Next Article
Tags:Batch Exit SAP BADI

Related Articles

ISO Unit in SAP
ISO Unit of Measure in SAP MM (Material Management): How …

ISO Unit of Measure in SAP MM (Tables, Tcodes, Mapping to SAP Unit)

SAP Inventory Management
Manufacturing Plants for a SAP material list is some times …

Manufacturing Plants of a SAP Material

Search on SAP4TECH

The Most Populars

  • The Most Important SAP ISU Tables
    The Most Important SAP ISU Tables
  • SAP Users Tables
    SAP Users Tables (for Personal, Logon, and Address Data)
  • List of SAP Purchase Order Tables in SAP MM SAP PO Tables
    SAP Purchase Order Tables: Main PO tables in SAP MM – SAP PO Tables
  • Full list of SAP Movement Types
    SAP Good Movement Types – Full list of SAP Movement Types
  • The Main SAP GL Account Tcodes SAP GL Account Tables
    The Main SAP G/L Account Tcodes & SAP GL Account Tables
  • SAP BOM Tables
    SAP BOM Tables for BOM Header, Items and components and Category

Related Posts

  • SAP Alternative Unit of Measure for Material
    SAP Alternative Unit of Measure for Material
  • mvke table in sap Material Sales Data Table
    The main list of SAP MM Tables and Tcodes (Material Management)
  • SAP SD
    SAP Order Delivery Status for Sales Documents
  • SAP ABAP
    SAP Attachments Mass Extraction for Sales Documents (ABAP)
  • SAP Material
    Trigger MATMAS IDoc using BTE Function

SAP4TECH

SAP and ABAP Free Tutorials

Trending Posts

  • The Most Important SAP ISU Tables
  • SAP Users Tables (for Personal, Logon, and Address Data)
  • SAP Purchase Order Tables: Main PO tables in SAP MM – SAP PO Tables
  • SAP Good Movement Types – Full list of SAP Movement Types
  • The Main SAP G/L Account Tcodes & SAP GL Account Tables
  • SAP BOM Tables for BOM Header, Items and components and Category

The Most Recents

  • The Most Important SAP ISU Tables
  • SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture
  • The Main SAP Dunning Transaction Codes
  • SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)
  • The Most Important SAP Payment Terms Tables (ZTERM, Text…)

Search

SAP Tutorials by Topics

  • SAP Tables
  • SAP Tcodes
  • SAP BAPI
  • ABAP Snippets
  • Top SAP Courses
  • Top SAP Books
Copyright © 2021 SAP4TECH

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
This website uses cookies to improve your experience. We'll assume you accept this policy as long as you are using this websiteAcceptView Policy