on 09-14-2010 3:10 PM
I am aware, that there are questions regarding "Printing Multiple forms", but I didn't find answers there.
Still my system is not working as expected:
1. FP_JOB_OPEN is called
2. the generated Adobe Forms function is called multiple times
3. FP_JOB_CLOSE is called
This program doesn't deliver all the pages, but just the first call. How shall I solve this problem?
(Coding should work anywhere with copy-pase.)
data: fm_name type rs38l_fnam,
fp_docparams type sfpdocparams,
fp_outputparams type sfpoutputparams.
parameters: p_fpname type fpname default 'FP_TEST_02'.
* Get the name of the generated function module
call function 'FP_FUNCTION_MODULE_NAME'
exporting
i_name = p_fpname
importing
e_funcname = fm_name.
* Sets the output parameters and opens the spool job
call function 'FP_JOB_OPEN'
changing
ie_outputparams = fp_outputparams
exceptions
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
others = 5.
* Call the generated function module
call function fm_name.
* SECOND CALL ****************************
call function fm_name.
* Close the spool job
call function 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
Hi ZSOLT,
In order to call the form multiple times please do the following,
1) Just before your FP_JOB_OPEN you need to pass the output parameters (good practice). You can also set other parameters as well (for example nodialog, preview, copies., etc)
CLEAR fp_outputparams.
fp_outputparams-dest = 'PDF1'. "Default pdf printer
fp_outputparams-reqnew = 'X'. "New spool request
Now call your FM FP_JOB_OPEN with the above output parameters.
2) Usually this step is processed in a loop. (getting your interface data into a internal table and then looping at it)
But here I am enhancing your example code.
In order to trigger the form multiple times you need to change some input data to the form (for example I have changed date and time below in the prepare test data sections) so that the call function fm_name gets regenerated every time there is new data
data l_datatypes type sfpdatatypes.
prepare test data
l_datatypes-char = '#'.
l_datatypes-string = 'Auf geht''s! '. "#EC NOTEXT
l_datatypes-numc = '42'.
l_datatypes-dec = 0 - ( 12345 / 7 ).
l_datatypes-fltp = 0 - ( 12345 / 7 ).
l_datatypes-int = 4711.
l_datatypes-curr = 0 - ( 12345 / 7 ).
l_datatypes-cuky = 'JPY'. " no decimals
l_datatypes-quan = 12345 / 7.
l_datatypes-unit = 'DEG'. " 1 decimal
l_datatypes-date = '20040613'.
l_datatypes-time = '100600'.
l_datatypes-lang = sy-langu.
FIRST CALL ****************************
Call the generated function module
CLEAR fp_docparams.
fp_docparams-langu = 'EN'.
fp_docparams-country = 'US'.
call function fm_name
exporting
/1bcdwb/docparams = fp_docparams
datatypes = l_datatypes
mychar = l_datatypes-char
mybyte =
mystring = l_datatypes-string
myxstring =
mydate = l_datatypes-date
mytime = l_datatypes-time
mynum = l_datatypes-numc
myint = l_datatypes-int
myfloat = l_datatypes-fltp
mypacked = l_datatypes-dec
IMPORTING
/1BCDWB/FORMOUTPUT =
.
prepare test data
l_datatypes-char = '#'.
l_datatypes-string = 'Auf geht''s! '. "#EC NOTEXT
l_datatypes-numc = '42'.
l_datatypes-dec = 0 - ( 12345 / 7 ).
l_datatypes-fltp = 0 - ( 12345 / 7 ).
l_datatypes-int = 4711.
l_datatypes-curr = 0 - ( 12345 / 7 ).
l_datatypes-cuky = 'JPY'. " no decimals
l_datatypes-quan = 12345 / 7.
l_datatypes-unit = 'DEG'. " 1 decimal
l_datatypes-date = '20100913'. "You need to change your data in order it to trigger a new form with the new data.
l_datatypes-time = '10700'. "You need to change your data in order it to trigger a new form with the new data.
l_datatypes-lang = sy-langu.
SECOND CALL ****************************
Call the generated function module
CLEAR fp_docparams.
fp_docparams-langu = 'EN'.
fp_docparams-country = 'US'.
call function fm_name
exporting
/1bcdwb/docparams = fp_docparams
datatypes = l_datatypes
mychar = l_datatypes-char
mybyte =
mystring = l_datatypes-string
myxstring =
mydate = l_datatypes-date
mytime = l_datatypes-time
mynum = l_datatypes-numc
myint = l_datatypes-int
myfloat = l_datatypes-fltp
mypacked = l_datatypes-dec
IMPORTING
/1BCDWB/FORMOUTPUT =
.
Close the spool job
call function 'FP_JOB_CLOSE'
IMPORTING
E_RESULT =
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
I have tested the above code and I am getting multiple forms.
Please try on your end and let me know if it works.
Thanks
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi SHRaj
Thank you for your attention!
I discovered the problem: I was looking inside the Adobe Reader preview window. It is NOT there.
The buttons to choose between forms is ABOVE this window.
It was working all the time, even with my first example.
A disadvantage this way is, that I don't see, how many forms I will print.
It works and that is enough for now.
You are right about the docparams, it has an effect on how numbers are printed for example.
Zsolt
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.