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: 

Merge invoice and send email based on customer

former_member216218
Participant
0 Kudos

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 NumberCustomer
Invoice 1A
Invoice 2B
Invoice 3B

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

            else.

         ''dont'send email

        endif.

    ELSEIF gv_cust <> gv_customer

      "send email for invoice that has been merged

      "Clear merge table

      " append new invoice into merge table

ELSE.

      perform merge_invoice

      ''dont'send email

ENDIF.

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,

Liyana

2 REPLIES 2

jack_graus2
Active Contributor
0 Kudos

Hi

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

0 Kudos

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,

Liyana.