cancel
Showing results for 
Search instead for 
Did you mean: 

sending mail based on condtion using smartform

Former Member
0 Kudos

Hi friends,

I have header data and item data...in the below way..



header data

   vbeln     =     1000
 
item data 
 
  posnr      recipient       materail no       quanity     amount
  
    10          1000              abc                 100             10000
    20          2000              pqr                  100               5000
     
     -               -                  -                       -                    -
     -               -                  -                       -                    -

      n             n                   n                        n                  n  



Now the for a particular recpient the data may go to next page ie: several pages.. if the item data for the same recipient is same then it should not display the header data in the 2nd page but it should only print the item data.

now based on the recipient changes i should print agian the header data and then the item data from the next page.

and also as the recipient is changing the mail should go to another person ie: all the related recipients mail will be send to one person and others to some other person

ie: recipient 1000 --- person1

recipient 2000 --- person2

like that.

how can i do..? can any one suggest me

Regards

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi..

I implemented similar one just a month back. But, I am not sure I can explain it completely or not... but there are few steps.

There are two solutions actually.. I am giving the simplest one...

Step 1 : Create just one page (Even header data will be within MAIN page)

Step 2 : Build an internal table combining header and item data.

Vbeln item material recipient

1000 10 mmm 10001

1000 20 nnn 10002

and so on

SORT itab by recipient.

Step 3 : Use loop Node to loop thru' itab

Use on change functionality (Copy current WA to Temp. WA to check the recipient change.. and all that code to be

implemented) For each New recipient, set flag 'X'. Also change the Page (Use command Node to start the new page) - Do not forget to tick 'Not on First Page' in conditions tab.

Display header Text/Block/Template with condition Flag = 'X'. And Item table without any condition.

The second solution is requirement specific... Let me know whether this works... If not, i'll give you the other

- Audy. (Email is in my business card, you can use that)

matt
Active Contributor
0 Kudos

Please keep discussions on line so all can share the knowledge.

matt

Former Member
0 Kudos

Hi audy,

thanks for ur valuable answer.

my requirement is now that when i am sending mail its giving runtime error DOCUMENT_NOT_SENT.

i am using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

pdf is created sucessfully. but error is mail sent.

and important is its external mailing, means from sap to customer/vendor as per their mail id maintained in tables.

dk

Former Member
0 Kudos

Hi,

i done it successfully.

thanks all of you.

supress printer dialog.

WA_CONTROL_PAR-GETOTF = 'X'. "Set this to get OTF data

WA_CONTROL_PAR-NO_DIALOG = 'X'. "It supresses the Printer dialog.

WA_OUTPUT_OPTIONS-TDDEST = 'LP01'."Set printer

and pass to SF function.

to send mail :

in FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' , the parameter for receiver has to maintain like

w_receivers-rec_type = 'U'. append.

regards

Former Member
0 Kudos

Kumar,

Did it work for you too...???

Former Member
0 Kudos

Hi audy,

yes its working. if you have any doubt then ask where you have ?

regards

dev

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi kumar,

how you solve this , bcoz i am facing the same problem.

regards,