on 04-13-2007 1:45 AM
Hi All,
I m working on an Interactive Adobe form and I have bound the pdf_source of the Interactive Form to an attribute which is of type XSTRING. Is there a function module through which I can convert this binary form of data to an XML.
I am currently displaying the value of this attribute in a text edit control and it appears to be in hex format.
Any hints will be greatly appreciated
Best regards,
Sudhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have a button which just converts this BinaryHex value. In the action I am writing 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,
DOC TYPE REF TO IF_IXML_DOCUMENT.
get element via lead selection
ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).
CALL TRANSFORMATION ('ID')
SOURCE XML ITEM_PDF_SOURCE
RESULT XML ITEM_STRING.
get single attribute
ELEM_CONTEXT->SET_ATTRIBUTE(
EXPORTING
NAME = `STRING`
VALUE = ITEM_STRING ).
ENDMETHOD.
I just get the pdfSource in the attribute ITEM_PDF_SOURCE which is of type XSTRING and use the call transformation to the ITEM_STRING which is of type STRING. It results in a short dump and says that the format is incorrect.
Any hints?
Best regards,
Sudhi
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
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
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.