10-06-2007 1:58 AM
Hello all,
Before this I develop an upload program for grant... I run the program in client DEV 230 to upload the data. The data was successful upload into the table.
But the real problem occur in DEV 250 where when I want to upload the data the error 'SAPSQL_ARRAY_INSERT_DUPREC' was encounter and the data did not insert into the table. I'm calling BAPI to upload the data.
Any advice will be appreciate.
Thanks.
10-06-2007 10:09 AM
analysis...
The problem is a client specific. updates..
by default whenever u pass and open SQL query it passes mandt = sy-mandt (current logon user client)... so if u r trying to update client DEV250 while login tru client DEV230 user.. it wont work ..
solution..
1> log on with user of client DEV230 and run the same.. it will work...
2> if u dont have access to user of client DEV230 then create a client specified query .. and mention mandt in where clause..
10-07-2007 4:59 AM
Best way to avoid this error is clear the buffer data.Search for the similar BAPI which clears the buffer data.And one more thing is check the data file properly, there may exist duplicate records.If you are using any reference field to link multiple files, then check there are duplicate ref keys.Hope this helps you
10-08-2007 2:32 AM
Hi,
Thanks Alnoor... but the problem still da same.
The situation here is where in DEV230 my program will run successful n the upload data was insert into table while in DEV250, the program can't insert the data into table and error 'SAPSQL_ARRAY_INSERT_DUPREC' were occured.
I've already checking tru my coding but still can't find any problem in my coding.
Need solution A.S.A.P...
Thanks.
10-08-2007 2:49 AM
Hi Saiful,
This error occurs when you try to insert a record into a table with the same key field values.
Since you said you are using a BAPI, which BAPI is it for. If you can specify it, we can help you. It would be more helpful if you can paste your part of code which shows this dump.
The reason can be because in client 230 the data which you are creating might be new data. Where as in client 250 the data which you create might already be existing, due to which it says can not insert duplicate records.
Regards
Gopi
10-08-2007 5:18 AM
Hi Gopi,
It's right that it might because of duplicate record.. but that's not the problem because the program will check the data first before upload it. I'm using 'BAPI_0035_CREATE' to upload grant.
Here's my BAPI coding :
loop at itab_val.
refresh : i_return_bapi.
clear : ibudget_header, ibudget_header_add, ibudget_short,
ibudget_desc, i_return_bapi.
perform map_data_BAPI.
CALL FUNCTION 'Z_BAPI_0035_CREATE'
EXPORTING
LANGUAGE =
HEADER_DATA = ibudget_header
HEADER_DATA_ADD = ibudget_header_add
SHORT_DESC = ibudget_short
DESCRIPTION = ibudget_desc
TESTRUN = 'X' "Test Run
TESTRUN = ' ' "Actual Run
IMPORTING
FMAREA =
DOCUMENTYEAR =
DOCUMENTNUMBER =
TABLES
ITEM_DATA = ibudget_item
SENDER_ITEM_DATA =
PERIOD_DATA =
SENDER_PERIOD_DATA =
LONG_TEXT = ibudget_ltext
EXTENSION_IN =
RETURN = i_return_bapi.
delete adjacent duplicates from i_return_bapi comparing type.
*Do error handling
LOOP AT I_RETURN_BAPI.
IF I_RETURN_BAPI-TYPE = 'E'.
DONT_POST = 'x'.
EXIT.
check: I_RETURN_BAPI-id ne 'BAPI'.
move-corresponding w to iexceptn.
move-corresponding w to ireport.
concatenate I_RETURN_BAPI-type ':' I_RETURN_BAPI-id
I_RETURN_BAPI-number I_RETURN_BAPI-message
into ireport-remarks separated by space.
append ireport. clear ireport.
append iexceptn. clear iexceptn.
EXIT.
else.
move-corresponding w to isuccess.
move-corresponding w to ireport.
concatenate I_RETURN_BAPI-type ':' I_RETURN_BAPI-id
I_RETURN_BAPI-number I_RETURN_BAPI-message
into ireport-remarks separated by space.
ireport-remarks = 'Successful'.
append ireport. clear ireport.
append isuccess. clear isuccess.
EXIT.
ENDIF.
ENDLOOP.
************************************************************************
Do Commit. Do implement error handling! *
************************************************************************
IF DONT_POST NE 'x'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = i_return_commit.
************************************************************************
Do some meaningful error handling *
************************************************************************
LOOP AT I_RETURN_COMMIT.
IF I_RETURN_COMMIT-TYPE = 'E'.
COMMIT_ERROR = 'x'.
EXIT.
ENDIF.
ENDLOOP.
endif.
endloop.
Thanks for any help.
Saiful
11-07-2007 9:31 PM
Make sure there are no duplicate entries in the internal table "ibudget_header", hope this works.