Skip to Content

Merge invoice and send email based on customer

Hi Expert,

I have search through the SAP forum and test it, but, it seem does not meet the requirement, Below i will explain the current problem.

I need to generate invoice from VF04, once generated it will send an email to the customer, currently, the customize print program will create one invoice with one pdf and send to customer because it only have one row information that was pass thru NAST

Because of the standard program pass info one by one, so the customize print program will not know which data is the last data so that it can proceed to combine and send an email.

For Example, i have 3 invoice as below

Invoice Number Customer Invoice 1 A Invoice 2 B Invoice 3 B

Current logic,

IF NOT gv_cust = ' '

IF gv_cust = gv_customer

perform merge_invoice

IF gv_count = last row ------>> unfortunately, customize program dont know how many invoice has been selected to be sent an email, so it can't find the last row.

send email


''dont'send email


ELSEIF gv_cust <> gv_customer

"send email for invoice that has been merged

"Clear merge table

" append new invoice into merge table


perform merge_invoice

''dont'send email


Based on above example, is there have possible way or logic to get the number of invoice has been selected so that i can enhance the logic to merge the invoice and send the email based on customer.

Please advised.

Your kindness is most appreciated,

Thanks and Regards,


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 15, 2016 at 05:51 AM


    In general invoice list are used for this. Not sure you can use that. One invoice list combines several invoices together. When you process the invoice list output you exactly know which invoices, invoice items are part of the invoice list and who is the customer of the invoice list or invoices.

    Regards Jack

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jack,

      Thanks for your reply,

      Actually, I want to get the total number of invoices that has been generated in vf04 instead of pass in NAST structure table to the print program As i debug , the standard program will loop the internal table that keep the number invoice generated and it will append it into NAST structure table, then pass to the print program, print program will do the processing to call the smartform, convert to pdf and send to customer's email. So my, intention is to know how i can pass the internal table from the standard table or asiign it globally so that i can accessed it in my print program. Is there any suitable user_exit or possible way?

      Thanks and Regards,