cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

manjunath,

suppress the output from VOFM making it as sy-subrc = 4. and display a message using an exit that output wont be processed as this xyz field is 0.

which tcode are you using ? MIRO? then use the user exit used in miro to display the custom message make it of type I or W what ever you want

Former Member
0 Kudos

Hi,

NAST_PROTOCOL_UPDATE updates output information - messages are visible: invoice -> menu Goto -> Header -> Output -> Processing log.

If You want do display message to the user, use MESSAGE ... TYPE 'I' statement.

But first also check if You really want to display user in some cases tens of messages...

Maybe it would be better to change Condition records in NACE in Output control procedure,

not to print (or even block posting in FI) if value is 0.

Regards,

--

Przemysław

Former Member
0 Kudos

Thanks Przemysław

My requirement is to control the print based on two customiised control tables(Which controls which bill type and sold to party we need to suppress). This can be done in Print program itself.

My problem is only display of message if it is not supposed to be printed. Specifically for Tcodes VF02 and VF31 for scenarios as below.

1 . 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. However I think it is needed here.

2. When I use transaction VF31 - output from Billing for invoices with dispatch time 3 (send with application own transaction) I only get a general error message:

Further suggestion on this would be helpful from all experts.

Many thanks.

Manjunath

Former Member
0 Kudos

Hi Manjunath,

as I wrote - both for pt. 1 and 2 You should use MESSAGE statement after NAST_PROTOCOL_UPDATE functions.

Regards,

--

Przemysław

Former Member
0 Kudos

Thanks for quick response

I used the above said approach, however after testing for point 1, i get "Update was terminated" message .

Please suggest, thanks.

Former Member
0 Kudos

Hi,

unfortunatelly, that's right - immediately printout are performed in update task, so it is not possible to display user message.

Regards,

--

Przemysław

Former Member
0 Kudos

You need to create an output requirement (using VOFM -> Requirements -> Output control), put your coding in the requirement routine to stop the invoice print output and assign the requirement routine number against the output type in your output determination procedure in NACE.

Inside the routine you will set sy-subrc to 4 if the invoice net value is zero and you can also update messages to NAST_PROTOCOL_UPDATE function. This routine is called before the output type is triggered.

You cannot issue messages from within the print program as it is executed within an update process that is delegated to the system(and detached from the user gui session) and is executed when the invoice save is committed.