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

IDoc error handling

0 Likes
683

Hi Friends ,

I have a standard IDoc . Is there a way to trigger a job when IDoc fails . I see there is an option called After event in SM36 .

Is it possible to trigger an event when IDoc fails , which in turn will trigger the job ?

I have little doubt, is the event in IDoc( Process code ) and event which triggers the background job are same ?

If this is possible , please let me know the T Code to create event which can be used in IDoc .

Regards,

Kiran.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
534

Hi Kiran,

SAP standard event inputErrorOccurred for objecttype IDOCAPPL is triggered when an IDoc fails. So you can trigger a workflow that inturn triggers a background event which starts a background job.

Please refer URL for cretaing events in background processing.

[http://help.sap.com/saphelp_nw70/helpdata/en/20/2d513897110872e10000009b38f889/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/20/2d513897110872e10000009b38f889/frameset.htm]

Triggering Events from ABAP Programs : Similar logic needs to be programmed in workflow.

DATA:

p_eventid TYPE btceventid,

p_eventparm TYPE btcevtparm,

p_server TYPE btcserver.

  • Obligatory parameter: EventID.

  • EventID should be an existing event already defined in transaction

  • SM64 or using CREATE method of class CL_BATCH_EVENT:

p_eventid = 'SAP_TEST'.

  • Optional parameters: event parameter and target server.

p_eventparm = 'Event parameter'.

p_server = ''.

CALL METHOD cl_batch_event=>raise

EXPORTING

i_eventparm = p_eventparm

i_server = p_server

i_eventid = p_eventid

EXCEPTIONS

excpt_raise_failed = 1

excpt_server_accepts_no_events = 2

excpt_raise_forbidden = 3

excpt_unknown_event = 4

excpt_no_authority = 5

OTHERS = 6.

CASE sy-subrc.

WHEN 0.

EXIT.

WHEN 1 OR 2 OR 3.

  • Raise failed.

WHEN 4.

  • Event does not exist.

WHEN OTHERS.

  • Raised failed due to unknown reason.

ENDCASE.

Hope I didn't confuse you. Sequence is IDoc fails->IDOCAPPL~inputErrorOccurred event raise by system->Custom workflow to trigger background event->Job scheduled with start condition as BG event.

Regards,

Abhijith

2 REPLIES 2
Read only

Former Member
0 Likes
534

Hi,

use SWEL to find out which event gets created when an IDOC fails

Thanks & regards.

Read only

Former Member
0 Likes
535

Hi Kiran,

SAP standard event inputErrorOccurred for objecttype IDOCAPPL is triggered when an IDoc fails. So you can trigger a workflow that inturn triggers a background event which starts a background job.

Please refer URL for cretaing events in background processing.

[http://help.sap.com/saphelp_nw70/helpdata/en/20/2d513897110872e10000009b38f889/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/20/2d513897110872e10000009b38f889/frameset.htm]

Triggering Events from ABAP Programs : Similar logic needs to be programmed in workflow.

DATA:

p_eventid TYPE btceventid,

p_eventparm TYPE btcevtparm,

p_server TYPE btcserver.

  • Obligatory parameter: EventID.

  • EventID should be an existing event already defined in transaction

  • SM64 or using CREATE method of class CL_BATCH_EVENT:

p_eventid = 'SAP_TEST'.

  • Optional parameters: event parameter and target server.

p_eventparm = 'Event parameter'.

p_server = ''.

CALL METHOD cl_batch_event=>raise

EXPORTING

i_eventparm = p_eventparm

i_server = p_server

i_eventid = p_eventid

EXCEPTIONS

excpt_raise_failed = 1

excpt_server_accepts_no_events = 2

excpt_raise_forbidden = 3

excpt_unknown_event = 4

excpt_no_authority = 5

OTHERS = 6.

CASE sy-subrc.

WHEN 0.

EXIT.

WHEN 1 OR 2 OR 3.

  • Raise failed.

WHEN 4.

  • Event does not exist.

WHEN OTHERS.

  • Raised failed due to unknown reason.

ENDCASE.

Hope I didn't confuse you. Sequence is IDoc fails->IDOCAPPL~inputErrorOccurred event raise by system->Custom workflow to trigger background event->Job scheduled with start condition as BG event.

Regards,

Abhijith