Skip to Content
avatar image
Former Member

Integration of smartforms with webdynpro Java Application

Hi Experts,

Can anyone please suggest if it is possible to call smartforms from a webdynpro java application?

If yes, kindly guide the steps required.

Regards,

Anurag

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Mar 25, 2011 at 10:23 AM

    Hi,

    I know there is a blog somewhere that describes in more detail, but the basic idea is to retrieve the smartform in byte format, and retrieve the URL of the web resource. You can then display the URL in an IWDIFrame component.

    So, assuming you have retrieved your smart form from RFC already:

    byte[] sfContent = yourSmartFormFromRFC.getBytes();
    IWDCachedWebResource sfRes = WDWebResource.getWebResource(sfContent,WDWebResourceType.PDF);
    String sfURL = sfRes.getURL();

    Then, store the URL in the context, and bind the source property of an IFrame to it and you're set.

    Hope this helps!

    Best regards,

    Robin van het Hof

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 25, 2011 at 10:48 AM

    Hi Anurag,

    You need to call the form in bytes format, bind to an attribute.

    Cheers!!!

    Umang 😊

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2011 at 11:26 AM

    Hi All,

    I am reopening the thread because of the following error that I am getting on opening of the PDF:

    Format error: not a pdf or corrupted.

    Please find below the code that I am using for the PDF file generation:

    byte[] smartFormContent = wdThis.getSourceOfPDF().toByteArray();

    wdComponentAPI.getMessageManager().reportSuccess("PDF smartFormContent::"+smartFormContent);

    IWDCachedWebResource smartFormResource = WDWebResource.getWebResource(smartFormContent,WDWebResourceType.PDF);

    try

    {

    wdComponentAPI.getWindowManager().createNonModalExternalWindow(smartFormResource.getURL(),smartFormResource.getResourceName()).open();

    }

    I called directly the below method but still no luck:

    public java.io.ByteArrayOutputStream getSourceOfPDF( )

    {

    //@@begin getSourceOfPDF()

    //Generating PDF document

    ByteArrayOutputStream output = new ByteArrayOutputStream();

    wdComponentAPI.getMessageManager().reportSuccess("PDFSource::"+wdContext.currentOutputElement().getV_Binary());

    try {

    byte[] smartFormContent = wdContext.currentOutputElement().getV_Binary();

    output.write(smartFormContent);

    } catch (Exception e) {

    // TODO Auto-generated catch block

    wdComponentAPI.getMessageManager().reportSuccess("smartFormContent::"+e);

    e.printStackTrace();

    }

    return output;

    Please assist.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Robin Van Het Hof

      Hi Robin,

      Thanks for all the help.

      Yes, the problem wsa certainly with the hex which was coming striiped actually from the backend itself.

      Now, it is working absolutely fine.

      Thanks for all the guidance!!!

      Best Regards,

      Anurag

  • avatar image
    Former Member
    Apr 14, 2011 at 05:19 AM

    The issue is resolved now.

    Add comment
    10|10000 characters needed characters exceeded