- March 31, 2026
- Kishore Thutaram
-
- 0
Fix Dump Issue for Batch creation during the Return Sales order creation in S/4 HANA
Issue: BAPI_BATCH_CREATE FM gives a short dump during return order creation due to ‘commit work’ inside the BAPI, which is not supported by the RAP framework.
Solution: Use the FM, VB_CREATE_BATCH, which avoids commit during Fiori app call
Implement the code below
DATA: ls_mcha TYPE mcha.
ls_mcha-matnr = vbap-matnr(18).
ls_mcha-werks = vbap-werks.
CALL FUNCTION 'VB_CREATE_BATCH'
EXPORTING
ymcha = ls_mcha
bypass_lock = ' '
IMPORTING
ymcha = ls_mcha
EXCEPTIONS
no_material = 1
no_batch = 2
no_plant = 3
material_not_found = 4
plant_not_found = 5
stoloc_not_found = 6
lock_on_material = 7
lock_on_plant = 8
lock_on_batch = 9
lock_system_error = 10
no_authority = 11
batch_exist = 12
stoloc_exist = 13
illegal_batch_number = 14
no_batch_handling = 15
no_valuation_area = 16
valuation_type_not_found = 17
no_valuation_found = 18
error_automatic_batch_number = 19
cancelled = 20
wrong_status = 21
interval_not_found = 22
number_range_not_extern = 23
object_not_found = 24
error_check_batch_number = 25
no_external_number = 26
no_customer_number = 27
no_class = 28
error_in_classification = 29
inconsistency_in_key = 30
region_of_origin_not_found = 31
country_of_origin_not_found = 32
OTHERS = 33.
IF ls_mcha-charg NE space.
vbap-charg = ls_mcha-charg.
ENDIF.






























