Application Development 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: 

IDOC_STATUS_WRITE_TO_DATABASE

Former Member
0 Kudos

hello experts,

i am using the function module IDOC_STATUS_WRITE_TO_DATABASE

and i am encoutering the exceptions 'idoc_foreign_lock '

could anyone guide me towards understanding why i am geting this exception. i am doing batch input

thank you.

points will be rewarded

regards

priya

1 ACCEPTED SOLUTION

former_member404244
Active Contributor
0 Kudos

Hi priya,

U r getting this message becuase "The IDoc is currently blocked."the idoc number which u r reading is currently blocked,thats why u r getting this message..Try with other idoc number and check..also check the documentation of the FM "EDI_DOCUMENT_OPEN_FOR_PROCESS"

Regards,

Nagaraj

5 REPLIES 5

former_member404244
Active Contributor
0 Kudos

Hi priya,

U r getting this message becuase "The IDoc is currently blocked."the idoc number which u r reading is currently blocked,thats why u r getting this message..Try with other idoc number and check..also check the documentation of the FM "EDI_DOCUMENT_OPEN_FOR_PROCESS"

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

When u r calling the FM "IDOC_STATUS_WRITE_TO_DATABASE", program internally checks whether the Database is locked or not.

In your case i can see thatLOCK MODE is EXCLUSIVE, and hence u r getting the exception 'idoc_foreign_lock '.

Program is internally trying to LOCK the DB table in EXCLUSIVE mode which is already opened by the <b>other user</b>.unless the other user closes the table u will be able to Lock the table.

Belwo is the code related to ur FM which is triggering the execption :

CASE MODE.

WHEN SHARED.

CALL FUNCTION 'ENQUEUE_ES_EDIDOCS'

EXPORTING

DOCNUM = DOCNUM

_SCOPE = '3'

WAIT = WAITOPTION

EXCEPTIONS

FOREIGN_LOCK = 04

others = 08.

WHEN EXCLUSIVE.

CALL FUNCTION 'ENQUEUE_ES_EDIDOCE'

EXPORTING

DOCNUM = DOCNUM

_SCOPE = '3'

WAIT = WAITOPTION

EXCEPTIONS

FOREIGN_LOCK = 04

others = 08.

ENDCASE.

IF SY-SUBRC EQ 04.

MESSAGE E061 WITH DOCNUM RAISING DOCUMENT_FOREIGN_LOCK.

elseif sy-subrc eq 08.

message id sy-msgid type 'A' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

revrt back if any issues,

Rewrad if helpful.

regards,

Naveen

Former Member
0 Kudos

hello deva and nagaraj,

it seems i am the one blocking it.

any suggestion?

well i am using the fm JOB OPEN

followed by SUBMIT RFBIBL00. which inspite having a sy-subrc eq 0, no task is being created in the background

then i have used FM JOB_CLOSE followed by fm IDOC_STATUS_WRITE_TO_DATABASE to change the status from 51 to 73

any idea ?

regards

priya

0 Kudos

hi,

can u specify more clearly.

its better u paste ur code.

Revert back.

Regrads,

Naveen

Former Member
0 Kudos

hello experts,

thank you all for your help. it was a problem on shore

regards

priya