cancel
Showing results for 
Search instead for 
Did you mean: 

Generate HTMLB Code

former_member184313
Participant
0 Kudos

Hi Folks

I have a strange question: How do I generate HTMLB Code?


<htmlb:textView text   = "<%= model->get_include( ) %>"
                        encode = "true" />

The Model Methode is implemented like this:

 
method GET_INCLUDE .
r_incl = '<%@ include file = "sel_sessio.htm" %>'.
endmethod.

This doesn't work, because the output of model->get_include( ) is not encoded as HTMLB. How can I do this?

Thanks for your help

Regards

Daniel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

can you elaborate your question, wether you want it to act as link or what.

regards

daniel_humberg
Contributor
0 Kudos

Hi,

you cannot encode anything in HTMLB, but you could encode text in HTML format. There are some helpful methods for this in CL_HTTP_UTILITY (escape_html etc.).

But you don't have to encode the return values of your method I think. The htmlb:textView can handle any HTML Tag. You could for example write


<htmlb:textView text   = "<b>some bold text</b>" /> 

and the HTML inside the text attribute would be recognized and rendered as HTML.

former_member184313
Participant
0 Kudos

hi,

Sorry, my question wasn't clear. Well, no link. I'd like to dynamically attach includes to a view. The function get_include( ) would be inside a Loop. There will be about 50 includes, that's why I cant use sub-controllers.

Unfortunately, this doesn't work, but is exactly what I need to do:


<%
loop at model->itab into ls_itab.
%>
<%@ include file = "<%= ls_itab-include_name %>" %>
<%
endloop.
%>

Thanks for your help.

Cheers

Daniel

Message was edited by: Daniel Sulzer

Thanks for your Reply Daniel.

Is there a possible way to do the include with html?

Thanks

Thilo
Explorer
0 Kudos

You could do something like this (not yet testet):

METHOD get_include.
  FIELD-SYMBOLS <source> LIKE LINE OF lt_typesource.
  DATA: lo_page    TYPE REF TO cl_o2_api_pages,
        ls_pagekey TYPE O2PAGKEY,
        lt_source  TYPE o2pageline_table.
  ls_pagekey-applname = 'ZAPPL'.
  ls_pagekey-pagekey  = 'a.htm'.
  CREATE OBJECT lo_page EXPORTING p_pagekey    = ls_pagekey
                                  p_create_new = ' '.
  CALL METHOD lo_page->reload( ).
  CALL METHOD lo_page->get_page( IMPORTING p_content = lt_source ).
  LOOP AT lt_source ASSIGNING <source>.
    CONCATENATE p_return <source>-line INTO p_return.
  ENDLOOP.

ENDMETHOD.

But this only works with pure html code in include.

Message was edited by: Thilo Klopfer

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>There will be about 50 includes, that's why I cant use sub-controllers.

Really, why not use sub-controllers. Your includes will be expanded in line, creating a very large class method. This single class method could very likely exceed the ABAP runtime limits.

<a href="/people/brian.mckellar/blog/2005/04/25/bsp-programming-gen-branchoffset-limit-reached Programming: GEN BRANCHOFFSET LIMIT REACHED</a>

If I had to do this, I would create 50 Views, but only one Controller. You can create your call to your controller with:

<% loop at model->itab assigning <wa_itab>. %>
 <bsp:call url="my_controller.do" comp_id = "view">
  <bsp:parameter name="view" value="<%= <wa_itab>-view_name %>"/>
 </bsp:call>
<% endloop. %>

Then in your single controller, you can call the proper view dynamically.

former_member184313
Participant
0 Kudos

Just brilliant!

Thanks allot Thomas!

Cheers

Daniel

Answers (0)