Skip to Content

As of NetWeaver 7.0 SPS10-SPS12 (with OSS note 1055738) or SPS13+, functionality was provided to automatically map the context of an offline interactive form uploaded via the FileUpload UI element to the Web Dynpro Context. You need only use the displayType “native” – which you should be using regardless.Below given is a solution to read the form using code.



To read a  value from adobe interactive PDF we have to  read each and every node that is binded to the form from the context. To read a single field that is binded to the PDF can be achieved in some simple 12 steps, which are explained below. After getting focus to a node that is binded to the PDF, we need to travel inside the node to read the value of the attribute that is created inside the node. Using the the methods provided we can read individual variables with a parent child pointer relationship.

For Getting the table Values from the PDF, a small Logic can Help You.Once the individual variables are read, we need to read the tables in the PDF to an internal table, so that we can bind the whole data to context in one go. which is explained in this chapter after single variable reading.

Reading a single variable from the node

 An 11 Step Declaration is required before starting reading of the an Interactive Form manually, which are explained below

  • Step1. Get a reference to the form Processing class

DATA: l_fp TYPE REF TO if_fp.
l_fp = cl_fp=>get_reference( ).

  • Step2. Get reference to the Pdf Object Class

DATA: l_pdfobj TYPE REF TO if_fp_pdf_object.
l_pdfobj = l_fp->create_pdf_object( ).

  • Step3. Set your Pdf In the Pdf object created

l_pdfobj->set_document( pdfdata = lv_pdf_data_source ).                                 lv_pdf_data_sourcce can be retrived by using an upload UI element and get the xml string to an attribute of type xstring

  • Step4. Extract data from pdf object

l_pdfobj->set_extractdata( ).

  • Step5. Call Adobe Document Service

l_pdfobj->execute( ).

  • Step6. Get the pdf Data to a Xstring Variable

DATA: pdf_form_data TYPE xstring.
l_pdfobj->get_data( IMPORTING formdata = pdf_form_data ).

  • Step7. Call method to 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 ).

  • Step8.Get the ixm type group Into Our prorgram


  • Step9.Get a Reference to Ixml Object

DATA: l_ixml TYPE REF TO if_ixml.
l_ixml = cl_ixml=>create( ).

  •  Step10.Get istream Object 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 ).

  •  Step11. Get xml document Class to process XML

DATA: document TYPE REF TO if_ixml_document.
Document = l_ixml->create_document( ).

  • Step12. Get an Interface to Parse the XML 

DATA: parser TYPE REF TO if_ixml_parser.
parser = l_ixml->create_parser( stream_factory = streamfactory
                                           istream = istream
                                           document = document ).

Start processing the Pdf

Start parsing theDocument with parsing interface referenced.

Parser->parse( ).

Now we have to define an interface to process the XML nodes in the xml Document. 

DATA: node TYPE REF TO if_ixml_node.

We can now use the methods of the xml interface to read values from the xml Document.Eg: Iam using the method Find_From_name() to retrive the value of an attribute by giving the name of the node in form interface. Here node name, attribute name, field names all refer to the names in the form.

 interface.node = document->find_from_name(NAME_OF_EMPLOYEE).
    Name  = node->get_value( ).
  ENDIF.node = document->find_from_name(GROUP_OF_EMPLOYEE).
    group  = node->get_value( ).
  ENDIF.node = document->find_from_name(QUALIFICATION_OF_EMPLOYEE).
    Qualification  = node->get_value( ).
  ENDIF.need to repeat this procedure for all the indudual variable in the PDF. 

Reading a Table From PDF To an Itab

  For reading a table from the pdf , first we need to focus the node that contains attributes that is binded to the table in the form. Then move inside the node and read its children one by one.For the simplicity of understanding , here iam considering a table that contains a student’s record for 5 consicutive years, say from 1998 to 2002. thats a table with colums year, total mark, percentage, Class positionA single row in the table should be like


 Year   TotalMark  Percentage  ClassPosition
 1998  520  95  3
 1999  450  62  5
 2000  562  85  6
 2001  480  59  2
 2002  526  96  1


Declerations for Reading the Table.   

data : item type string.  DATA: nodechild TYPE REF TO if_ixml_node,
        Childschild TYPE REF TO if_ixml_node.

    data: num_of_children type i.

Get Focus to the parent node thats binded to the table.

 node = document->find_from_name(‘TABLE’).

Read the number of children available for the node ‘table’. Which is the number of rows Available for the table

num_of_children = node->num_children( ).

Now you have to loop the table ‘number_of_children’ times inorder to read the table completely.And inside this loop you have to find the number of attributes available for each row and loop this number of times to read value of each attribute.

    nodechild = node->get_first_child( ).”Getting focus to child node’s First attribute

Finding values of Each Cell

do Num_of_children times.    

                      x = 1.
                     Childschild = nodechild->get_first_child( ).

                     num_of_attribute = Childschild->num_children( ).” Getting the number of attributes     

         do num_of_attribute times.   

          item = Childschild->GET_value( ).

I am considering the case were the numbers of attributes are max 4 and I am sure about the attribute position

   case x.
        when 1.
          wa_table-year = item.
        when 2.
          wa_table-total_mark= item.
        when 3.
          wa_table-percentage= item.
        when  4.
          wa_table-class_position= item.

  endcase.        Childschild = Childschild->get_next( ).
        x = x + 1.
      enddo.   nodechild = nodechild->get_next( ).   

    append wa_table to ls_table.  


Now the whole values from the table are there in the itab ls_table. You can bind the table to a context node.


To report this post you need to login first.


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

  1. Thomas Jung
    It is important to note that this coding is no longer necessary. As of NetWeaver 7.0 SPS10-SPS12 (with OSS note 1055738) or SPS13+, functionality was provided to automatically map the context of an offline interactive form uploaded via the FileUpload UI element to the Web Dynpro Context. You need only use the displayType “native” – which you should be using regardless.
    1. Sarath Satheesan Post author
      Hi Thomas Jung,
      I am aware about that, i was trying to do the same with SPS< 10, at that time only i faced this prob and find out this solution, so i thought of sharing. Any way its a good piece of info, i think
      1. Thomas Jung
        In my eyes, the fact that you knew there was a new way to accomplish this makes the situation even worse.  You may have know that there was newer functionality in SPS10+, but many of the readers of your blog would not have known.  You would be leading people to a much more complex solution that what is necessary by not pointing out that your coding solution is only necessary for very old SP levels.
  2. Vaibhav Tiwari
    Its a nice blog to read data from tables in an adobe form. Do you have any idea about populating search help for table line-item field in adobe form.



Leave a Reply