Skip to Content
0
Jan 20, 2012 at 12:00 PM

Suppress the print of the invoice when the value is 0 and display message

921 Views

Hi Experts,

The scenario is to suppress the print of the invoice when the value is 0 and display error message to user.

To solve this purpose, i have put a check in print program as below.

IF vbdkr-netwr EQ 0.

*change the return code

retcode = 1.

*display the error message

CONCATENATE vbdkr-vbeln ':Zero value Invoice, Print not allowed' INTO mstring .

syst-msgno = '999'.

syst-msgid = 'ZNDSN'.

syst-msgty = 'I'.

syst-msgv1 = mstring.

CALL FUNCTION 'NAST_PROTOCOL_UPDATE'

EXPORTING

msg_arbgb = syst-msgid

msg_nr = syst-msgno

msg_ty = syst-msgty

msg_v1 = syst-msgv1.

EndIF.

Check retcode = 0. "skip further processing for print of invoice

However here the functionality is working by not allowing to print, but no displaying of proper message when i issue output in VF03 and VF31.

Also When I select dispatch time 4 ( send immediately when saving the application) in VF02 - header output - further data and save the invoice, I do not get a message.

I tried with various message types, however except Msgtype E, no other message types are solving the purpose. However, if i use message type as E, it will not be a normal processing exit.

Please suggest if i have to use any other to display the message and come out

Please help resolving this problem.

Thanks in advance