mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 13:46:17 +08:00
Bind Table: Overlapping tables should raise exception - FIXED git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@375 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
This commit is contained in:
parent
da997b79ee
commit
1b0a69d2b3
|
@ -2935,14 +2935,16 @@ endmethod.</source>
|
||||||
ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ).
|
ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ).
|
||||||
ls_settings-bottom_right_row = lv_maxrow.
|
ls_settings-bottom_right_row = lv_maxrow.
|
||||||
|
|
||||||
|
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
|
||||||
|
|
||||||
"Check if overlapping areas exist
|
"Check if overlapping areas exist
|
||||||
lo_iterator = me->tables->if_object_collection~get_iterator( ).
|
lo_iterator = me->tables->if_object_collection~get_iterator( ).
|
||||||
WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true.
|
WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true.
|
||||||
lo_curtable ?= lo_iterator->if_object_collection_iterator~get_next( ).
|
lo_curtable ?= lo_iterator->if_object_collection_iterator~get_next( ).
|
||||||
IF ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row
|
IF ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row
|
||||||
OR ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row.
|
OR ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row )
|
||||||
ELSEIF lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE lo_curtable->settings-bottom_right_column
|
and ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column )
|
||||||
OR lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE lo_curtable->settings-bottom_right_column.
|
OR lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ).
|
||||||
RAISE EXCEPTION TYPE zcx_excel
|
RAISE EXCEPTION TYPE zcx_excel
|
||||||
EXPORTING
|
EXPORTING
|
||||||
error = 'It is not possible to bind two tables to an excelsheet with overlapping areas.'.
|
error = 'It is not possible to bind two tables to an excelsheet with overlapping areas.'.
|
||||||
|
|
64
ZA2X/PROG/ZERROR_A2X_BIND_TABLE_OVERLAP.slnk
Normal file
64
ZA2X/PROG/ZERROR_A2X_BIND_TABLE_OVERLAP.slnk
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PROG NAME="ZERROR_A2X_BIND_TABLE_OVERLAP" VARCL="X" SUBC="1" RSTAT="T" RMAND="001" RLOAD="E" FIXPT="X" UCCHECK="X">
|
||||||
|
<textPool>
|
||||||
|
<language SPRAS="E">
|
||||||
|
<textElement ID="R" ENTRY="abap2xlsx Demo: Export internal table" LENGTH="38 "/>
|
||||||
|
<textElement ID="S" KEY="P_EMPTY" ENTRY=" Leave Table Empty" LENGTH="25 "/>
|
||||||
|
<textElement ID="S" KEY="P_PATH" ENTRY="D ." LENGTH="24 "/>
|
||||||
|
</language>
|
||||||
|
</textPool>
|
||||||
|
<source>REPORT zerror_a2x_bind_table_overlap.
|
||||||
|
|
||||||
|
TYPE-POOLS: abap.
|
||||||
|
|
||||||
|
DATA: lo_excel TYPE REF TO zcl_excel,
|
||||||
|
lo_worksheet TYPE REF TO zcl_excel_worksheet,
|
||||||
|
column_dimension TYPE REF TO zcl_excel_worksheet_columndime.
|
||||||
|
|
||||||
|
DATA: ls_table_settings TYPE zexcel_s_table_settings.
|
||||||
|
|
||||||
|
|
||||||
|
DATA: lv_title TYPE zexcel_sheet_title,
|
||||||
|
lt_carr TYPE TABLE OF scarr,
|
||||||
|
row TYPE zexcel_cell_row VALUE 2,
|
||||||
|
lo_range TYPE REF TO zcl_excel_range.
|
||||||
|
DATA: lo_data_validation TYPE REF TO zcl_excel_data_validation.
|
||||||
|
FIELD-SYMBOLS: <carr> LIKE LINE OF lt_carr.
|
||||||
|
|
||||||
|
CONSTANTS: c_airlines TYPE string VALUE 'Airlines'.
|
||||||
|
|
||||||
|
|
||||||
|
CONSTANTS: gc_save_file_name TYPE string VALUE '03_iTab.xlsx'.
|
||||||
|
INCLUDE zdemo_excel_outputopt_incl.
|
||||||
|
|
||||||
|
START-OF-SELECTION.
|
||||||
|
" Creates active sheet
|
||||||
|
CREATE OBJECT lo_excel.
|
||||||
|
|
||||||
|
" Get active sheet
|
||||||
|
lo_worksheet = lo_excel->get_active_worksheet( ).
|
||||||
|
lo_worksheet->set_title( ip_title = 'Internal table').
|
||||||
|
|
||||||
|
DATA lt_test TYPE TABLE OF sflight.
|
||||||
|
|
||||||
|
SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE
|
||||||
|
|
||||||
|
* First table - A:M
|
||||||
|
|
||||||
|
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
|
||||||
|
ls_table_settings-show_row_stripes = abap_true.
|
||||||
|
ls_table_settings-top_left_column = 'A'.
|
||||||
|
|
||||||
|
lo_worksheet->bind_table( ip_table = lt_test
|
||||||
|
is_table_settings = ls_table_settings ).
|
||||||
|
|
||||||
|
* Second (overlapping) table: K:T
|
||||||
|
|
||||||
|
ls_table_settings-top_left_column = 'K'.
|
||||||
|
|
||||||
|
lo_worksheet->bind_table( ip_table = lt_test
|
||||||
|
is_table_settings = ls_table_settings ).
|
||||||
|
|
||||||
|
*** Create output
|
||||||
|
lcl_output=>output( lo_excel ).</source>
|
||||||
|
</PROG>
|
Loading…
Reference in New Issue
Block a user