Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Park FI document - getting error as SAPSQL_ARRAY_INSERT_DUPREC

0 Likes
2,865

Hi Experts,

When I tried to park FI document using the SAPSQL_ARRAY_INSERT_DUPREC with the help of user exit. I am getting error message as "Express document "Update was terminated" received from author. Also In ST22 getting error message as "SAPSQL_ARRAY_INSERT_DUPREC" in program "SAPLF042"

Information on where terminated

    Termination occurred in the ABAP program "SAPLF042" - in "VBKPF_SCHREIBEN".

    The main program was "RSM13000 ".

    In the source code you have the termination point in line 163

    of the (Include) program "LF042U11".

    The program "SAPLF042" was started in the update system.

    The termination is caused because exception "CX_SY_OPEN_SQL_DB" occurred in

    procedure "VBKPF_SCHREIBEN" "(FORM)", but it was neither handled locally nor

     declared

    in the RAISING clause of its signature.

Kindly advice on the solution.

1 ACCEPTED SOLUTION
Read only

PeterJonker
Active Contributor
0 Likes
2,612

you say:

"When I tried to park FI document using the SAPSQL_ARRAY_INSERT_DUPREC with the help of user exit."

What do you mean with that ?

Can you give us the code of the user exit ?

16 REPLIES 16
Read only

Former Member
0 Likes
2,612

Hi

That means the following code lines are failing:

if insert_flag eq space.

     modify vbkpf from table xvbkpf1.

   else.

     insert vbkpf from table xvbkpf1.

   endif.

so you can have 2 problems:

Or you can try to insert a document already stored

Or you have duplicated records in internal table XVBKPF1

How do you park the document?

Max

Read only

0 Likes
2,612

Hi Max,

Exactly im getting error message in the insertion.

if insert_flag eq space.

     modify vbkpf from table xvbkpf1.

   else.

     insert vbkpf from table xvbkpf1.

   endif.

I am parking the document using BAPI "BAPI_ACC_GL_POSTING_POST" and exit

EXIT_SAPLACC4_001

READ TABLE extension INDEX 1.

IF sy-subrc EQ 0 AND extension-field1 = 'BAPI-PARK'.

   MOVE 2 TO t_acchd-status_new.

ENDIF.

Code in my program for extension:

*

   ls_extention-field1 'BAPI-PARK'.

   ls_extention-field2 =   '1'.

   APPEND ls_extention TO lt_extention.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'

     EXPORTING

       documentheader       = ls_header

* IMPORTING

*   OBJ_TYPE             =

*   OBJ_KEY              =

*   OBJ_SYS              =

     TABLES

       accountgl            = lt_accountgl

       currencyamount       = lt_currency

       return               = lt_return

      extension1           = lt_extention.

Please provide me solution.


Read only

PeterJonker
Active Contributor
0 Likes
2,614

you say:

"When I tried to park FI document using the SAPSQL_ARRAY_INSERT_DUPREC with the help of user exit."

What do you mean with that ?

Can you give us the code of the user exit ?

Read only

0 Likes
2,612

Hi Peter,

Please find my code in the user exit: EXIT_SAPLACC4_001

READ TABLE extension INDEX 1.

IF sy-subrc EQ 0 AND extension-field1 = 'BAPI-PARK'.

   MOVE 2 TO t_acchd-status_new.

ENDIF.

Code in my program for extension:

*

   ls_extention-field1 'BAPI-PARK'.

   ls_extention-field2 =   '1'.

   APPEND ls_extention TO lt_extention.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'

     EXPORTING

       documentheader       = ls_header

* IMPORTING

*   OBJ_TYPE             =

*   OBJ_KEY              =

*   OBJ_SYS              =

     TABLES

       accountgl            = lt_accountgl

       currencyamount       = lt_currency

       return               = lt_return

      extension1           = lt_extention.

Read only

0 Likes
2,612

Hi

The problem is on the values of key fields of VBKPF:

AUSBK

BUKRS

BELNR

GJAHR

So I suppose the document you're trying to store has document number already used, or XVBKPF1 has 2 equal records (I means records with same key....but I don't think it because the BAPI can transfer only one header, so only one document)

Are you transfering the document number too?

Max

Read only

0 Likes
2,612

Hi Max,

I am not transferring document number in the header. I am just passing BUKRS, GJAHR, BLART, BUDAT, BLDAT.

Read only

0 Likes
2,612

Hi

So try to check the number range

Max

Read only

0 Likes
2,612

Max,

Thanks.. Will check and let u know.

Read only

0 Likes
2,612

Hi Max,

The problem arises in the number range and standard program considering only the document number without fiscal year. Hence if there is any document number avail in the previous fiscal year, its showing same error. Kindly advice on this.

Read only

0 Likes
2,612

Hi

Can you post a hardcopy of your number range?

Max

Read only

0 Likes
2,612

Hi Max,

The above is the number range used for year 2012 and 2013 respectively.

Read only

0 Likes
2,612

Hi

it seems to be ok, the last number used for 2013 is 912000428, so there's this document in your system?

After the dump the range is updated with the next number?

Max

Read only

0 Likes
2,612

Yes, After dump the number range set to next one.

Read only

0 Likes
2,612

Hi

So now you should check the data in internal table xvbkpf1

You can check it by debug setting UPDATE DEBUGGING option, in this way the system should stop your program as soon as the function modules in update task are called in particular PRELIMINARY_POSTING_DOC_WRITE

Max

Read only

0 Likes
2,612

Hi Max

As per your reply, I put an update debug over there and System also stop at the PRELIMINARY_POSTING_DOC_WRITE. How to over come the error..

Read only

0 Likes
2,612

Hi

You shoud go to the code line just before the INSERT (where the dump occurs)....and when you're here check what the table xvbkpf1 has.

if insert_flag eq space.                                  <------Stop here and check the internal table xvbkpf1

     modify vbkpf from table xvbkpf1.

   else.

     insert vbkpf from table xvbkpf1.

   endif.

Max