Skip to Content

Hello Friends…

We had a scenario of Claim Maintenance . Our clients has a requirement where they have online and offline PDF claim forms.

1.Offline :The Customers can directly fill in the Claim form and submit ,to send a mail to sales agent. The sales agent saves the PDF on his desktop and runs the dynpro application which will have all the data from that PDF.

2. Online : Here the SalesAgent fill the PDF form within the WD application directly.

Here i m going to deal with the offline scenario.I seached for two days to finally get this done.Here it is for all those ,who are interested in Adobe interacting with WD.

Procedure :

1> Create a WD Component and design the View as required.

2>Create context elements to be mapped to the view elements.Create a context attribute(PDFOBJ) of type “XSTRING” to be bound to data property of FileUpload view element.

image

3>Create a element of type FileUpload in the view layout. This will be used to brouse the PDF from the desktop. Bind the Data Property to the XSTRING context attribute (PDFObj).

!https://weblogs.sdn.sap.com/weblogs/images/251735287/1.JPG|height=345|alt=image|width=579|src=https://weblogs.sdn.sap.com/weblogs/images/251735287/1.JPG|border=0!”

4> Now we need a button ,on click of which the PDF will get upload.Create a button in the view layout and set properties as below.

!https://weblogs.sdn.sap.com/weblogs/images/251735287/2.JPG|height=355|alt=image|width=558|src=https://weblogs.sdn.sap.com/weblogs/images/251735287/2.JPG|border=0!”

5>DoubleClick the UPLOAD function attached to the button and code to read the data of PDF .

5.1> The data uploaded will be in format of XSTRING/Binary . We first need to convert this data into string.

5.2> Then iXML classes are used to parse it to XML document, which is then retrieved to WD Context.

code:

********code to retrieve data from PDF to context node

*get ref to form processing class

++DATA: l_fp TYPE REF TO if_fp.++ 

l_fp = cl_fp=>get_reference( ).++ +

+* Set ref to pdf object class++ 

DATA: l_pdfobj TYPE REF TO if_fp_pdf_object.++ 

l_pdfobj = l_fp->create_pdf_object( ).+

+ ++* Set pdf in pdfobject++ 

l_pdfobj->set_document( pdfdata = item_pdfobj ).++ +

+*  Set pdfobj to extract form data++ 

l_pdfobj->set_extractdata( ).++ +

+*  execute call to ADS++ 

l_pdfobj->execute( ).++ +

+*  Get the pdf form data++ 

DATA: pdf_form_data TYPE xstring.++ 

l_pdfobj->get_data( IMPORTING formdata = pdf_form_data ).++ +

+*  Convert xstring to string++ 

DATA: converter TYPE REF TO cl_abap_conv_in_ce, formxml TYPE string.

++converter = cl_abap_conv_in_ce=>create( input = pdf_form_data ).++ 

converter->read( IMPORTING data = formxml ).+

+ ++*  Pull in iXML type gp.

++  TYPE-POOLS: ixml.+

+* Get ref to ixmlobj

++DATA: l_ixml TYPE REF TO if_ixml.

++l_ixml = cl_ixml=>create( ).+

+* Get istream obj from stream factory

++DATA: streamfactory TYPE REF TO if_ixml_stream_factory,

++        istream TYPE REF TO if_ixml_istream.

++streamfactory = l_ixml->create_stream_factory( ).

++istream = streamfactory->create_istream_string( formxml ).+

+* Create XML doc class to process xml

++DATA: document TYPE REF TO if_ixml_document.

++document = l_ixml->create_document( ).+

+* Create Parser Class

++DATA: parser TYPE REF TO if_ixml_parser.

++parser = l_ixml->create_parser(++stream_factory = streamfactory

                                        + +istream = istream

                                         ++document = document ).+

+* Parse XML

++parser->parse( ).+

+* Define XML type node obj

++DATA: node TYPE REF TO if_ixml_node.+

+* Retrieve data

+node = document->find_from_name(‘CMC_SALES_ORDER_ID’).

+IF NOT node IS INITIAL.

+so = node->get_value( ).<br />ENDIF.

________________________________-

<CMC_SALES_ORDER_ID >: The tag that store the salesoreder_id.<br />This value is stored in variable “so”  and can be saved into the required context attribute :)<br />Plz debug the “document” to see the XML and then use proper tag to get the value required.

Thats it. Now we can retrieve all the offline PDF data and use in WD Applications.

Result :

Below is the offline PDF with data that has to be uploaded into WD Appl.

image

After clicking on upload, the Application will load the broused PDF data and related data as below :

!https://weblogs.sdn.sap.com/weblogs/images/251735287/SA.JPG|height=392|alt=image|width=578|src=https://weblogs.sdn.sap.com/weblogs/images/251735287/SA.JPG|border=0!</body>

To report this post you need to login first.

14 Comments

You must be Logged on to comment or reply to a post.

  1. Thomas Jung
    Actually all the work to read in and parse the XML is not necessary as of SPS10 (with OSS note 1055738 to fix a critical bug).  If you use ZCI forms and set the displayType to “native”, after the FileUpload UI Element processes the upload the framework will automatically do all of this work for you.
    (0) 
    1. Former Member Post author
      Thanks Thomas for the info.

      I need some details regarding the same:
      > For versions before SP10, we have to manually do this. Correct me ,if m wrong.

      >Is there any link that describes the complete usage of ZCI forms.Need some details.

      Regards
      Dhanya

      (0) 
      1. Former Member Post author
        Hi Thomas,
        If m not wrong..u were saying about displaying the data in PDF(Interactive Form) in Dynpro.

        But here i had to read the offline data and sow it in the textviews / labels ,of my view.

        So, i guess tis is the only way.
        Regards
        Dhanya

        (0) 
        1. Thomas Jung
          >But here i had to read the offline data and sow it in the textviews / labels ,of my view.

          Not a problem really.  The Adobe form would have to be on the screen the automatic binding to work, but you could make it very small (1px x 1px maybe).  Once the values are back into the context, they can be displayed just fine in textviews, fields, etc on the same screen.

          (0) 
          1. Former Member
            Hi Thomas,

            Please advice after the FileUpload UI Element processes the offline interactive form render, Is the WebDynpro Native submit button in the form supposed to trigger the onsubmit event in Web Dynpro? I am trying to update the binding data to database at submit.

            Thanks,
            Michelle

            (0) 
      2. Thomas Jung
        > For versions before SP10, we have to manually do this. Correct me ,if m wrong.
        Yes before SP10, ZCI forms were not supported

        >Is there any link that describes the complete usage of ZCI forms.Need some details.
        Yes, search help.sap.com.  It has lots of information about ZCI forms.

        (0) 
    1. Former Member Post author
      Hi Prince,

      Table control creation:
      1. Place the “Table” UI element on the view and bind its property “Datasource” to the context node.

      2. rightclick the table control to add column by selecting “Insert Table Column” .

      3. To the tableColumn  add inputfield / textview and bind the the “text” property to one of the context element of the above selected node.

      Regards
      Dhanya

      (0) 
  2. Former Member
    Hi Dhanya and Thomas,

    Thank you for this information.  I was searching for a blog that confirmed we could do just this.  Please help confirm if I understand this correctly.

    I want to:
    1. Have WDA Adobe Interactive form that user can fill in online, or save blank form for offline updating.
    2. When filled-in offline form is uploaded to this same WDA, then the blank online form will be automatically populated with uploaded data (assuming ZCI and >SPS10).

    Thanks so much,
    Colleen

    (0) 
  3. Former Member
    Hi Dhanya,

    I have a similar requirement for my sales order creation scenario. I wanted to know how u have uploaded the item data in your WD application. Since multiple entries for item are there. If i use the attribute name with the find_from_name(),i will get only the single value.
    Please tell me the way of uploading table data on SAP interactive form to the table on WD ABAP view.

    (0) 
    1. Former Member
      Hi Diana,
      thanks for your blog.
      Unfortunatly I have some additional problems:
      I have a Web Dynpro. In this Dynpro I have two views. In each view I have an interactive form, I created with the form builder. The forms are different.
      For the  user it is possible to change vallues in the forms and upload them.

      Since now I am parsing the two forms with Simple transormations. I think this way is not the best and not easy. Is there a better way to pars the two different forms?

      Thanks a lot

      (0) 
  4. Former Member
    Hi,

    our System Admin. has implemented the sap note 1055738 on our system. I’ve tried the upload of the pdf in the view and the data on screen gets updated. The problem is:
    Once the auto-binding of the data to the datasource context is done (Iteractive Form is rendered), I’m unable to interact with the web dynpro. If I try to clik on any on screen (web dynpro UI) button, (event should be raised) the web page hangs, it shoes the wait loading text, and just dosen’t do anything else. It looks like no Methond in web dynpro is called, I don’t even know if the client actualy does the http post at this point.
    Could that depend on the ADS configuration?

    (0) 
    1. Former Member
      Hi Daniele,

      Have you received any answers on your question?
      I have the problem on submit event.
      Any update will be great appreciated.

      Thanks,
      Michelle Hong

      (0) 
      1. Former Member Post author
        Hello Guys,

        I think this is an issue with ADS configuration.It happened to us when the ADS was not configured properly.
        Check with your IT guys for this.

        Regards
        Dhanya

        (0) 

Leave a Reply