on 09-25-2009 6:19 AM
Hi Experts,
I am supposed to upload a pdf document into a table in a webdynpro application. Can anybody please suggest me on this? (The output should not be a pdf.)
Edited by: pavan kumar on Sep 25, 2009 1:38 PM
You can use the fileUpload UI element to upload the PDF from the client desktop. Is that where you wanted to upload from? The results of the file upload will give you a XSTRING variable with the PDF content. You can then write this content into a database table with a column of RAWSTRING using normal SQL. When you say you want to put the PDF document into a table, is this what you mean? Perhaps if you gave more details on what you want to acomplish, we could be more helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So you want to extract the data out of the PDF and not show the PDF itself? Was this an Interactive Form? If it was an Interactive Form created with the ZCI interface, then you just set the content back into the interactiveForm UI element and the data will be restored back into the bound context.
If it is an interactive form but you want to extract the XML content programatically, you can do that as well:
Part 1 (split because of forum limitations)
* Get a reference to the form processing class.
data: l_fp type ref to if_fp.
l_fp = cl_fp=>get_reference( ).
* Get a reference to the PDF Object class.
data: l_pdfobj type ref to if_fp_pdf_object.
l_pdfobj = l_fp->create_pdf_object( ).
* Set the pdf in the PDF Object.
l_pdfobj->set_document( pdfdata = pdf_xstring ).
* Set the PDF Object to extract data the 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 the xstring form data to string so it can be * processed using the iXML classes.
data: converter type ref to cl_abap_conv_in_ce.
converter = CL_ABAP_CONV_IN_CE=>CREATE( input = pdf_form_data ).
converter->READ( importing data = formxml ).
* Get a reference to iXML object.
data: l_ixml type ref to IF_IXML.
l_ixml = cl_ixml=>create( ).
* Get iStream object from StreamFactory
data: streamFactory type ref to if_ixml_stream_factory.
data: iStream type ref to if_ixml_istream.
streamFactory = l_ixml->create_stream_factory( ).
iStream =
streamFactory->create_istream_string( formxml ).
Code Part 2:
* Create an XML Document class that will be used to process the XML
data: document type ref to if_ixml_document.
document = l_ixml->create_document( ).
* Create the Parser class
data: parser type ref to if_ixml_parser.
parser = l_ixml->create_parser( stream_factory = streamFactory
istream = iStream
document = document ).
* Parse the XML
parser->parse( ).
* Define XML Node type object
data: node type ref to if_ixml_node.
* Get the RESERVED Data Node and value.
data: strChecked type string.
node = document->find_from_name( name = 'RESERVED' ).
strChecked = node->get_value( ).
import_node->set_attribute( exporting name = 'RESERVE_ONLY'
value = strChecked ).
* Look up the rest of the nodes and values.
data: custbook type BAPISBONEW.
node = document->find_from_name( name = 'AIRLINEID' ).
custbook-airlineid = node->get_value( ).
>
> If the PDF is in the form of Internal Table how can I read the values..............
I don't understand this statement. How can the PDF be in the form of an Internal Table? Do you mean that it contains a table of data? If it is an interactive form, then the XML content you extract from the form (using the above code) will contain a matching XML structure for the table (multiple elements for a single node).
Dear Thomas,
We are having PO forms and in that forms we are having some anexture and know the requirement is that the Material in the PO has to Pick the Document which is in the Portal of the form PDF.
Users requirement is that the data in the PDF has to be Printed in the PO at Anexture page.
How can I do. Please help me in this regard.
thanks & Regards
Vamshi Sreerangam
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.