Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

html document ... button in am html table

Former Member
0 Likes
583

Hi,

I have been exploring the dd classes for some days now. I have a persistent problem which I can not find a way of resolving. I create an html table into which I want to put text and buttons. If for every column I only put in text, then the alignement is quite acceptable. That is the height of the cells are commensurate with the height of the text, or there does not appear to be any padding in the cells above or elow the texts.

Now to add a button I first add a form area in the column which will contain the button. This works fine but then the height of the cell is no longer just the height of the button. I have tried the methods NO_LINEBREAK( start = 'X' ) and NO_LINEBREAK( end = 'X' ) at the begining and end of the column, that is before going to the next column.

This has the effect of removing the first break only, so the top of the button is just below the cell top but the bottom of the button is one line break away from the bottom of the cell. So it would appear that a for area always ends with a line break.

The only way I found to almost do this is to assign 'X' to the attribute line_with_layout. Which should not be done and adds a column to the table anyway.

So how do I make a cell with the same height as the button taht is inside it.

Many thanks,

PD

Surely there is some simple method.

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
508

You should put the button column in the Line with layout.

Like:


  call method form1->line_with_layout exporting start = 'X'.

* logic for button
*...

   call method form1->line_with_layout exporting end = 'X'.

Check report DD_ADD_TABLE.

Regards,

Naimesh Patel

Edited by: Naimesh Patel on Nov 7, 2008 10:39 AM

Read only

0 Likes
508

Hi,

Let me send the code snippets. I have tried all that is available. Either there is something missing or I am doing this wrong :

This first snippets works the best but adds two extra columns after each button. with lv_button = 2 this produces four columns even though I only created for 2.

----


  • create the table

----


CALL METHOD gobj_html_doc->add_table

EXPORTING

no_of_columns = lv_columns

width = '100%'

cell_background_transparent = 'X'

border = '0'

IMPORTING

table = lv_table_element

tablearea = lv_table_area.

----


  • add columns

----


DO lv_columns TIMES.

lv_width = lv_i MOD 2.

IF lv_mod EQ 0.

lv_str = '30%'.

ELSE.

lv_str = '70%'.

ENDIF.

ADD 1 TO lv_i.

CALL METHOD lv_table_element->add_column

EXPORTING

width = lv_width

IMPORTING

column = lv_column.

APPEND lv_column TO lt_column.

ENDDO.

----


  • add buttons

----


LOOP AT lt_column INTO lv_column.

CALL METHOD lv_column->add_form

IMPORTING

formarea = lv_form_area.

lv_form_area->is_line_with_layout = 'X'.

CALL METHOD lv_form_area->add_button

EXPORTING

sap_icon = 'ICON_CHANGE'

IMPORTING

button = lobj_button.

CALL METHOD lv_table_element->new_row.

ENDLOOP.

the following does not work either but no extrra columns are added.

----


  • add buttons

----


LOOP AT lt_column INTO lv_column.

CALL METHOD lv_column->add_form

IMPORTING

formarea = lv_form_area.

lv_form_area->line_with_layout( start = 'X' ).

CALL METHOD lv_form_area->add_button

EXPORTING

sap_icon = 'ICON_CHANGE'

IMPORTING

button = lobj_button.

CALL METHOD lv_table_element->new_row.

lv_form_area->line_with_layout( end = 'X' ).

ENDLOOP.

and the folling does not help much either.

----


  • add buttons

----


LOOP AT lt_column INTO lv_column.

CALL METHOD lv_column->add_form

IMPORTING

formarea = lv_form_area.

lv_form_area->no_line_break( start = 'X' ).

CALL METHOD lv_form_area->add_button

EXPORTING

sap_icon = 'ICON_CHANGE'

IMPORTING

button = lobj_button.

CALL METHOD lv_table_element->new_row.

lv_form_area->no_line_with_layout( end = 'X' ).

ENDLOOP.

all I can tell is that there is always a <br> token at the end of the form area. Perhaps the answer is to redefine the method in a derived class?

If you have more ideas I am certainly opened to them ...

thanks,

PD.