Skip to Content
0
Jul 21, 2011 at 10:17 AM

Held Purchase order need not be created.

134 Views

Hello SAP gurus,

I have implemented a check while creation of purchase order which is working fine and error messages is thrown when the desired condition is met.

Now the issue is even though the error message is issued and the document is still faulty , the document is allowed to be saved as held PO.

How can i prevent the saving of such faulty document.

I used the command leave screen in my code as follows , but its not working.

LOOP AT lt_accountings INTO ls_accounting.

ls_accounting_data = ls_accounting-accounting->get_data( ).

if ls_accounting_data-anln1 is not initial.

select single werks from anlz into (lv_werks) where anln1 = ls_accounting_data-anln1.

if sy-subrc eq 0.

if lv_werks ne ls_detail-werks.

im_header->invalidate( ).

MESSAGE 'Maintain proper Plant ' TYPE 'E'.

leave screen.

endif.

endif.

endif.

ENDLOOP.

Thanks and Regards ,

Sij.