04-13-2007 7:25 PM
Hi All,
In ABAP WebDynpro you can capture the PDF Source of an interactive Adobe Form at runtime. The result is an XSTRING. Are there any function modules or how can I use the CALL TRANSFORMATION to convert this to an XML string and then use it further in my program?
Any help will be greatly appreciated oh yeah and points too!
Best regards,
Sudhi
04-13-2007 7:36 PM
Hi,
Try with fm SMUM_XML_PARSE
or
CALL FUNCTION 'SDIXML_XML_TO_DOM'
then use
CALL FUNCTION 'SDIXML_DOM_TO_DATA'
aRs
04-13-2007 7:36 PM
Hi,
Try with fm SMUM_XML_PARSE
or
CALL FUNCTION 'SDIXML_XML_TO_DOM'
then use
CALL FUNCTION 'SDIXML_DOM_TO_DATA'
aRs
04-13-2007 10:28 PM
Hi,
Thanks for the reply. The FM SMUM_XML_PARSE does not give any result probably because it does not recognize the format of the input string.
The input string is derived from the pdf Source of the Adobe Interactive form and it is of the type Base64 Binary Hex. Basically it is of type XSTRING.
CALL TRANSFORMATION ('ID')
SOURCE XML ITEM_PDF_SOURCE
RESULT XML ITEM_STRING.
I just used the code above where the ITEM_PDF_SOURCE is of type XSTRING and ITEM_STRING is of type STRING.
I read the values from the context and at runtime the value of the ITEM_PDF_SOURCE looks like this
"255044462D312E360D25E2E3CFD30D0A34372030206F626"
There is lots to this string but I have just pasted a part of this and I think this is BinHex type of data.
Any hints?
Best regards,
Sudhi
04-14-2007 12:15 AM
Ok now I managed to get somewhere I used the following code:
METHOD ONACTIONCONVERT .
DATA:
ELEM_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT,
STRU_CONTEXT TYPE IF_ADOBEVIEW=>ELEMENT_CONTEXT ,
ITEM_PDF_SOURCE LIKE STRU_CONTEXT-PDF_SOURCE,
XML_TAB TYPE TABLE OF SMUM_XMLTB.
get element via lead selection
ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).
get single attribute
ELEM_CONTEXT->GET_ATTRIBUTE(
EXPORTING
NAME = `PDF_SOURCE`
IMPORTING
VALUE = ITEM_PDF_SOURCE ).
DATA:
ITEM_STRING LIKE STRU_CONTEXT-STRING,
IXML TYPE REF TO IF_IXML,
DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
STREAMFACTORY TYPE REF TO IF_IXML_STREAM_FACTORY,
ISTREAM TYPE REF TO IF_IXML_ISTREAM,
PARSER TYPE REF TO IF_IXML_PARSER,
I_ELEMENT TYPE REF TO IF_IXML_ELEMENT,
INT TYPE I,
COUNT TYPE I,
P_ERR TYPE REF TO IF_IXML_PARSE_ERROR,
S_ERR TYPE STRING.
get element via lead selection
ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).
*-- create the main factory
IXML = CL_IXML=>CREATE( ).
*-- create the initial document
DOCUMENT = IXML->CREATE_DOCUMENT( ).
STREAMFACTORY = IXML->CREATE_STREAM_FACTORY( ).
ISTREAM =
STREAMFACTORY->CREATE_ISTREAM_XSTRING( ITEM_PDF_SOURCE ).
PARSER = IXML->CREATE_PARSER(
STREAM_FACTORY = STREAMFACTORY
ISTREAM = ISTREAM
DOCUMENT = DOCUMENT ).
CALL METHOD PARSER->PARSE
RECEIVING
RVAL = INT.
CALL METHOD PARSER->NUM_ERRORS
EXPORTING
MIN_SEVERITY = 3
RECEIVING
RVAL = INT.
COUNT = 0.
DO INT TIMES.
CALL METHOD PARSER->GET_ERROR
EXPORTING
INDEX = COUNT
MIN_SEVERITY = 3
RECEIVING
RVAL = P_ERR
.
COUNT = COUNT + 1.
CALL METHOD P_ERR->GET_REASON
RECEIVING
RVAL = S_ERR.
CONCATENATE ITEM_STRING S_ERR INTO ITEM_STRING SEPARATED BY SPACE.
ENDDO.
get single attribute
ELEM_CONTEXT->SET_ATTRIBUTE(
EXPORTING
NAME = `STRING`
VALUE = ITEM_STRING ).
ENDMETHOD.
But this returns me an error saying that "unexpected symbol: '<' "
I am not sure where to correct this...
Best regards,
Sudhi
04-14-2007 8:32 AM
why do you want to convert a pdf to xml? may be answer to this question would help us the come up with a better approach
Raja
04-16-2007 5:12 PM
Hi,
That was the question I asked myself over the weekend and I found so foolish of myself! How can I convert a pdf file which is in binary to an XML file! But the reason why I thought like that was when you create a Adobe Interactive form in the SAP Form transaction SFP it basically opens up the Adobe LiveCycle Designer to create the form. There is an XML file which is created automatically which has the information about the fields, format and the data connection on the form.
Now the real "What am I trying to do":
If it is possible for me to get the XML that defines the Adobe Form then I can modify the XML at runtime and generate Adobe forms based on a template. In the blank template I will just have the screen and at runtime I can put in the fields the user has chosen and the define the dataconnection and then give the output in the WebDynpro so that the user can use the form to Submit data.
I hope this is possible and any hints to achieve this will be greatly appreciated!
Best regards,
Sudhi
04-16-2007 8:47 PM
04-17-2007 6:16 AM
04-20-2007 10:51 PM
Hi Raja,
Thanks for the help. What I managed to do is that using Adobe Designer you can actually save the pdf file as an XDP file which is nothing but a template which has the XML file of the Adobe. We can then upload the template using transaction SMW0 in the binary format. Using function module "FPCOMP_CREATE_PDX" you can get the pdf source in the binary format and then use to generate the PDF file.
But to add to my dissapointment the XDP file generated through the WebDynpro form does not have the information of the Data connection and the endpoint of the service execution. Also I figured out that it is not very easy to change the layout of the Adobe file using this XML file on the fly. This was just a hobby project that I was planning to do but I guess I will have to postpone this venture
Best regards,
Sudhi
07-17-2009 7:53 PM
Hi Sudhindra,
I have excatly the same requirement that you had 2 years back :). i.e. To generate the Interactive adobe form on the fly, based on user selected fields.
Did you achieve this functionality ? Is it possible from ABAP ?
Any suggestion/Idea is really appreciated.
Thanks,
Shrinivas
08-15-2011 12:13 PM
Hi Sudhindra,
I have got exactly the same requirement. Have you found a solution to this?
Thanks & Best Regards,
Preethi.
10-28-2009 8:01 PM
Hello Sudhindra,
I had the same problem as you, and I solved it with the FM 'SSFC_BASE64_ENCODE'
Example code would be:
DATA: X1 TYPE RAWSTRING, " or XSTRING
S1 TYPE STRING.
X1 = '255044462D312E360D25E2E3CFD30D0A34372030206F626'.
WRITE AT / X1. " Displays binary version
*
* Executes the actual convertion
CALL FUNCTION 'SSFC_BASE64_ENCODE'
EXPORTING
bindata = X1
IMPORTING
b64data = S1
EXCEPTIONS
OTHERS = 1. " Over simplifying exception handling
WRITE AT / S1. " Displays BASE 64 version