Application Development and Automation 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: 
Read only

Not able to create interactive pdf

Former Member
0 Likes
2,852

Hello everyone,

I'm not able to create an offline pdf using exclusively ABAP. I tried using the tutorial "Offline Interactive Forms Using ABAP" but i'm missing something. I allready created the form using transaction SFP, and my ABAP program is like this:

REPORT ztest_interactive_forms.

DATA: wa_lfa1 LIKE lfa1.

DATA: fm_name TYPE funcname.

DATA: fp_outputparams TYPE sfpoutputparams.

DATA: fp_docparams TYPE sfpdocparams.

DATA: fp_formoutput TYPE fpformoutput.

PARAMETERS: p_lifnr LIKE lfa1-lifnr.

START-OF-SELECTION.

SELECT SINGLE lifnr name1 name2 ort01 FROM lfa1 INTO CORRESPONDING FIELDS OF wa_lfa1 WHERE lifnr = p_lifnr.

  • first get name of the generated function module

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

EXPORTING

i_name = 'ZTEST_NCS'

IMPORTING

e_funcname = fm_name.

  • Set output parameters and open spool job

fp_outputparams-nodialog = 'X'. " suppress printer dialog popup

fp_outputparams-getpdf = 'X'. " launch print preview

CALL FUNCTION 'FP_JOB_OPEN'

CHANGING

ie_outputparams = fp_outputparams

EXCEPTIONS

cancel = 1

usage_error = 2

system_error = 3

internal_error = 4

OTHERS = 5.

  • Set form language and country (->form locale)

fp_docparams-langu = 'E'.

fp_docparams-country = 'US'.

fp_docparams-fillable = 'X'.

  • Now call the generated function module

CALL FUNCTION fm_name

EXPORTING

/1bcdwb/docparams = fp_docparams

vendor_data = wa_lfa1

IMPORTING

/1bcdwb/formoutput = fp_formoutput

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4.

  • Close spool job

CALL FUNCTION 'FP_JOB_CLOSE'

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4.

When function module "fm_name" is called, variable fp_formoutput is returned blank (0 pages).

Can anyone help or suggest something ?

Thank you in advance,

Nuno Santos

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,115

Hi,

The default export parameter is /1bcdwb/formoutput of type

fpformoutput. This parameter has to be evaluated in the calling program if the

resulting document needs to be handled by the program itself. Export parameters

can be added only for those interfaces that are compatible with Smart Forms.

There is also only one standard exporting parameter of the form's generated

function module: /1bcdwb/formoutput of type fpformoutput. It contains three

fields:

. pdf: Contains the PDF data in hexadecimal form if parameter getpdf of

function module FP_JOB_OPEN is set to 'X'. This is required if your

program has a download functionality or if you want to pass on your PDF to

Business Communication Service to fax or e-mail it.

Detail information on Business Communication Service can be found in the

SAP Library, Topic .Generic Business Tools for Application Developers

(BC-SRV-GBT).. See also standard demo reports BCS_EXAMPLE_...

. pdl: contains the PDL data in hexadecimal form if parameter getpdl of

function module FP_JOB_OPEN is set to 'X'.

. pages: returns the number of pages that have been printed.

There is also only one standard exporting parameter of the form's generated

function module: /1bcdwb/formoutput of type fpformoutput. It contains three

fields:

. pdf: Contains the PDF data in hexadecimal form if parameter getpdf of

function module FP_JOB_OPEN is set to 'X'. This is required if your

program has a download functionality or if you want to pass on your PDF to

Business Communication Service to fax or e-mail it.

Detail information on Business Communication Service can be found in the

SAP Library, Topic .Generic Business Tools for Application Developers

(BC-SRV-GBT).. See also standard demo reports BCS_EXAMPLE_...

. pdl: contains the PDL data in hexadecimal form if parameter getpdl of

function module FP_JOB_OPEN is set to 'X'.

. pages: returns the number of pages that have been printed.

Note:

. getpdf: If set to 'X', the /1bcdwb/formoutput-pdf field of the form's generated

function module will contain the PDF data in hexadecimal form. This is

helpful for further processing the PDF file. A preview will not be possible if

getpdf = 'X'

Hope this will be helpfull.

Regards

Adil

Edited by: Syed Abdul Adil on Jun 17, 2008 4:23 PM

Edited by: Syed Abdul Adil on Jun 17, 2008 4:24 PM

10 REPLIES 10
Read only

Former Member
0 Likes
2,115

Hi,

Call SSF_FUNCTION_MODULE_NAME first by passing the Smartform name there. This will return a function module name which gets created for ur smartform. Then use this FM name and call the it.

This should help.

Thanks

Nayan

Read only

0 Likes
2,115

Nayan,

I allready call function FP_FUNCTION_MODULE_NAME, that is the suitable one for interactive PDF Forms. This is not a Smartform.

Thank you

Read only

Former Member
0 Likes
2,115

Hi,

If your necessity is to use the form i dont see the need to use importing comment importing part.

Reward points if useful.

Regards,

Nisrin

Read only

0 Likes
2,115

Nisrin,

I need it further in the code to e-mail the pdf object as an attachment. Nevertheless, even if i simply commented the IMPORT statement wouldn't solve the problem. It would still do nothing, because the function is not returning any error, but it is also not returning any pdf.

Thank you

Read only

Former Member
0 Likes
2,115

Hi,

First try executing the function module in SFP itself.

Then you can find if it is the problem with FM or program.

Before that you should have adobe reader installed in oyur system to see the output.

Thanks,

Bindu.

.

Read only

0 Likes
2,115

Bindu,

I did what you suggested, and everything worked fine, that is, i tested the pdf in SFP transaction directly. The function module was called and the popup with device choice and print preview came out perfectly. So it must be something i'm doing wrong in the program.

When i debug deeper, i get an ADS error on closure of the form.

Read only

0 Likes
2,115

Nuno,

It is due to some setup problem,

Not because of your program.

Regards,

Bindu.

Read only

0 Likes
2,115

Nuno,

ADS error means ADOBE server problem.

IF ADOBE server is busy also you get some ADS error.

Thanks,

Bindu.

Read only

Former Member
0 Likes
2,116

Hi,

The default export parameter is /1bcdwb/formoutput of type

fpformoutput. This parameter has to be evaluated in the calling program if the

resulting document needs to be handled by the program itself. Export parameters

can be added only for those interfaces that are compatible with Smart Forms.

There is also only one standard exporting parameter of the form's generated

function module: /1bcdwb/formoutput of type fpformoutput. It contains three

fields:

. pdf: Contains the PDF data in hexadecimal form if parameter getpdf of

function module FP_JOB_OPEN is set to 'X'. This is required if your

program has a download functionality or if you want to pass on your PDF to

Business Communication Service to fax or e-mail it.

Detail information on Business Communication Service can be found in the

SAP Library, Topic .Generic Business Tools for Application Developers

(BC-SRV-GBT).. See also standard demo reports BCS_EXAMPLE_...

. pdl: contains the PDL data in hexadecimal form if parameter getpdl of

function module FP_JOB_OPEN is set to 'X'.

. pages: returns the number of pages that have been printed.

There is also only one standard exporting parameter of the form's generated

function module: /1bcdwb/formoutput of type fpformoutput. It contains three

fields:

. pdf: Contains the PDF data in hexadecimal form if parameter getpdf of

function module FP_JOB_OPEN is set to 'X'. This is required if your

program has a download functionality or if you want to pass on your PDF to

Business Communication Service to fax or e-mail it.

Detail information on Business Communication Service can be found in the

SAP Library, Topic .Generic Business Tools for Application Developers

(BC-SRV-GBT).. See also standard demo reports BCS_EXAMPLE_...

. pdl: contains the PDL data in hexadecimal form if parameter getpdl of

function module FP_JOB_OPEN is set to 'X'.

. pages: returns the number of pages that have been printed.

Note:

. getpdf: If set to 'X', the /1bcdwb/formoutput-pdf field of the form's generated

function module will contain the PDF data in hexadecimal form. This is

helpful for further processing the PDF file. A preview will not be possible if

getpdf = 'X'

Hope this will be helpfull.

Regards

Adil

Edited by: Syed Abdul Adil on Jun 17, 2008 4:23 PM

Edited by: Syed Abdul Adil on Jun 17, 2008 4:24 PM

Read only

Former Member
0 Likes
2,115

Hi Nuno,

The parameter getpdf should do the job of getting the pdf file.

But as you need to send the pdf via mail check with sfpjoboutput under fp_jobclose , this would retrieve the spool id.

I'll try other options too..

Regards,

Nisrin.