Rendering HTML/Rich Text in Adobe Form is one of the common requirements people often have.

So here is the step by step process to achieve it.

Do this in ABAP
1) Convert html to xstring – lv_html is your html string

DATA: lv_html TYPE string.
DATA(lv_len) = strlen( lv_html ).
DATA(lr_conv) = cl_abap_conv_out_ce=>create( ).
lr_conv->write( data = lv_html n = lv_len ).
DATA(lv_xstr) = lr_conv->get_buffer( ).

2) XFA doesn’t support most of the HTML tags so do the XSLT transformation for the tags you need

TRY.
CALL TRANSFORMATION zhtml_xslt
SOURCE XML lv_xstr
RESULT XML lv_xstr.
CATCH cx_transformation_error INTO DATA(lr_transformation_error).
ENDTRY.

3) Encode xstring to base64

CONSTANTS: lc_op_enc TYPE x VALUE 36.
DATA: lv_base64 TYPE string.
CALL ‘SSF_ABA_SERVICE’
ID ‘OPCODE’ FIELD lc_op_enc
ID ‘BINDATA’ FIELD lv_xstr
ID ‘B64DATA’ FIELD lv_base64.

4) Example XSLT

                                                                          

 

       

 

 

        
                                                         

Do this in Adobe Form field’s javascript

1) Create a global variable “Base64” and paste the script from below link

https://www.webtoolkit.info/javascript-base64.html

2) Write below code in the field’s javascript to decode base64

 var b64 = this.rawValue; var xhtml = base64.Base64.decode(b64); this.value.exData.loadXML(xhtml);

3) Make sure the script is set to Run At Server, if it’s an interactive form

4) Make sure the field is rich text enabled

Regards,

Arshid

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !