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 Should End in Error if a field is having value 'x'

Former Member
0 Kudos

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.

endif.

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

regards

Avi..

2 REPLIES 2

Former Member
0 Kudos

Hi!

May be you forgot RETURN before ENDIF?

Former Member
0 Kudos

done