Home > Ask the SAP software/management Experts > SAP NetWeaver, ESA and EAI Questions & Answers > Failing an IDoc in a user-exit
Ask The SAP Expert: Questions & Answers
EMAIL THIS

Failing an IDoc in a user-exit

Axel Angeli EXPERT RESPONSE FROM: Axel Angeli

Pose a Question
Other SAP Categories
Meet all SAP Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 13 July 2006
I have a requirement wherein a user exit must fail the IDoc for a given condition. The condition is clear but my question is how to fail the IDoc. I dont know if the control records are being passed to the exit or not. Do we need to change the control record status to say 51 etc..? This is an outbound IDoc.

Any help will be appreciated. Thanks.


>
The IDoc processing function module has a required parameter "IDOC_STATUS". Here you can enter as many status items as required. They all will appear in the WE05 listing, when an IDoc is displayed. The last entry in the table will become the final status of the IDoc. So if you add a status entry with STATUS-"51" (general error) or "52"= (Application error) you can set the IDoc to failure.

See this nice little function below, that fills the IDOC_STATUS table appropriately from values that are compatible with the SY-MSGV1 …..

function Z_LOGOS_IDOC_STATUS_FILL.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(DOCNUM) TYPE  EDIDC-DOCNUM OPTIONAL
*"     VALUE(STATUS) OPTIONAL
*"     VALUE(STATUS_ERROR) OPTIONAL
*"     VALUE(MSGID) OPTIONAL
*"     VALUE(MSGTY) OPTIONAL
*"     VALUE(MSGNO) OPTIONAL
*"     VALUE(MSGV1) OPTIONAL
*"     VALUE(MSGV2) OPTIONAL
*"     VALUE(MSGV3) OPTIONAL
*"     VALUE(MSGV4) OPTIONAL
*"     VALUE(APPL_LOG) TYPE  BALOGNR OPTIONAL
*"  TABLES
*"      IDOC_STATUS STRUCTURE  BDIDOCSTAT OPTIONAL
*"----------------------------------------------------------------------
*
  clear IDOC_STATUS.
  IDOC_STATUS-DOCNUM = DOCNUM.
  IDOC_STATUS-STATUS = STATUS.
  IDOC_STATUS-MSGTY = MSGTY.

  if MSGTY ca 'EAX' and not STATUS_ERROR is initial.
    IDOC_STATUS-STATUS = STATUS_ERROR.
  endif.

  IDOC_STATUS-MSGID = MSGID.
  IDOC_STATUS-MSGNO = MSGNO.
  IDOC_STATUS-MSGV1 = MSGV1.
  IDOC_STATUS-MSGV2 = MSGV2.
  IDOC_STATUS-MSGV3 = MSGV3.
  IDOC_STATUS-MSGV4 = MSGV4.
  IDOC_STATUS-APPL_LOG = APPL_LOG.
  append IDOC_STATUS.
*
endfunction.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
SAP NetWeaver, ESA and EAI
In an upgrade to SAP ECC 6.0, when do integrated apps get upgraded?
Configuring SAP EDI for sales orders
Installing SAP NetWeaver PI 7.1 on servers running ECC 6.0
Resolving app server connectivity problems for remote users
Should a manufacturing expert pursue SAP PP or SAP SCM (APO)?
How to start an SAP NetWeaver career
How to pursue an SAP developer job even if you hate Java
How to choose between SAP Basis and SAP security courses
Which SAP IDoc type can solve the EDI X12 211 error message?
How to fix two common SAP ABAP problems

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SAP White Paper Topics
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts