cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform - Printing 'Repeat Printout' for Repeated Print Billing Invoice

Former Member
0 Kudos

Dear All,

Can anyone advice how do i check if an invoice was printed in a SMARTFORM and to print a line of text if it was already printed?

I would like to print the text 'Repeated Printout' on my SD Billing Invoice. I developed the invoice as a smartform, not a sapscript.

I know that we have this NAST Table and field VSTAT.

I wrote in the smart form :

/: IF NAST-VSTAT EQ '1'.

REPEATED PRINTOUT

/: ENDIF

However, this does not work. Please advice. Thank you.

Best Regards,

Junwen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Are you passing the all the NAST records for that document to SMART form, you might be passing only the current record and for that the status might be 0 as it is still under process, you will have to look older NAST records for the document.

Once you crack that, for the text element, where you want to print "Repeated Print out", in the conditions tab, check for the NAST-VSTAT field = 1.

That should work.

Regards,

Ravi

Note - Please mark all the helpful answers

Former Member
0 Kudos

Hi Ravi,

I am not sure if all NAST records are passed to the smartforms. I am new to smartforms and still not sure how they work exactly.

I know that for SD Billing invoice config in SPRO, if i am using a sapscript, the calling program i am using is the standard RLB_INVOICE.

If I am using Smartforms, I do not know if the same program is called. Is it the same program?

Adding NAST-VSTAT field = 1 in the conditions tab results in the error NAST is not recognized or valid in the form. In SAP script, i will not have this issue because the table NAST is included in RLB_INVOICE.

Any advice?

Best Regards,

Junwen

Former Member
0 Kudos

Hi,

Here is the solution.

1. All the NAST records of the specific document are not passed to the smart form.

2. So, you will have to do that yourself by firing a SELECT statement on the NAST table.

3. As you would know the document number which you are processing, get all the entries for that object key from NAST table.

SELECT * FROM NAST INTO ITAB WHERE OBJKEY = 'Document No.' and VSTAT = '1'.

4. This SELECT will give you all processed output conditions for that document, now you can determine whether a previous output has been processed successfully and accordingly put a condition on the text element.

Hope its clear now, how to do it.

If the issue is resolved, please close the thread.

Regards,

Ravi

Former Member
0 Kudos

Dear All,

Thanks Ravi for the detail explaination, however i still am not quite sure how are the smartforms linked to the printing programs.

For my problem, i am assigning my smartform Z_SDBL_INV1 to my output type ZA31 in SD->Billing->Invoice List->Maintain Output for invoice list->output types.

Can anyone enlighten me which is the print program that calls the smartform invoice in my case?

Is it RLB_INVOICE? I know that if I am using sapscript, this will be the printing program that calls my sapscript.

However, is this also the printing program for smartform?

Best Regards,

Junwen

Former Member
0 Kudos

Hi,

If its a custom smart form then it has to be a custom print program calling your smart form.

You can see the entries for these in the TNAPR table. Put your form name in FONAM field and you should be able to see which program is calling your form.

Regards,

Ravi

Former Member
0 Kudos

HI Junwen,

Hope you have copied LB_BIL_INVOICE and modifying the smartforms .

If it is so then

there is a variable in the form interface IS_REPEAT .

This holds the result whether it is original or duplicate invoice .

So you can make use of that and code something like

IF is_repeat = space.

invoice_text = '(Original)'.

ELSE.

invoice_text = '(Duplicate)'.

ENDIF.

Regards,

Guru

  • mark if helpful

Former Member
0 Kudos

Dear All,

From the above posts and after doing some searching in the system, I think that the SAP standard program RLB_INVOICE is the the program that calls both sapscript and smartforms for the SD invoice printing.

Thank you for your wonderful advice!

Best Regards,

Junwen

Answers (1)

Answers (1)

Former Member
0 Kudos

The way is check for a field of char1 which is not used for any purpose in one of the tables ur using...and when it is for first time printing, u can make this field as X...So, when any one is trying to print the form...check whether this field is space or 'X'....if space print it or else if 'X' then u can insert ur message at appropriate position.