2014 Nov 27 11:20 AM
Hi Experts,
I have a requirement to update Meter Mechanism Code for the Equipment. We can do this using transaction IQ02, but I have to do the update for bulk data. Meter Mechanism Code is stored in table AUSP (but updating AUSP table directly is not recommended). So I need to update Meter Mechanism Code using some BAPI/ Function module.
Could you please suggest BAPI/ Function module to Meter Mechanism Code for the Equipment.
Thanks in advance,
Dipin
2014 Nov 27 3:30 PM
Thanks Asif and Chandan
I have passed below values into FM BAPI_OBJCL_CHANGE and Meter Mechanism Code is getting updated.
wa_allocvaluescharnew-charact = 'METER_MECHANISM_CODE'. (Chack the name of the characteristic in your system)
wa_allocvaluescharnew-value_char = 'XYZ'. (Provide the value of the characteristics)
But other values (Payment Method, Measuring Capacity…) got deleted.
Do I need to pass the existing values (Payment Method, Measuring Capacity…) to the FM or is there any other way to update only a particular value (i.e. Meter Mechanism Code) and keeping the existing values as it is.
Regards,
Dipin
2014 Nov 27 12:59 PM
2014 Nov 27 2:09 PM
Hi Dipin,
You can use the BAPI ' BAPI_OBJCL_CHANGE'. to achieve this.
lv_equnr will have the equipment no. Make sure to append the leading zeroes to it.
See the code snippet below.
DATA : lv_equnr TYPE bapi1003_key-object
DATA allocvaluescharnew TYPE STANDARD TABLE OF bapi1003_alloc_values_char.
DATA wa_allocvaluescharnew LIKE LINE OF allocvaluescharnew.
DATA return TYPE STANDARD TABLE OF bapiret2.
lv_equnr = '000000000010000305'.
wa_allocvaluescharnew-charact = 'METER_MECHANISM_CODE'. (Chack the name of the characteristic in your system)
wa_allocvaluescharnew-value_char = 'XYZ'. (Provide the value of the characteristics)
APPEND wa_allocvaluescharnew TO allocvaluescharnew.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = lv_equnr
objecttable = 'EQUI'
classnum = 'Z_GMETER'
classtype = 'IS2'
* STATUS = '1'
* STANDARDCLASS = STANDARDCLASS
* CHANGENUMBER = CHANGENUMBER
keydate = sy-datum
* NO_DEFAULT_VALUES = ' '
* IMPORTING
* CLASSIF_STATUS = CLASSIF_STATUS
TABLES
allocvaluesnumnew = allocvaluesnumnew
allocvaluescharnew = allocvaluescharnew
allocvaluescurrnew = allocvaluescurrnew
return = return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Regards,
Chandan
2014 Nov 27 3:30 PM
Thanks Asif and Chandan
I have passed below values into FM BAPI_OBJCL_CHANGE and Meter Mechanism Code is getting updated.
wa_allocvaluescharnew-charact = 'METER_MECHANISM_CODE'. (Chack the name of the characteristic in your system)
wa_allocvaluescharnew-value_char = 'XYZ'. (Provide the value of the characteristics)
But other values (Payment Method, Measuring Capacity…) got deleted.
Do I need to pass the existing values (Payment Method, Measuring Capacity…) to the FM or is there any other way to update only a particular value (i.e. Meter Mechanism Code) and keeping the existing values as it is.
Regards,
Dipin
2014 Nov 28 4:36 AM
Hi Dipin,
You will first have to get all the existing charactersitics details using "BAPI_OBJCL_GETDETAIL" and then call the other one i.e. BAPI_OBJCL_GETDETAIL, to update only the meter mech code by which the other values will remain unchanged.
Hope this helps!
Asif
2014 Nov 28 6:34 AM
Hi Dipin,
Please see the code snippet below.
DATA allocvaluesnumnew TYPE STANDARD TABLE OF bapi1003_alloc_values_num.
DATA allocvaluescharnew TYPE STANDARD TABLE OF bapi1003_alloc_values_char.
DATA allocvaluescurrnew TYPE STANDARD TABLE OF bapi1003_alloc_values_curr.
DATA return TYPE STANDARD TABLE OF bapiret2.
FIELD-SYMBOLS <fs_allocvaluescharnew> LIKE LINE OF allocvaluescharnew.
DATA : lv_equnr TYPE bapi1003_key-object.
lv_equnr = '000000000010000305'.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = lv_equnr
objecttable = 'EQUI'
classnum = 'Z_GMETER'
classtype = 'IS2'
keydate = sy-datum
* UNVALUATED_CHARS = ' '
* LANGUAGE = SY-LANGU
* IMPORTING
* STATUS = STATUS
* STANDARDCLASS = STANDARDCLASS
TABLES
allocvaluesnum = allocvaluesnumnew
allocvalueschar = allocvaluescharnew
allocvaluescurr = allocvaluescurrnew
return = return.
IF sy-subrc = 0.
READ TABLE allocvaluescharnew ASSIGNING <fs_allocvaluescharnew> WITH KEY charact = 'METER_MECHANISM_CODE'.
IF sy-subrc = 0.
<fs_allocvaluescharnew>-value_char = '11'.(give the new characteristic value here).
<fs_allocvaluescharnew>-value_neutral = '11'.(give the new characteristic value here).
ENDIF.
ENDIF.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = lv_equnr
objecttable = 'EQUI'
classnum = 'Z_GMETER'
classtype = 'IS2'
* STATUS = '1'
* STANDARDCLASS = STANDARDCLASS
* CHANGENUMBER = CHANGENUMBER
keydate = sy-datum
* NO_DEFAULT_VALUES = ' '
* IMPORTING
* CLASSIF_STATUS = CLASSIF_STATUS
TABLES
allocvaluesnumnew = allocvaluesnumnew
allocvaluescharnew = allocvaluescharnew
allocvaluescurrnew = allocvaluescurrnew
return = return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Regards,
Chandan
2014 Dec 03 8:18 AM
Hi Chandan,
Thanks a lot
Could you please tell how to update Certification Expiry Date for the Equipment..
Thanks in advance,
Dipin
2014 Dec 03 9:26 AM
Hi Dipin,
To update the Certification Expiry Date, follow the same procedure as i have mentioned earlier. You need to explore the FM also refer the documentation of the function Module.
Regards,
Chandan.
2014 Dec 02 5:17 AM
Hi Dipin,
Can you please close this thread if your query is answered?
Regards,
Chandan
2014 Dec 05 9:34 AM