Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

IDOC Should End in Error if a field is having value 'x'

Hi Gurus,

I have an idoc,

If vendor material number is not correct run the idoc to error.

Please see the code below.

Check the Vendor Material Number is correct one, if not run idoc to error.

select single idnlf

from eina

into lv_idtnr

where matnr = lv_matnr

and lifnr = lv_lifnr

and idnlf = wa_fekpo-idnlf.

if sy-subrc ne 0.

wa_status-uname = sy-uname.

wa_status-status = '51'.

wa_status-docnum = i_control-docnum.

wa_status-msgty = co_err.

wa_status-msgid = co_msgid.

wa_status-msgno = co_msgno.

wa_status-segnum = segment-segnum.

wa_status-segfld = co_field.

wa_status-repid = co_repid.

append wa_status to i_status.

  • CLEAR wa_status.


but still IDOC is getting processed. Can you please let me know , how to check this condition and run the idoc to error.



Former Member
Not what you were looking for? View more on this topic or Ask a question