cancel
Showing results for 
Search instead for 
Did you mean: 

How to get that the invoice has been printed or not?

suryasarathi_basu
Participant
0 Kudos

Hi Experts,

I have a issue in Printing Invoice. I have to make 2 copies of an invoice. One is Original and another is Duplicate. I have made that with copy windows. But the requirement is that when the original copy of a selected invoice has been printed then from the second time only the duplicate copy will be printed. How to do that in ABAP? How to get the information that the invoice has been printed or not?

Regards,

SURYA

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Surya,

Kindly check the below thread it will help you surely.

If you are using Z- Transactions to print the form you need to maintain the table to keep the count.

Regards,

Ragunathan.R

suryasarathi_basu
Participant
0 Kudos

Hi Ragunathan.R,

thanks for your reply.

NAST table cannot be used as I am using Z tcode and Z driver program to print the form.

I am using Z tcode and Z driver program to print the form. Suppose I am maintaining a Ztable for invoices which are printed. But how to update that z table when I click the print button in the output device window? I want to update the ztable when Print button is clicked but the table will not be updated when Print preview button will be clicked.

Thanks & Regards,

SURYA

Former Member
0 Kudos

Hi Surya,

You can do it as shown below, add the below code line in the smartform

IF job_output_options-tdpreview EQ 'X'.

do not update the z table

else.

update the ztable

endif.

select the entries from ztable.

if sy-subrc eq 0.

print copy.

else.

print original.

endif.

Regards,

Chen

Edited by: Chen K V on Mar 29, 2011 9:19 AM

suryasarathi_basu
Participant
0 Kudos

Hi Chen K V ,

That will work. But suppose the user clicks on print preview and from the previewed windows the user select print option from the Window menu - 'Text Menu'. In that case the ztable will not be updated. What is the solution for that?

Regards,

SURYA

Former Member
0 Kudos

Hi Surya,

Try the below approach, i think this is better than the previous approach and takes care of the print from "text menu" as well

select from z table.

if sy-subrc eq 0.

call "SMARTFORM_COPY"

else.

  • While calling the smartform, make sure you import the "JOB_OUTPUT_INFO" parameter,

  • and after you call the smartform,

call "SMARTFORM_ORIG"

exporting...

....

...

Importing...

....

job_output_info = w_job_output_info

...

exceptions...

....

.

If sy-subrc eq 0.

if w_job_output_info EQ 'X'.

update the Z table.

else.

do not update the z table

endif.

endif.

endif.

Regards,

Chen

Former Member
0 Kudos

i still dont get why you dont work with NAST?

Any Z-Driver program should do this nast updates anyway. If you copied from some standard driver program, eg.G. rvadin01, you have this functionality already.

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Florian,

The OP has mentiond:

I am using Z tcode and Z driver program to print the form

So i don't think a custom t-code should update NAST!

Cheers,

Suhas

Former Member
0 Kudos

erm yes it should update nast!

SuhaSaha
Advisor
Advisor
0 Kudos

>

> erm yes it should update nast!

Please enlighten me then

Former Member
0 Kudos

Well i dont know how far they went away from standard in their Z-TCODE, Z-Driver program and Z-Form.

But i guess an invoice is still an invoice beeing stored in tables VBRK/VBRP.

Those invoices got document categories VBRK-FKART to which we have a customized output type scheme.

Anyway if you process an output type, normally the driver program gets triggered and struncture NAST is filled with all information needed for that print.

So why not wrting that NAST info back to nast when ready with form procession?

maybe i´m forgetting something, seeing not a certain problem. but still i dont see a reason NOT to update nast when processing ANY form.

Former Member
0 Kudos

check your caller program for the same and just find out the output type. for that purpose use the Tcode: NACE for finding the output type than proceed accordingly.

Regards,

Akg

Answers (2)

Answers (2)

Rushikesh_Yeole
Contributor
0 Kudos

check the requirement routine for invoice output type.

Check the NAST-VSTAT status in that routine..according to set sy-subrc. print program will print as it is.

Former Member
0 Kudos

Hi Surya,

I presume that you are using message control with an output type to do this, if so you can check for an entry in the NAST table.

Check for the status in the field NAST-VSTAT.

If you are not using message control, provide more info on the approach you are using.

Regards,

Chen