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: 

ABAP : Add Yes / No popup before invoice print

aneel_munawar
Participant
0 Kudos

Dear Abap Experts,

We want to give the user a popup message (Yes / No) before printing the billing document (Invoice , The Tcode is VF01).

I mean user must select Yes for print out and no for no print out by the printer.

How can we do this.? Should we use user-exit or by some ABAP code.? The program name in the NACE is RLB_INVOICE.

I have tried all the userexits for the Tcode VF01 but no success. I have checked many threads on SCN but no solution found.

I will be very thankfull to you if any one can help. Image is also attached for more clarification.

Regards,

Aneel Munawar

1 ACCEPTED SOLUTION

Former Member

Hi Aneel,

As the output is only triggered in V1 update process ( When you use Dispatch time "4" - Send Immidiately ) there is no way you can give popup before printing the form ).

Do this. It should work.

1. Write the code to give popup before invoice save . You can use BADI/EXIT/ BTE based on the floowing post.

2. In the exit code save the response of user ( Yes / No ) along with the invoice number in a custom table. The reason we need custom table instead of ABAP Memory option is that by the time the print program will be called the memory will be refreshed by the COMMIT issued by SAP.

3. Copy the driver program ( RLB_INVOICE ) . Select the response from the newly created custom table and set the flag TDIMMED of output options accordingly. Unfortunately the driver program has to be copied to write the code or you can use the generic BADI for driver program ( I am not sure RLB_INVOICE calls that or not ) to write the code. If you copy the driver program the output type configuration needs to be changed or you can ask for new output type copied from the standard one to use your custom driver program.

4. Delete the response from the custom table if necessary.

Regards,

R

37 REPLIES 37

Former Member
0 Kudos

Hi

Copy Program RLB_INVOICE and write code and assign to NACE.

Regards,

Chandu

0 Kudos

Dear Chandu,

I have tried this procedure but its not working. RLB_INVOICE  is not being called when I save the Invoice.

Regards,

Aneel

0 Kudos

Hi Aneel ,

Check once again if  Nace transaction to see the Z-program(Copy of RLB_INVOICE ) as suggested by chandra mapped to output type and correctly configured .If the should be called if every is ok.

Regard,

Nilesh

0 Kudos

Dear Nilesh,


RLB_INVOICE is attached in the NACE. I have created breakpoints in the RLB_INVOICE on each module but program do not stops when I save the Invoice.

Will it work if I create Z program of RLB_INVOICE.?


Regards,

Aneel


0 Kudos

Hi  Aneel,

If the driver program RLB_INVOICE is attached correctly to the output type you are  using then it should go in entry routine in the program specifies in nace because that is only entry point in the program  .  Re-visit the break -point and place in the proper place .

I suggest  that If you want to use popup screen then you have create a copy of   RLB_INVOICE into Z-program  be mindful  The dialog will appear in foreground mode and not background mode  .



Best Regards ,

Nilesh


0 Kudos

Dear Nilesh,

The driver program is RLB_INVOICE. I have attached the image. I have placed the break-point in the entry routine but when i save the invoice, it does not stops on the break point. What can be the issue.?


Regards,

Aneel Munawar


0 Kudos

Hi Aneel,

Could also show screen of invoice output type,did it was process successfully .

Thanks

Nilesh

0 Kudos

Dear Nilesh,

I have uploaded the image.

Regards,

Aneel

0 Kudos

Hi Aneel,

Every thing appear to be fine .Put break-point in Smart forms Function  call and also in FM source code check it is going in source code of FM.

in VF02 goto- header -output  type and repeat output and click on futher data click on send with own transaction and save . GoVF03 and issue output again . It should go in program.

Regard,

Nilesh

0 Kudos

Dear Nilesh,

This program stops by using this option but I dont want to use this option send with own transaction and save. I want to use 4th option, because after click the save button, the report should print if user selects the

Yes option.

Hope my point is clear.

Thanks

Aneel

0 Kudos

Hi Aneel ,

Are you using VF01 or VF03 to debug ? 

Try debugging with update task . check are you able debug it.

Regard,

Nilesh

0 Kudos

Hi,

I am using VF01 to debug.

Regards,

Aneel

0 Kudos

Hi Aneel,

have you tried with update debugger  ?

Regard,

Nilesh

0 Kudos

Hi Nilesh,

I have not tried update debugger . ? How can I use that.?

Regard,

Aneel

0 Kudos

Hi Aneel,

Before you click on save type  /h press enter  in command option  then click on save .it will go in debug mode .Click on  setting in of debugger window click on changes debugger setting select update check box and click on save after that try F8 and check it is going to code of driver program.

regard,

Nilesh

0 Kudos

Dear Nilesh,

It goes to the debug point but not in the RLB_INVOICE program.

Regards,

Aneel

0 Kudos

Hi Aneel  ,

If it going in the program in debug mode that it must be printing the output , try putting break point in RSNAST00 at perform which call the program name and smart form nace configuration TNAPR table .

and check the if that goes there in debug mode.

Thanks

Nilesh

0 Kudos

Dear Nilesh,


Thanks for your help. I have opened the RSNAST00 program. Can you tell me that in which subroutine, I should place the breakpoint.? Image is also attached.


Regards,

Aneel

0 Kudos

Hi Aneel,

At line 1318 put break-point and check in update debug mode .

Hope you will be able to get in debug screen

Regard,

Nilesh

0 Kudos

Dear Nilesh,


I have placed the break point in RLB_INVOICE then opened VF01 and then before click the save button,

I enabled /h  debugging. But when I press F8 the cursor does not stop in the RLB_INVOICE  program in the ENTRY routine. Which is the name of the program in NACE.


Regards,

Aneel


0 Kudos

It won't stop.

Rather it shouldn't.

Idea is quite clear.

While saving a billing document using VF01, driver program will not be triggered, reason being saving won't trigger the form output procedure. ( though an output type can be assigned while saving vf01/02 ).

0 Kudos

Dear Sijin,

I have set the output type 4 which sends the output direct to the printer after saving the invoice (vf01). RBL_INVOICE is the drive program which prints the invoice. It means driver program is called when we save the invoice. Hope my point is clear .

Thanks

Aneel

0 Kudos

have set the output type 4 which sends the output direct to the printer after saving the invoice (vf01)

Fine, I was not aware of this fact.

Then it should trigger that breakpoint which you have set.

If the breakpoint is triggering you can place a pop up call just before call function for smartform.

This should work.

0 Kudos

Hi Aneel ,

I have suggest to debug in update mode, did you tries that using break point in RSNAST00 at line 1381 .

Regard,

Nilesh

0 Kudos

Dear Nilesh,


Yes it stops but it does not stop in the RBL_INVOICE program, which is the driver program for printout.


Regards,

Aneel

0 Kudos

hi Aneel,

If you were able to go in RSNAST00 at line 1318 at perform with program name and form name than is go to the driver program  where else it will go it is call program name and form name

So i think it should go in driver program

Regard,

Nilesh

0 Kudos

Hi Aneel,

If you had really debug, you should have by now come to know that driver program is called in update task and you should not call dialog(Pop Up) screen in it.I am not sure why you have got this requirement but you can  ask  functional guy to change configuration setting so the output can be set for particular case and not get printed in case of other. See Naimesh reply for further reference. I hope you understand this and should be very clear to you.

Regards,

Nilesh

0 Kudos

Dear Nilesh,

I got your point and very thankful to you for your help.

Regards,

Aneel


Former Member
0 Kudos

Hi

check Output condition type in VV31 for Dispatch time as ' 3' - send with application own transaction.

its display preview , user want to close it without print.

Regards,

Chandu

0 Kudos

Dear Chandu,

I want to set the Despatch time to option 4 but not 3.

Regards,

Aneel

0 Kudos

Hi Aneel,

The standard program RSNAST00 will be called to print/trigger idocs from  a message type.

Follow the below approach to debug :

1. Set the dispatch time as 1 and save the document.

2. Run RSNAST00 program with document number and message type and debug to find the place to add the new logic for pop up.

Thanks

-Learner

0 Kudos

Hi Munawar,

Have your tried with the approach suggested by me. Try it once,

Follow the below approach to debug :

1. Set the dispatch time as 1 and save the document.

2. Run RSNAST00 program with document number and message type and debug to find the place to add the new logic for pop up.

3. Set break-point in the entry routine of standard program. Check the call stack once the program stops at break-point.

Thanks

-Learner

0 Kudos

Dear Learner,


System is not stopping on the break-point in RBL_INVOICE entry routine.

Regards,

Aneel


Former Member

Hi Aneel,

As the output is only triggered in V1 update process ( When you use Dispatch time "4" - Send Immidiately ) there is no way you can give popup before printing the form ).

Do this. It should work.

1. Write the code to give popup before invoice save . You can use BADI/EXIT/ BTE based on the floowing post.

2. In the exit code save the response of user ( Yes / No ) along with the invoice number in a custom table. The reason we need custom table instead of ABAP Memory option is that by the time the print program will be called the memory will be refreshed by the COMMIT issued by SAP.

3. Copy the driver program ( RLB_INVOICE ) . Select the response from the newly created custom table and set the flag TDIMMED of output options accordingly. Unfortunately the driver program has to be copied to write the code or you can use the generic BADI for driver program ( I am not sure RLB_INVOICE calls that or not ) to write the code. If you copy the driver program the output type configuration needs to be changed or you can ask for new output type copied from the standard one to use your custom driver program.

4. Delete the response from the custom table if necessary.

Regards,

R

0 Kudos

Dear Rudra,

Thank for your help. Let me check it.

Regards,

Aneel

naimesh_patel
Active Contributor
0 Kudos

As Rudra mentioned that, you should not send popup during the V1 update. Processing time 4 gets triggered as soon as document gets saved.

BTW, Giving popup in the output processing is the bad idea. Think of batch (Tcode VF04) where you user is generating the output. Poor fellow has to say yes so many times...

If users don't need to have output, you need to suppress it via configuration - don't propose the condition which generates the output. Your SD consultant would know, how to control it.  If for some plants, the users don't want to print the output, create condition based on the plant and don't maintain this plant in the condition table.

Billing document is rather static document. It doesn't gets changed that often like Delivery or Order. Thus, user would need to go into the billing document and change something (which many not be require) to trigger the output.

Still if you want to have the Popup, Provide the popup during the output determination. Based on the user input, set SY-SUBRC  to 0 or 4 (4 when user say no). This way the output would be ignored and you wont have output.

Regards,

Naimesh Patel

aneel_munawar
Participant
0 Kudos

Dear All,

Issue is being closed now.

I am very thankful to you  all for  your help and comments.

As mentioned by Rudra,

This post helped me out to solve the issue.

Thanks Rudra.

Regards,

Aneel