Skip to Content

email interactive pdf from webdynpro without displaying form

Hi all,

We have a webdynpro application that needs to generate an interactive form and send it by email, without first displaying it to the user. I have built the interactive form in a webdynpro component and it works fine, but I think it requires the window to be opened to generate the pdf xstring to be attached to the email. But we do not need the window to be opened because the users don't want to review the form before sending it. (whether this is a good idea or not is not up for discussion. 😊 )

I am wondering if there is a better way to accomplish this? More detail on scenario: the user selects some data in the screen and then clicks a button like "send form". They fill out a popup with recipient info and then click "send". A form based on the data they originally selected should be sent to the recipient. The recipient (who does not have access to SAP) fills out some fields in the form (hence it needs to be interactive), then sends the completed form back to the originator via email.

Thanks for any suggestions!

Margaret

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Mar 17, 2010 at 08:10 AM

    Based on what was said here I think you´re realinging your task? If you have any more questions, don´t hesitate to ask.

    A minute for us to answer can help you spare like days. To start with offline forms start reading here:

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d

    regards Otto

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 12, 2010 at 04:02 PM

    There are a few classes you can use in conjunction to do this:

    CL_BCS

    CL_DOCUMENT_BCS

    CL_RECIPIENT_BCS

    you'll need to create the document, add your attachment, populate the sender/receiver, and send the request out.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Robert,

      Thanks for your response, but I don't understand how to use those classes for my situation. I have a form and interface that are already defined, with a ZCI layout / XML-based schema. I have data I want to pass to that form, generate the pdf, and attach the pdf (as an xstring data object) to an email without displaying the form to the user. Is there a method(s) in one of those classes that will do that? I think those are for non-interactive/MIME repository forms (but I'm a little fuzzy on this so maybe I'm just missing it).

      Margaret

  • Mar 16, 2010 at 08:06 AM

    Well... we have a little missunderstanding here. Can you please EXPLAIN EXACTLY HOW do you expect the form will behave IF you would be able to send this WD form by email? Lets talk about why the WD form is a WD form. MAybe it is because that is NOT the offline form. WD means online. Then for sending ...you should use the offline form, am I right?

    Otto

    Add comment
    10|10000 characters needed characters exceeded

    • Otto, we have a webdynpro popup to send a form that is partially populated. The recipient will fill in the rest of the fields and send back by email. The received form is not to be processed in SAP at this time.

      The reason we have created a webdynpro, which has the interactive form embedded in it, is that the popup includes the option to display the form that is being sent.

      We know how to do each piece individually but the question is whether the form object created for the webdynpro display of the form, which has an XML interface, could be used instead of a traditional form object. Because we only want to have ONE form object for both functions (to email and to display in the webdynpro).

      As of now we have mostly solved this (by passing the data as xml instead of parameters) except that the emailed form contains an extraneous blank page in the beginning. This does not happen when the same form is called by webdynpro.

  • avatar image
    Former Member
    Mar 16, 2010 at 10:01 PM

    Hi Margaret,

    You can't use Web Dynpro to generate an interactive form without displaying it.

    You have to create your (interactive) form with the help of the fp_object (IF_FP_PDF_OBJECT): Have a look at the source code of report FP_TEST_IA_01! If you have a system >= EhP1, this report contains all you need: There's a function "send_mail" which demonstrates how to send a mail using CL_BCS. Copy the code to your Web Dynpro component and trigger it from your "send form" button action handler.

    You should also hava a look at IF_FP_OFFLINE (google to find the documentation), it could be of interest for your scenario.

    Ralf

    Edited by: Ralf Ruth on Mar 16, 2010 11:03 PM

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 17, 2010 at 03:56 PM

    Thanks to all for your responses. I could have stated the problem more succinctly as: how to send a form with ZCI layout (not standard layout) via email?

    The pointers you gave are helpful and probably would have gotten us to the solution. We found we could use the normal functions, "CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' ...." and then

    CALL FUNCTION funcname
      EXPORTING
        /1bcdwb/docparams  = fp_docparams
          /1bcdwb/docxml     = docxml
      .....  

    where docxml is the output of a custom transformation we built to convert a deep ABAP structure to the correct XML format. (Note that "CALL TRANSFORMATION id ..." does not work correctly for converting deep structures for ABAP forms because the id transformation inserts <item> where <DATA> is needed.)

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 18, 2010 at 08:07 AM

    Well... I didn´t know what your scenario was. In fact you can simplify things a lot like this:

    - create an ordinary offline form/ print form

    - use ordinary coding like FP_JOB_OPEN etc. etc.

    - set GETPDF param to true, you will get the inary stream of PDF data

    - create a HTML container (or something like that, i am no WD pro) on your WD screen

    - send this binary data to the HTML container

    - it will behave the same way if you open any other PDF from any other web site, means it will display your form there in the web page (inline display) or will launch standalone Reader outside browser to display it.

    This is the same thing like if you want to create a PDF viewer in your backend (you have a saved PDF and want to create a simple transaction to display the files you have generated earlier and saved, like in CS etc.)

    Hope that clears the things up for one and maybe some other people interested.

    Regards Otto

    Add comment
    10|10000 characters needed characters exceeded