Hi All,
i am writing a BDC program using call transaction for transaction IK11 to create measurement documents. The input file contains measurement readings for the same measurement point at different times. The problem i face is that sporadically it is skipping say 1 in 10 records giving a message that the measuring point is locked. It seems that the system locks were not getting released by the time the next loop pass came along. so to get past this issue, i did an explicit release of the lock object for measuring points followed by an explicit commit work. However this hasnt been enough the frequency of records skipped has just reduced to 1 of 30.
Can anyone help?
The code snippet is pasted below, which shows what i have done to get past the issue.
*-----Loop for all records
LOOP AT it_struc1 INTO x_struc1.
v_linno = v_linno + 1.
*-----Filling bdcdata
PERFORM bdc_dynpro USING: 'SAPLIMR0' '1210'.
PERFORM bdc_field USING: 'BDC_OKCODE' '=GDDO',
'IMRG-POINT' x_struc1-point,
'RIMR0-DFTIM' x_struc1-dftim,
'RIMR0-DFDAT' x_struc1-dfdat,
'RIMR0-DFRDR' x_struc1-dfrdr.
PERFORM bdc_dynpro USING: 'SAPLIMR0' '5210'.
PERFORM bdc_field USING: 'BDC_OKCODE' '=BU',
'IMRG-ITIME' x_struc1-dftim,
'IMRG-IDATE' x_struc1-dfdat,
'RIMR0-CNTRC' x_struc1-cntrc,
'IMRG-READR' x_struc1-dfrdr.
*-----Create Internal format for Point
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = x_struc1-point
IMPORTING
output = x_struc1-point.
*-----Start new transaction according to parameters
PERFORM bdc_transaction USING 'IK11'.
*-----Release Locks
CALL FUNCTION 'DEQUEUE_EIMPTT'
EXPORTING
mode_imptt = 'X'
mandt = sy-mandt
point = x_struc1-point.
*-----Do Explicit Commit Work
COMMIT WORK.
*-----Clear BDC Table
REFRESH it_bdcdata.
ENDLOOP.