Skip to Content
Apr 15, 2016 at 02:30 AM

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,