10-18-2018 7:56 PM
Hi all,
I need to update customer for equipment with the function ITOB_EQUIPMENT_MODIFY_SINGLE but my code does not work correctly. When the function ITOB_EQUIPMENT_MODIFY_SINGLE be called the system will return sy-subrc = 1 back
Could someone tell my why my code does not work and where is the error is, i'm completely new in ABAP Development.
Here is my code with some dummy data in my system.
DATA:l_objnr TYPE itob-objnr value 'IEG351-1491'. "equipment-Object
DATA: ls_itob TYPEitob.
DATA: lt_itob TYPE STANDARD TABLE OF itob.
data i_new_kunnr TYPE c length 18 value '0000044639'.
data: l_valid_equi like itob,
l_valid_equi_new like itob,
l_itob_old like itob,
l_itob_new like itob,
l_itob_rec like itob.
CALL FUNCTION 'ITOB_EQUIPMENT_READ_SINGLE'
EXPORTING
* i_lock = c_x “lock ignored
i_objnr = 'G351-1491'
IMPORTING
e_object_rec =l_valid_equi
EXCEPTIONS
not_successful = 1
OTHERS = 2.
IF sy-subrc EQ 0.
l_valid_equi_new = l_valid_equi.
l_valid_equi_new-kund1 = i_new_kunnr.
MOVE: l_valid_equi TOl_itob_old,
l_valid_equi_new TOl_itob_new.
CLEAR l_itob_rec.
* Function module to udate equipment data
CALL FUNCTION 'ITOB_EQUIPMENT_MODIFY_SINGLE'
EXPORTING
i_write_buffer ='X'
i_post_buffer ='X'
i_commit_work ='X'
i_object_rec =l_itob_new
I_OBJECT_REC_OLD = l_itob_old
IMPORTING
E_OBJECT_REC =l_itob_rec
EXCEPTIONS
NOT_SUCCESSFUL =1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
Thanks and Regards
Ton
10-18-2018 7:59 PM
Without having a deeper look I would say, that you have forgot to pass the parameter for authorization. These equipment-data functions are really strict.
Because of not having a system available, have a look here. This looks very similar to yours and it seems to work.
10-19-2018 12:09 AM
The structure ITOB in the notification area is a view based on six different tables. Getting what you are attempting to work will require you to set up your changes to the underlying tables correctly. I did something like this ten years ago.
I remember these steps were necessary:
Even with the data set up correctly, we didn't use the FMs you list. We used this more complicated sequence:
CALL FUNCTION 'EQUIPMENT_READ'
CALL FUNCTION 'EQUIPMENT_UPDATE'
CALL FUNCTION 'EQUI_WRITE_DOCUMENT'
COMMIT WORK.
The combination of these functions always worked. It may be more than you need, but it is something to fall back on.
10-28-2018 2:34 PM
Hi Juan,
these three Functions are seem to be too complex for me at the moment and so the colleague has taken the task as in consequence. But thank you very much for you answer.
Thanks and Regards
Ton
10-19-2018 6:37 PM
Hi Florian,
thank you very much for your answer. Yes i have thought my problem is the authorization term but i don't know exactly what i have to do. Could you tell me a little bit more about this authorization? I'm a newbie in ABAP 🙂
In addition I have completely read the topic what you mentioned above before starting my own code. In this topic was the issue with update partner of a equipment. For updating customer it is a little bit different because customer is a field in the table itob.
Thanks and regards
Ton
10-22-2018 9:06 AM
Did you also consider implementation of note 2146575 - Customer fields in BAPIs: Technical object (available since 2015 from ehp4 on.) and use BAPI BAPI_EQUI_CHANGE with new parameter EXTENSIONIN and an implementation of BAdI BADI_EAM_ITOB_BAPI_CUST_FIELDS?