cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with the program that generates my Offline Form

Former Member
0 Kudos

Hello experts,

This is my first question on the forum, thanks in advance for your help.

Im having problems trying to select data from the selection screen and inserting the data in my form.

I already know that in the print forms you can pass them by parameter when you call a function with the name of the form.

But Im using the class if_fp_pdf_object to generate the pdf and it runs correctly. Im not sure I can use also the function of the form.

The problem is that I want to improve my offline pdf by selecting in the generation program of the pdf a person and inserting it using it in the pdf.

Do you know if there is a method on the if_fp_pdf_object or any other solution where I could pass parameters to the Context?.

Thanks again.

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

Maybe you can jump in the class/ method (or other useful parts of the object coding) and use SAP "where-used" button. This way you can be able to find a SAP example/ demo program (like based on the FLIGHT db or something like that) where you can just copy the data extraction and passing into the form. Otto

Answers (5)

Answers (5)

0 Kudos

Hi All!

I have the exact same problem. I spent a lot of time looking for a solution but did not find him.

Did you manage to solve this problem by sending parameters to the form?

OttoGold
Active Contributor
0 Kudos

Hello again, did you solve your problem? Maybe you can share your solution/ experience with us. And close the thread. this is how we do it here on SDN. Thank you, Otto

OttoGold
Active Contributor
0 Kudos

I have no time to find out if there is the equal alternative for your object coding in the "old-fashioned" way. I hope I´ll spare some time to do that soon. This object coding looks beautiful.

If you´re in a hurry, I can recommend you to follow the provided tutorial and change your coding, according to my experience it´s like 5 minutes work (and for other forms you´ll only copy the code and make cosmetic changes).

I have never seen a solution based on the object coding and will be looking forward if anybody will provide the complete solution based on classes. Otto

OttoGold
Active Contributor
0 Kudos

Can you provide the important part of your code? Or is there a tutorial you have used? Or anything for me to catch upon? Otto

p.s.: If you use ABAP, how did you learn this class usage? Do you know this way of coding?

data there and back): http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf806...

Former Member
0 Kudos

I can write the program completely is very simple.

I used the book "Sap Interactive forms by Adobe".

REPORT  Z_IFBA_OFFLINE_PRB_1PDF.


TYPE-POOLS abap.
INCLUDE fp_utilities.

PARAMETERS:

  P_FRM TYPE fpwbformname OBLIGATORY,
  P_PDF TYPE localfile    VISIBLE LENGTH 64 OBLIGATORY,
  P_INT TYPE abap_bool    default abap_true AS CHECKBOX,
  P_DYN TYPE abap_bool    AS CHECKBOX.

DATA:
  L_FP         TYPE REF TO IF_FP,
  L_PDFOBJ     TYPE REF TO IF_FP_PDF_OBJECT,
  L_XFTREF     TYPE STRING,
  L_PDFRESULT  TYPE XSTRING,
  L_FPEX       TYPE REF TO CX_FP_RUNTIME,
  L_FPEX_API   TYPE REF TO  CX_FP_API,
  L_ERROR      TYPE STRING.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PDF.
  PERFORM VALUE_HELP_FOR_OUTPUT_FILE USING 'PDF'  CHANGING P_PDF.

START-OF-SELECTION.
* DETERMINE THE URL FOR THE FORM.

  TRY.
      cl_fp_wb_helper=>form_layout_exists( i_name = p_frm ).
    CATCH cx_fp_api_usage.                              "#EC NO_HANDLER
    CATCH cx_fp_api_repository INTO l_fpex_api.
      IF l_fpex_api->textid =
         cx_fp_api_repository=>object_already_exists.
        l_xftref = cl_fp_wb_helper=>form_layout_url(
                                    i_name = p_frm
                                    i_dest_path = 'X' ).
      ELSE.
        MESSAGE ID 'FPRUNX' TYPE 'E' NUMBER '050'
                WITH sy-langu.
      ENDIF.
  ENDTRY.

*Get FP reference.
  l_fp = cl_fp=>get_reference( ).
  TRY.
*Create pdf object.
      l_pdfobj = l_fp->create_pdf_object( ).
*Set template.
      l_pdfobj->set_template( xftfile  = l_xftref
                            fillable = p_int ).
*Tell PDF object to create PDF.
      l_pdfobj->set_task_renderpdf( dynamic = p_dyn ).
*Execute, call ADS.
      l_pdfobj->execute( ).
*Get result.
      l_pdfobj->get_pdf( IMPORTING pdfdata = l_pdfresult ).
    CATCH cx_fp_runtime_internal
          cx_fp_runtime_system
          cx_fp_runtime_usage INTO l_fpex.
      l_error = l_fpex->get_errmsg( ).
      MESSAGE l_error TYPE 'E'.
  ENDTRY.
  PERFORM download_file USING l_pdfresult p_pdf.

As i said it runs correctly but i need to pass data to the form before it is generated in order to customize the form.

Former Member
0 Kudos

Mmm Im checking again the link you provided me. I found it before but i thought I could find an alternative and use a method of the class or something but maybe Im wrong and I have to use the functions.

Former Member
0 Kudos

Hi,

Why do you use the Class for this requirement ? If your form is defined on ABAP Stack you can use standard function module for this ...that works fine!!

regards

OttoGold
Active Contributor
0 Kudos

Is that possible you´re using Java WD? Or where do you use this? ABAP? Sorry for a weird question I have no knowledge of this object. Otto

Former Member
0 Kudos

Thanks for your interest Im doing the program in abap.