- March 13, 2026
- Kishore Thutaram
-
- 0
Update field value from Variant Config data during sales order creation or change
Business Scenario:
“Based on material variant config data, update the field value to VBAK/VBAP tables.”
Steps: Implement User Exit: MV45AFZZ->MOVE_FIELD_TO_VBAK
Note: MOVE_FIELD_TO_VBAP will not trigger when you make a change at the variant config screen; hence, use MOVE_FIELD_TO_VBAK
Implement the code below
LOOP AT xvbap ASSIGNING FIELD-SYMBOL().
IF -cuobj IS NOT INITIAL).
CLEAR lt_config.
*--* Get Material Variant Config data
CALL FUNCTION 'VC_I_GET_CONFIGURATION'
EXPORTING
instance = -cuobj
TABLES
configuration = lt_config
EXCEPTIONS
instance_not_found = 1
internal_error = 2
no_class_allocation = 3
instance_not_valid = 4
OTHERS = 5.
IF sy-subrc = 0.
DATA(ls_config) = VALUE #( lt_config[ atwrt = 'BW01'] OPTIONAL ).
IF ls_config-atwrt IS NOT INITIAL.
-zz1_variant_sdi = 'Z001'.
ENDIF.
ENDIF.
ENDLOOP.





























