Hi all,
I am creating a batch using a BAPI and immediately creating characteristics with a value for that batch. The problem is the batch sucessfully getting created but the characteristic value is not updated. If i go in debug mode, i see that my program is absolutely fine and working well. In debug mode its updating the characteristic value too.
So i used WAIT UP TO 4 SECONDS after each BAPI. Now characteristic value is also updated. But the problem is when my server is slow, the wait time is not sufficient and my program is failing.
My doubt is, i am using BAPI_TRANSACTION_COMMIT then why should i explicitly write a Wait statement. Is there any permanent solution for this problem.
Peice of my code is attached below for reference.
CALL FUNCTION 'BAPI_BATCH_CREATE'
EXPORTING
material = l_material
plant = afvgd-werks
batchcontrolfields = lw_batchcontrolfields
IMPORTING
batch = l_newbatch
TABLES
return = li_return_createbatch.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WAIT UP TO 4 SECONDS.
CALL FUNCTION 'BAPI_OBJCL_CREATE'
EXPORTING
objectkeynew = l_material_char_create
objecttablenew = lc_objecttable
classnumnew = l_classnum
classtypenew = lc_classtype
TABLES
allocvaluesnum = li_allocvaluesnum_create
return = li_return_create.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WAIT UP TO 4 SECONDS.