2023 Jan 05 6:33 AM
Hi Experts Good Morning,
I have Created Program for Equipment Master Update for that I have used BAPI(BAPI_EQUI_CHANGE)
after using this each and every fields are getting updated successfully Except warranty Details.
I have searched and used lot of BAPI but nothing is working so kindly suggest me BAPI Name to update warranty details in IE02 using ABAP codes.
Thank You
Regards
Jayaprkash AK
2023 Jan 05 9:14 AM
Hello akjayaa
Indeed, it looks like BAPI_EQUI_CHANGE doesn't support warranty details fields. However it supports customer custom fields fields with BADI_EAM_ITOB_BAPI_CUST_FIELDS enhancement. So you can pass warranty details to the BAPI in the EXTENSIONIN table and move them from EXTENSIONIN to the equipment data with the BADI implementation.
The BADI is called in the BAPI as follows:
***** begin note 2146575 - customer fields
* call BAdI for mapping of EXTENSIONIN to ITOB
DATA: lr_badi TYPE REF TO badi_eam_itob_bapi_cust_fields.
TRY.
GET BADI lr_badi.
IF lr_badi IS BOUND.
CALL BADI lr_badi->extensionin_equi_change
EXPORTING
is_object_old = l_itob_rec_old
is_fleet_old = l_fleet_rec_old
iv_valid_date = valid_date
iv_valid_time = valid_time
it_extensionin = extensionin[]
CHANGING
cs_object = l_itob_rec
cs_fleet = l_fleet_rec
cs_return = return.
ENDIF.
CATCH cx_badi_not_implemented.
ENDTRY.
Warranty details are available in L_ITOB_REC, so you can modify them with the enhancement.
Best regards
Dominik Tylczynski
2023 Jan 05 9:14 AM
Hello akjayaa
Indeed, it looks like BAPI_EQUI_CHANGE doesn't support warranty details fields. However it supports customer custom fields fields with BADI_EAM_ITOB_BAPI_CUST_FIELDS enhancement. So you can pass warranty details to the BAPI in the EXTENSIONIN table and move them from EXTENSIONIN to the equipment data with the BADI implementation.
The BADI is called in the BAPI as follows:
***** begin note 2146575 - customer fields
* call BAdI for mapping of EXTENSIONIN to ITOB
DATA: lr_badi TYPE REF TO badi_eam_itob_bapi_cust_fields.
TRY.
GET BADI lr_badi.
IF lr_badi IS BOUND.
CALL BADI lr_badi->extensionin_equi_change
EXPORTING
is_object_old = l_itob_rec_old
is_fleet_old = l_fleet_rec_old
iv_valid_date = valid_date
iv_valid_time = valid_time
it_extensionin = extensionin[]
CHANGING
cs_object = l_itob_rec
cs_fleet = l_fleet_rec
cs_return = return.
ENDIF.
CATCH cx_badi_not_implemented.
ENDTRY.
Warranty details are available in L_ITOB_REC, so you can modify them with the enhancement.
Best regards
Dominik Tylczynski
yesterday - last edited yesterday
Hey Dominik, I just implemented your suggestion. I was not able to create/update warranty dates this way.
I was able to modify other fields of "cs_object" in the BAdI but not GWLDT and GWLEN. There also seems to be no field for warranty type (GAART - vendor/customer warranty) so maybe that's a dead end.
I ended up using function module WARRANTY_ASSIGNMENT_RFC which inserts/updates warranty information for a given key. But since this isn't a BAPI I would be more than happy to know if someone successfully used your approach and what I did wrong in my implementation:
DATA extension TYPE bapiparex.
DATA(warranty) = VALUE bapi_bgmkobj( war_date = '20251001'
warranty = '20271001' ).
cl_abap_container_utilities=>fill_container_c( EXPORTING im_value = warranty
IMPORTING ex_container = extension+30(960)
EXCEPTIONS illegal_parameter_type = 1
OTHERS = 2 ).
DATA(extensions) = VALUE bapiparextab( ( extension ) ).
DATA(return) = VALUE bapiret2( ).
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING equipment = '000000000010000001'
data_general = VALUE bapi_itob( )
data_generalx = VALUE bapi_itobx( )
data_specific = VALUE bapi_itob_eq_only( )
data_specificx = VALUE bapi_itob_eq_onlyx( )
IMPORTING return = return
TABLES extensionin = extensions.
METHOD if_ex_badi_eam_itob_cust_field~extensionin_equi_change.
DATA warranty TYPE bapi_bgmkobj.
DATA(extension) = it_extensionin[ 1 ].
cl_abap_container_utilities=>read_container_c( EXPORTING im_container = extension+30(960)
IMPORTING ex_value = warranty
EXCEPTIONS illegal_parameter_type = 1
OTHERS = 2 ).
cs_object-gwldt = warranty-war_date.
cs_object-gwlen = warranty-warranty.
ENDMETHOD.