cancel
Showing results for 
Search instead for 
Did you mean: 

SAPSQL_ARRAY_INSERT_DUPREC - A017 table

eldho_kurianjacob
Participant
0 Kudos

Hi All,

I get dump SAPSQL_ARRAY_INSERT_DUPREC when i am creating purchase info record using FM 'ME_POST_INFORECRD' in a program. Multiple material can be given as input and multiple info records will be created in one execution. Materials will be looped one by one. For the first material, Info record gets created successfully. But, from the second material on wards, it starts to throw error 'Inserting duplicate record to A017 table'. In the dump details of the second material, i can see the first material and not the second one. Seems like some buffer data issue.

Kindly advise to rectify this .

Thank you,

Eldho

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor
0 Kudos

When using unreleased (*) FM always perform a where-used search and replicate behavior of standard class/program, your code could look like

CALL FUNCTION 'ME_INITIALIZE_INFORECORD'.
CALL FUNCTION 'RV_CONDITION_RESET'
  EXPORTING
    free_memory ='X'.
CALL FUNCTION 'ME_POST_INFORECORD'
  TABLES
    t_eina_i = lt_eina
  EXCEPTIONS
    error_message = 1
    OTHERS        = 2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    wait   = 'X'
  IMPORTING
    return = lt_bapiret2.
REFRESH lt_eina.

Add the requested check/catch for error handling too.

(*) Actually do it also for released ones...

eldho_kurianjacob
Participant
0 Kudos

Yes. This is the correct method. I was not using FM RV_CONDITION_RESET before. It works fine now. Thank you.

Answers (1)

Answers (1)

former_member200338
Active Contributor
0 Kudos

Try calling ME_INITIALIZE_INFORECORD before calling ME_POST_INFORECORD