‎2009 Sep 11 4:13 PM
Hi,
I'm using the mentioned method to add text to my document which I display with
method display_document of class cl_dd_document in my container.
Is it possible to display the text centerd in the document? or can I display the document centerd in my container?
‎2009 Sep 13 1:55 PM
‎2009 Sep 14 7:49 AM
Hi,
I dont think we can achieve that using the process you are following, But we can achieve this using the new class CL_SALV_TABLE
The sameple code is placed below
DATA: o_table TYPE REF TO cl_salv_table,
o_columns TYPE REF TO cl_salv_columns_table, " ALV columns
o_functions TYPE REF TO cl_salv_functions,
o_layout TYPE REF TO cl_salv_layout,
o_content TYPE REF TO cl_salv_form_element,
o_display TYPE REF TO cl_salv_display_settings,
l_v_key TYPE salv_s_layout_key.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = o_table
CHANGING
t_table = i_final.
CATCH cx_salv_msg .
ENDTRY.
Get coulmn properties
o_columns = o_table->get_columns( ).
o_columns->set_optimize( c_x ).
o_functions = o_table->get_functions( ).
o_functions->set_all( abap_true ).
o_layout = o_table->get_layout( ).
l_v_key-report = sy-repid.
o_layout->set_key( l_v_key ).
o_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
o_columns->set_optimize( c_x ).
o_display = o_table->get_display_settings( ).
o_display->set_striped_pattern( cl_salv_display_settings=>true ).
PERFORM built_header CHANGING o_content.
PERFORM change_column_properties USING
o_columns.
o_table->set_top_of_list( o_content ).
o_table->display( ).
DATA: obj_grid TYPE REF TO cl_salv_form_layout_grid,
obj_logo TYPE REF TO cl_salv_form_layout_logo,
obj_label TYPE REF TO cl_salv_form_label,
obj_text TYPE REF TO cl_salv_form_text,
obj_header TYPE REF TO cl_salv_form_header_info,
ld_date TYPE char10.
CREATE OBJECT obj_grid.
CREATE OBJECT obj_logo.
obj_header = obj_grid->create_header_information(
row = 1
column = 40
rowspan = 2
colspan = 50
text = sy-title ).
CLEAR obj_label.
CLEAR obj_label.
obj_label = obj_grid->create_label(
row = 3
column = 1
colspan = 10
text = 'Run Date'(025) ).
CLEAR obj_text.
ld_date0(2) = sy-datum6(2).
ld_date+2(1) = '.'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '.'.
ld_date6(4) = sy-datum0(4).
obj_text = obj_grid->create_text(
row = 3
column = 2
text = ld_date ).
CLEAR obj_label.
obj_label = obj_grid->create_label(
row = 4
column = 1
colspan = 10
text = 'Run Time'(026) ).
CLEAR obj_text.
ld_date0(2) = sy-datum6(2).
ld_date+2(1) = '.'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '.'.
ld_date6(4) = sy-datum0(4).
obj_text = obj_grid->create_text(
row = 4
column = 2
text = sy-uzeit ).
pt_content = obj_grid.
Cheers
Pavan
‎2009 Sep 14 8:15 AM
Use method add_gap of cl_dd_document to add indent of particular width. Embrace this with line_with_layout method like this
CALL METHOD r_dd_document->line_with_layout
EXPORTING start = 'X'.
CALL METHOD r_dd_document->add_gap "add indent
EXPORTING width = '200'.
CALL METHOD r_dd_document->add_text "add your text
EXPORTING ...
CALL METHOD r_dd_document->line_with_layout
EXPORTING end = 'X'.
Regards
Marcin