cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass pdf data to ABAP itab

Former Member
0 Kudos

Hi,

I have a pdf form that I want to upload in SAP and retrieve the data from the pdf and generate necessary transaction.

I used the example in offline adobe form documentation:

I've encountered 2 problems:

1. error message: XSLT: No valid XML source,

The transformation is not possible since the XML source document cannot

be parsed.

2. when passing Xstring to string, how much data can it store?

if my form has all the information about vendor name, address, etc. on the top of the form, but indeed the data that I want is on the bottom half of the page. How do I retrieve the data in XML?

3. If someone can provide some sample codes, it would be much appreciated.

Here is my code

DATA: lv_xml_data TYPE xstring,

lt_xml_data TYPE STANDARD TABLE OF xstring,

lv_xml_data_string TYPE string.

APPEND lv_xml_data TO lt_xml_data.

go_pdfobj->get_data( IMPORTING formdata = lv_xml_data ).

  • Convert XML data from XSTRING format to STRING format

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'

EXPORTING

im_xstring = lv_xml_data

IMPORTING

ex_string = lv_xml_data_string.

  • Remove NEW-LINE character from XML data in STRING format

REPLACE ALL OCCURENCES OF cl_abap_char_utilities=>newline

IN lv_xml_data_string WITH ''.

replace '<?xml version="1.0" encoding="UTF-8"?><data>'

in lv_xml_data_string with ''.

  • "Make the XML envelope compliant with identity transform

REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'

IN lv_xml_data_string

WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.

REPLACE '</data>'

IN lv_xml_data_string

WITH '</asx:values></asx:abap>'.

  • Apply the identity transform and convert XML into ABAP in one step

DATA: ls_vndbnk TYPE ZVK_VNDBNK VALUE IS INITIAL.

CALL TRANSFORMATION id

SOURCE XML lv_xml_data_string

RESULT z_vndbnk = ls_vndbnk.

Accepted Solutions (0)

Answers (1)

Answers (1)

chintan_virani
Active Contributor
0 Kudos

Lily,

I observe that you have declared lv_xml_data as TYPE xstring & string and get_data method probably expects data of xstring type.

Have a look at the "Extract the Data" section from following [article.|https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d&overridelayout=true]

Chintan