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 51, please respond quickly its urgent

Former Member
0 Kudos
1,233

Hi Guru's,

I have an issue with the Inbound IDOC.

I have a zfunction module which will post the zidoc, I have used the FM IDOC_write_to Database to update the status of the posting. I have used BDC to post Vendor Master and Customer Master i.e. FD01,FK01 tcodes.

<b>I am getting the status 51</b> <b>"EDI: idoc<idoc number> is already open in process mode.</b>

how to get rid of this error.

Thanks in Advance,

Sagar

1 ACCEPTED SOLUTION

Former Member
0 Kudos
181

Hi

51 Error: Application document not posted

The report RBDMANIN allows intermediate documents which have already been cancelled once with errors (e.g. Status: 51 error in transfer to application) to be read into the application again. It is also possible to schedule a job with selected parameters, in order to collect up intermediate documents which could not be processed, e.g. because of a locking problem.

Numbers are assigned internally for intermediate documents that have been sent. Number ranges have to be maintained for this purpose. You do this under menu entry Number ranges -> Maintain number ranges for intermediate documents.

• updates the IDoc status according to the BDC error status.

EXTRACT FROM: Z_IDOC_INPUT_ZINVRV

*--- Declaration of local variables

DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.

*-Loop through the IDOCs

LOOP AT IDOC_CONTRL.

*---Loop through the data for the IDOC

LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.

CASE IDOC_DATA-SEGNAM.

WHEN C_SEGNAM.

* Here we get the info from the idoc table

IT_Z1INVRV = IDOC_DATA-SDATA.

ENDCASE.

PERFORM REV_INV.

ENDLOOP.

PERFORM UPDATE_IDOC_STATUS.

ENDLOOP.

FORM REV_INV "Reverse invoice form

*--- Local variables & constants

DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'. "BDC transaction code

*--- Now we can build the bdc table to call the reversal transaction start of screen 109

CLEAR BDC_TAB.

BDC_TAB-PROGRAM = 'SAPMV60A'.

BDC_TAB-DYNPRO = '109'.

BDC_TAB-DYNBEGIN = 'X'.

APPEND BDC_TAB.

*--- Document number

CLEAR BDC_TAB.

BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.

BDC_TAB-FVAL = IT_Z1INVRV-XBLNR. "Billing document number

APPEND BDC_TAB.

*--- OK Code for screen 109

CLEAR BDC_TAB.

BDC_TAB-FNAM = 'BDC_OKCODE'.

BDC_TAB-FVAL = 'SICH'.

APPEND BDC_TAB.

*--- Now we can call transaction 'VF11' with the populated bdc table. The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal). the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale. The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.

CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.

*--- Store the return code for use in another form (status update)

RETURN_CODE = SY-SUBRC.

*--- Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.

IF SY-SUBRC NE 0.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'ZINVRV'

USER = C_ALE_USER

KEEP = 'X'.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = C_TCODE

TABLES

DYNPROTAB = BDC_TAB.

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3.

ELSE. "No problems

C_EXISTS = 'N'.

  • Select from the billing document table to get sales doc number

SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.

  • Select from the sales document table to get user status number

SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND

POSNR = VBRP-AUPOS.

  • Select from the status table to change the user status to pending

SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND

STAT LIKE C_USER_STATUS.

IF JEST-STAT = C_US_PENDING. "User status is pending

JEST-INACT = C_UNCHECKED. "Make pending the active status

UPDATE JEST.

C_EXISTS = 'Y'. "I.E. An entry is already in table

ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.

JEST-INACT = C_CHECKED. "Make everything else inactive

UPDATE JEST.

ENDIF.

ENDSELECT.

IF C_EXISTS = 'N'. "I.E. Pending has never been a status before

JEST-OBJNR = VBAP-OBJNR.

JEST-STAT = C_US_PENDING.

JEST-INACT = C_UNCHECKED. "Make pending the active status

INSERT JEST.

ENDIF.

ENDSELECT. "Select from VBRP (Billing document table)

ENDIF.

ENDFORM. " REV_INV

FORM UPDATE_IDOC_STATUS.

*--- Now we check the CALL TRANSACTION return code and set IDOC status

CLEAR IDOC_STATUS.

IF RETURN_CODE = 0.

WORKFLOW_RESULT = '0'.

IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.

IDOC_STATUS-STATUS = '53'.

IDOC_STATUS-UNAME = SY-UNAME.

IDOC_STATUS-REPID = SY-REPID.

IDOC_STATUS-MSGTY = SY-MSGTY.

IDOC_STATUS-MSGID = SY-MSGID.

IDOC_STATUS-MSGNO = SY-MSGNO.

IDOC_STATUS-MSGV1 = SY-MSGV1.

IDOC_STATUS-MSGV2 = SY-MSGV2.

IDOC_STATUS-MSGV3 = SY-MSGV3.

IDOC_STATUS-MSGV4 = SY-MSGV4.

RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.

RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.

APPEND RETURN_VARIABLES.

ELSE.

WORKFLOW_RESULT = '99999'.

IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.

IDOC_STATUS-STATUS = '51'.

IDOC_STATUS-UNAME = SY-UNAME.

IDOC_STATUS-REPID = SY-REPID.

IDOC_STATUS-MSGTY = SY-MSGTY.

IDOC_STATUS-MSGID = SY-MSGID.

IDOC_STATUS-MSGNO = SY-MSGNO.

IDOC_STATUS-MSGV1 = SY-MSGV1.

IDOC_STATUS-MSGV2 = SY-MSGV2.

IDOC_STATUS-MSGV3 = SY-MSGV3.

IDOC_STATUS-MSGV4 = SY-MSGV4.

RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.

RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.

APPEND RETURN_VARIABLES.

ENDIF.

APPEND IDOC_STATUS.

4 REPLIES 4

paruchuri_nagesh
Active Contributor
0 Kudos
181

hi

execute

RBDMANIN or BD73 tcode

This report attempts to post the inbound IDocs with status '51' (Application document not posted)

When you execute this report, you can select the IDocs you wish to process by IDoc number, creation date, time, message type or sender.

In the error status field, you can specify a status code which establishes further selection criteria. The status code gives a more precise selection criterion for the IDoc status.

The 'Import in background' checkbox has the following significance:

If the checkbox is marked, the IDoc processing is triggered immediately without the IDocs being displayed. Following the processing, a list of the IDoc status values is output.

If the checkbox is not marked, the selected IDocs are displayed one after the other. You can then start the processing of each individual IDoc separately.

regards

Nagesh.Paruchuri

0 Kudos
181

HI Nagesh,

Thanks for a speedy reply,

I have tried the steps provided by you but that did not change the status,

Actually I should populate my own status in the IDOC, but it is not coming.

please let me know if there is any other way.

Thanks in advance.

Sagar

0 Kudos
181

Hi Nagesh,

Thanks a lot it worked, I just updated the status table.

Former Member
0 Kudos
182

Hi

51 Error: Application document not posted

The report RBDMANIN allows intermediate documents which have already been cancelled once with errors (e.g. Status: 51 error in transfer to application) to be read into the application again. It is also possible to schedule a job with selected parameters, in order to collect up intermediate documents which could not be processed, e.g. because of a locking problem.

Numbers are assigned internally for intermediate documents that have been sent. Number ranges have to be maintained for this purpose. You do this under menu entry Number ranges -> Maintain number ranges for intermediate documents.

• updates the IDoc status according to the BDC error status.

EXTRACT FROM: Z_IDOC_INPUT_ZINVRV

*--- Declaration of local variables

DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.

*-Loop through the IDOCs

LOOP AT IDOC_CONTRL.

*---Loop through the data for the IDOC

LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.

CASE IDOC_DATA-SEGNAM.

WHEN C_SEGNAM.

* Here we get the info from the idoc table

IT_Z1INVRV = IDOC_DATA-SDATA.

ENDCASE.

PERFORM REV_INV.

ENDLOOP.

PERFORM UPDATE_IDOC_STATUS.

ENDLOOP.

FORM REV_INV "Reverse invoice form

*--- Local variables & constants

DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'. "BDC transaction code

*--- Now we can build the bdc table to call the reversal transaction start of screen 109

CLEAR BDC_TAB.

BDC_TAB-PROGRAM = 'SAPMV60A'.

BDC_TAB-DYNPRO = '109'.

BDC_TAB-DYNBEGIN = 'X'.

APPEND BDC_TAB.

*--- Document number

CLEAR BDC_TAB.

BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.

BDC_TAB-FVAL = IT_Z1INVRV-XBLNR. "Billing document number

APPEND BDC_TAB.

*--- OK Code for screen 109

CLEAR BDC_TAB.

BDC_TAB-FNAM = 'BDC_OKCODE'.

BDC_TAB-FVAL = 'SICH'.

APPEND BDC_TAB.

*--- Now we can call transaction 'VF11' with the populated bdc table. The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal). the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale. The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.

CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.

*--- Store the return code for use in another form (status update)

RETURN_CODE = SY-SUBRC.

*--- Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.

IF SY-SUBRC NE 0.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'ZINVRV'

USER = C_ALE_USER

KEEP = 'X'.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = C_TCODE

TABLES

DYNPROTAB = BDC_TAB.

CALL FUNCTION 'BDC_CLOSE_GROUP'

EXCEPTIONS

NOT_OPEN = 1

QUEUE_ERROR = 2

OTHERS = 3.

ELSE. "No problems

C_EXISTS = 'N'.

  • Select from the billing document table to get sales doc number

SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.

  • Select from the sales document table to get user status number

SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND

POSNR = VBRP-AUPOS.

  • Select from the status table to change the user status to pending

SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND

STAT LIKE C_USER_STATUS.

IF JEST-STAT = C_US_PENDING. "User status is pending

JEST-INACT = C_UNCHECKED. "Make pending the active status

UPDATE JEST.

C_EXISTS = 'Y'. "I.E. An entry is already in table

ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.

JEST-INACT = C_CHECKED. "Make everything else inactive

UPDATE JEST.

ENDIF.

ENDSELECT.

IF C_EXISTS = 'N'. "I.E. Pending has never been a status before

JEST-OBJNR = VBAP-OBJNR.

JEST-STAT = C_US_PENDING.

JEST-INACT = C_UNCHECKED. "Make pending the active status

INSERT JEST.

ENDIF.

ENDSELECT. "Select from VBRP (Billing document table)

ENDIF.

ENDFORM. " REV_INV

FORM UPDATE_IDOC_STATUS.

*--- Now we check the CALL TRANSACTION return code and set IDOC status

CLEAR IDOC_STATUS.

IF RETURN_CODE = 0.

WORKFLOW_RESULT = '0'.

IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.

IDOC_STATUS-STATUS = '53'.

IDOC_STATUS-UNAME = SY-UNAME.

IDOC_STATUS-REPID = SY-REPID.

IDOC_STATUS-MSGTY = SY-MSGTY.

IDOC_STATUS-MSGID = SY-MSGID.

IDOC_STATUS-MSGNO = SY-MSGNO.

IDOC_STATUS-MSGV1 = SY-MSGV1.

IDOC_STATUS-MSGV2 = SY-MSGV2.

IDOC_STATUS-MSGV3 = SY-MSGV3.

IDOC_STATUS-MSGV4 = SY-MSGV4.

RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.

RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.

APPEND RETURN_VARIABLES.

ELSE.

WORKFLOW_RESULT = '99999'.

IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.

IDOC_STATUS-STATUS = '51'.

IDOC_STATUS-UNAME = SY-UNAME.

IDOC_STATUS-REPID = SY-REPID.

IDOC_STATUS-MSGTY = SY-MSGTY.

IDOC_STATUS-MSGID = SY-MSGID.

IDOC_STATUS-MSGNO = SY-MSGNO.

IDOC_STATUS-MSGV1 = SY-MSGV1.

IDOC_STATUS-MSGV2 = SY-MSGV2.

IDOC_STATUS-MSGV3 = SY-MSGV3.

IDOC_STATUS-MSGV4 = SY-MSGV4.

RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.

RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.

APPEND RETURN_VARIABLES.

ENDIF.

APPEND IDOC_STATUS.