cancel
Showing results for 
Search instead for 
Did you mean: 

Create multiple pdf documents email it to multiple reciepients

former_member183915
Active Contributor
0 Kudos

Hi ,

I have a requirement in which i need to create multiple adobe forms and email it.

i.e. If 2 records are selected then 2 pdf need to be generated. These PDF would have same layout but different data depending upon the record selected.

Is dynamic creation of entire Adobe form possible?

If yes then how? I tried searching but i could find how to add multiple pages in a single adobe form but i need to create multiple PDF depending upon the number of records selected.

Thanks,

Navya.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Navya,

I belive you want to generate the forms using standard approach of functional modules, rather than WebDynpro / web requests.

if so follw the below approach.

My example below is I will have N records where program has to send 1 document per record to N customers.


loop through N records..
      Set document parameters if any.
      CALL FUNCTION 'FP_JOB_OPEN'
      if subrc = 0 set      xopen = 'Y'. (temp variable to see the fom generation is completed else handle respective message)
      
      CALL FUNCTION save_fm_name passing on the requred record data.

      if xopen == y
            CALL FUNCTION 'FP_JOB_CLOSE'
            if subrc == 0 clear xopen.
     determine the required mailing address.
     call email function module with PDF as attachment
end of loop.

Hope this helps you to think the approach, let me know if you need any more help in this regard.

Cheers,

Sai

former_member183915
Active Contributor
0 Kudos

Hi Sai ,

This is how we do using abap wherein we can use function modules but i am using web dynpro Java.

Any idea , how we can do this using webdynpro Java?

In my case , Number of PDF = Number of records .

For e.g:

If 'n' employees records are selected then 'n' number of pdf needs to be generated. Each pdf will have same layout but different data depending upon the employee.

Regards ,

Navya.

Edited by: navya_4321 on Jan 27, 2011 6:01 AM

Former Member
0 Kudos

Hi,

If the purpose is to display the PDF on the screen for user i would go for webdynpro.

but if the requirement is only to mail the documents whats the reason having a webdynpro component for that and having all these hassels.

anyways I never triggered a email function nor generated output forms in Webdynpro, let me check if i can find something for you @ this.

Cheers,

Sai

Former Member
0 Kudos

Hi,

The best way to solve your issue is to define in the context as bellow

DATA

- DATA_HEADER type internal table

--DATA_DETAIL type internal table

You make a link between header table and detail table with a key , then in the layout you define it with "Table" and for each record of HEADER you specify that it must be on top of page then it will make a page break on change of header.

Hope this help you

Regards

former_member183915
Active Contributor
0 Kudos

Hi Bertrand ,

I need to implement this using webdynpro Java.! approach that i could use here is create multiple InteractiveForm Child elements but this needs to be done dynamically.

Something similar to what is given in below link :

Link:[http://help.sap.com/saphelp_sm32/helpdata/EN/c0/ead8a21ba49f4896c64851677f8ec9/content.htm]

Do you have any link or any code snippet which show creation of InteractiveForm element at runtime.

Regards ,

Navya .

Former Member
0 Kudos

Sorry,

I don't have it to help you .

For me the easyest way to solve your isue is to define you interface as i describe juste before then you will have only one forms with several pages .

Regards

Former Member
0 Kudos

Hi,

I have never done this approach for interactiveforms in webdynpro but have done something like this for other UI elements.

sry also dont have any code as such now.

have a form created as required in the 1st place to a view, it might be giving a pdf source maintain it.

create a face less view in a new window

create a interactive form UI element at runtime in wDJ and add it to the root.

set the form properties.

trigger outbound plug to this view navigate to the form,

once form is loaded, immedatly close the window.

get the pdf file from the context and then write the emailing script.

this might give you a way of thinking, hope this works.

But as the other blogger posted to your post, if its like you need to display multiple form intances to a single PDF file, thats visible on the screen thats quite easily possible.

cheers,

Sai

former_member183915
Active Contributor
0 Kudos

Hi Sai,

Now i am able to generate multiple PDF but now the issue that i am facing is all the PDF show the same data.

I have a context node of cardinality 1:n which has all the records and which is the data source for th PDFs generated but in all the PDF it shows the same data .

I wish that if the context node has 3 records then the 3 PDFs generated should show 3 differnt records present in the context node.

Could you please tell me if it is possible to show different data in different these PDFs!!!!

Regards ,

Navya

Former Member
0 Kudos

Hi Navya,

Did you implement this with Web dynpro.?

When you say the context is with 3 records and the same context is being used for the PDF source.. then you need to fill 1 record each to the context in the loop.


some thing like this..
Context 1 for actual data in the WD View
Context 2 for pdf source.

loop at context 1
read record
set record to context2
call the pdf.
on sucess clear context 2
end loop.

does this help ...?

Cheers

Sai

former_member183915
Active Contributor
0 Kudos

Hi Sai ,

i did try this approach.

But now the problem is all the PDFs shows same data which is the last data populated in that context node.

Do you have any inputs on dynamic node creation which can be useful in this scenario

Regards ,

Navya.

Edited by: navya_4321 on Feb 9, 2011 7:44 AM

Edited by: navya_4321 on Feb 9, 2011 8:26 AM

Former Member
0 Kudos

Hi Navya,

My approach should work, that how we do customer statements, please verify whats been populated to the wd context node at runtime.

Dynamic nodes in wd is possible but not in the adobe form.

Cheers,

Sai

former_member183915
Active Contributor
0 Kudos

Hi Sai ,

I could resolve the issue of data population in multiple PDFs.

I created the nodes which is the data source for the adobe forms dynamically.Now if 3 form needs to be generated , 3 different nodes are generated dynamically.Basically now all the forms would have different data source.

The issue was ; at runtime , even though the data in the node was refreshed but the data source for the adobe form was same.So it used to refer the latest data present in the context node.

Regards ,

Navya