diff --git a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk
index 169b333..79a3721 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk
@@ -11,6 +11,7 @@ public section.
class-data C_EXCEL_NUMFMT_OFFSET type INT1 value 164. "#EC NOTEXT .
class-data C_SPRAS_EN type SPRAS value 'EN'. "#EC NOTEXT .
+ class-data O_CONV type ref to CL_ABAP_CONV_OUT_CE .
class-methods GET_FIELDCATALOG
importing
@@ -41,7 +42,12 @@ public section.
importing
!IP_VALUE type T
returning
- value(EP_VALUE) type ZEXCEL_CELL_VALUE .
+ value(EP_VALUE) type ZEXCEL_CELL_VALUE .
+ class-methods ENCRYPT_PASSWORD
+ importing
+ !I_PWD type ZEXCEL_AES_PASSWORD
+ returning
+ value(R_ENCRYPTED_PWD) type ZEXCEL_AES_PASSWORD .
*"* protected components of class ZCL_EXCEL_COMMON
*"* do not include other source files here!!!
protected section.
@@ -49,7 +55,23 @@ protected section.
*"* do not include other source files here!!!
private section.
- class-data C_EXCEL_COL_MODULE type INT2 value 64. "#EC NOTEXT .
+ class-data C_EXCEL_COL_MODULE type INT2 value 64. "#EC NOTEXT .
+
+ class-methods CHAR2HEX
+ importing
+ !I_CHAR type CHAR1
+ returning
+ value(R_HEX) type ZEXCEL_PWD_HASH .
+ class-methods SHL01
+ importing
+ !I_PWD_HASH type ZEXCEL_PWD_HASH
+ returning
+ value(R_PWD_HASH) type ZEXCEL_PWD_HASH .
+ class-methods SHR14
+ importing
+ !I_PWD_HASH type ZEXCEL_PWD_HASH
+ returning
+ value(R_PWD_HASH) type ZEXCEL_PWD_HASH .
*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes
@@ -61,7 +83,26 @@ private section.
-
+
+
+
+
+ METHOD char2hex.
+
+ IF o_conv IS NOT BOUND.
+ o_conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8'
+ endian = 'L'
+ ignore_cerr = 'X'
+ replacement = '#' ).
+ ENDIF.
+
+ CALL METHOD o_conv->reset( ).
+ CALL METHOD o_conv->write( data = i_char ).
+ r_hex+1 = o_conv->get_buffer( ). " x'65' must be x'0065'
+
+ENDMETHOD.
+
+
method CONVERT_COLUMN2ALPHA.
@@ -85,7 +126,7 @@ private section.
endmethod.
-
+
method CONVERT_COLUMN2INT.
@@ -126,7 +167,53 @@ endmethod.
ep_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_date_diff ).
endmethod.
-
+
+
+
+ METHOD encrypt_password.
+
+ DATA lv_curr_offset TYPE i.
+ DATA lv_curr_char TYPE c LENGTH 1.
+ DATA lv_curr_hex TYPE zexcel_pwd_hash.
+ DATA lv_pwd_len TYPE zexcel_pwd_hash.
+ DATA lv_pwd_hash TYPE zexcel_pwd_hash.
+
+ CONSTANTS:
+ lv_0x7fff TYPE zexcel_pwd_hash VALUE '7FFF',
+ lv_0x0100 TYPE zexcel_pwd_hash VALUE '0100',
+ lv_0xce4b TYPE zexcel_pwd_hash VALUE 'CE4B'.
+
+ DATA lv_pwd TYPE zexcel_aes_password.
+
+ lv_pwd = i_pwd(15).
+
+ lv_pwd_len = STRLEN( lv_pwd ).
+ lv_curr_offset = lv_pwd_len - 1.
+
+ WHILE lv_curr_offset GE 0.
+
+ lv_curr_char = lv_pwd+lv_curr_offset(1).
+ lv_curr_hex = zcl_excel_common=>char2hex( lv_curr_char ).
+
+ lv_pwd_hash = lv_pwd_hash BIT-XOR lv_curr_hex.
+
+ lv_pwd_hash = ( zcl_excel_common=>shr14( lv_pwd_hash ) BIT-AND lv_0x0100 ) BIT-OR ( zcl_excel_common=>shl01( lv_pwd_hash ) BIT-AND lv_0x7fff ).
+
+
+ SUBTRACT 1 FROM lv_curr_offset.
+
+
+ ENDWHILE.
+
+ lv_pwd_hash = lv_pwd_hash BIT-XOR lv_0xce4b.
+ lv_pwd_hash = lv_pwd_hash BIT-XOR lv_pwd_len.
+
+ WRITE lv_pwd_hash TO r_encrypted_pwd.
+
+
+ENDMETHOD.
+
+
method GET_FIELDCATALOG.
@@ -169,6 +256,53 @@ endmethod.
CONCATENATE '-' ep_value INTO ep_value.
ENDIF.
endmethod.
+
+
+
+
+ METHOD shl01.
+
+ DATA:
+ lv_bit TYPE i,
+ lv_curr_pos TYPE i VALUE 2,
+ lv_prev_pos TYPE i VALUE 1.
+
+ DO 15 TIMES.
+ GET BIT lv_curr_pos OF i_pwd_hash INTO lv_bit.
+ SET BIT lv_prev_pos OF r_pwd_hash TO lv_bit.
+ ADD 1 TO lv_curr_pos.
+ ADD 1 TO lv_prev_pos.
+ ENDDO.
+ SET BIT 16 OF r_pwd_hash TO 0.
+
+ENDMETHOD.
+
+
+
+
+ METHOD shr14.
+
+ DATA:
+ lv_bit TYPE i,
+ lv_curr_pos TYPE i,
+ lv_next_pos TYPE i.
+
+ r_pwd_hash = i_pwd_hash.
+
+ DO 14 TIMES.
+ lv_curr_pos = 15.
+ lv_next_pos = 16.
+
+ DO 15 TIMES.
+ GET BIT lv_curr_pos OF r_pwd_hash INTO lv_bit.
+ SET BIT lv_next_pos OF r_pwd_hash TO lv_bit.
+ SUBTRACT 1 FROM lv_curr_pos.
+ SUBTRACT 1 FROM lv_next_pos.
+ ENDDO.
+ SET BIT 1 OF r_pwd_hash TO 0.
+ ENDDO.
+
+ENDMETHOD.
diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk
index c8eb769..6d6c369 100644
--- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk
+++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk
@@ -1,6 +1,6 @@
-
-
+
+
class ZCL_EXCEL_WORKSHEET definition
public
final
@@ -366,76 +366,103 @@ endclass.
ABAP
SLIS
SOI
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ method ZIF_EXCEL_SHEET_PROTECTION~INITIALIZE.
+
+ me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_unprotected.
+ CLEAR me->zif_excel_sheet_protection~password.
+ me->zif_excel_sheet_protection~auto_filter = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~delete_columns = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~delete_rows = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~format_cells = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~format_columns = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~format_rows = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~insert_columns = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~insert_hyperlinks = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~insert_rows = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~password = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~pivot_tables = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~select_locked_cells = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~select_unlocked_cells = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_noactive.
+ me->zif_excel_sheet_protection~sort = zif_excel_sheet_protection=>c_noactive.
+
+endmethod.
+
+
+
method ADD_DRAWING.
drawings->add( ip_drawing ).
endmethod.
-
-
+
+
method ADD_NEW_CONDITIONAL_STYLE.
CREATE OBJECT eo_conditional_style.
conditional_styles->add( eo_conditional_style ).
endmethod.
-
-
+
+
method ADD_NEW_DATA_VALIDATION.
CREATE OBJECT eo_data_validation.
data_validations->add( eo_data_validation ).
endmethod.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *--------------------------------------------------------------------*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ method BIND_ALV.
+*--------------------------------------------------------------------*
* Method description:
* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file
* with list header and characteristics of ALV field catalog such as:
@@ -445,7 +472,6 @@ endmethod.
* Technique use in method:
* SAP Desktop Office Integration (DOI)
*--------------------------------------------------------------------*
-method BIND_ALV.
* Data for session 0: DOI constructor
* ------------------------------------------
@@ -2502,12 +2528,12 @@ method BIND_ALV.
li_document_size.
close_document.
-endmethod. "BIND_ALV
+endmethod.
-
-
-
-
+
+
+
+
method BIND_TABLE.
DATA:
@@ -2630,7 +2656,7 @@ endmethod. "BIND_ALV
endmethod.
-
+
method CALCULATE_COLUMN_WIDTHS.
TYPES:
BEGIN OF t_auto_size,
@@ -2692,9 +2718,9 @@ endmethod.
endmethod.
-
-
-
+
+
+
method CONSTRUCTOR.
me->excel = ip_excel.
@@ -2730,7 +2756,7 @@ endmethod.
upper_cell-cell_column = 1.
endmethod.
-
+
method DELETE_MERGE.
DELETE sheet_content_merge INDEX 1.
@@ -2738,10 +2764,10 @@ endmethod.
endmethod.
-
-
-
-
+
+
+
+
method FREEZE_PANES.
data: lv_xsplit type i,
lv_ysplit type i.
@@ -2768,8 +2794,8 @@ endmethod.
freeze_pane_cell_row = ip_num_rows + 1.
endmethod.
-
-
+
+
method GET_ACTIVE_CELL.
DATA: lv_active_column TYPE zexcel_cell_column_alpha,
@@ -2783,11 +2809,11 @@ endmethod.
endmethod.
-
-
-
-
-
+
+
+
+
+
method GET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
@@ -2804,9 +2830,9 @@ endmethod.
ep_value = ls_sheet_content-cell_value.
endmethod.
-
-
-
+
+
+
method GET_COLUMN_DIMENSION.
FIELD-SYMBOLS: <fs_column_dimension> LIKE LINE OF column_dimensions.
@@ -2826,46 +2852,46 @@ endmethod.
endmethod.
-
-
+
+
method GET_COLUMN_DIMENSIONS.
r_column_dimension[] = me->column_dimensions[].
endmethod.
-
-
+
+
method GET_COND_STYLES_ITERATOR.
eo_iterator = me->conditional_styles->get_iterator( ).
endmethod.
-
-
+
+
method GET_DATA_VALIDATIONS_ITERATOR.
eo_iterator = me->data_validations->get_iterator( ).
endmethod.
-
-
+
+
method GET_DATA_VALIDATIONS_SIZE.
ep_size = me->data_validations->size( ).
endmethod.
-
-
+
+
method GET_DEFAULT_COLUMN_DIMENSION.
r_column_dimension = me->default_column_dimension.
endmethod.
-
-
+
+
method GET_DEFAULT_ROW_DIMENSION.
r_row_dimension = me->default_row_dimension.
endmethod.
-
-
+
+
method GET_DIMENSION_RANGE.
me->update_dimension_range( ).
@@ -2877,62 +2903,62 @@ endmethod.
endmethod.
-
-
+
+
method GET_DRAWINGS.
r_drawings = drawings.
endmethod.
-
-
+
+
method GET_DRAWINGS_ITERATOR.
eo_iterator = drawings->get_iterator( ).
endmethod.
-
-
-
+
+
+
method GET_FREEZE_CELL.
ep_row = me->freeze_pane_cell_row.
ep_column = me->freeze_pane_cell_column.
endmethod.
-
-
+
+
method GET_GUID.
ep_guid = me->guid.
endmethod.
-
-
+
+
method GET_HIGHEST_COLUMN.
me->update_dimension_range( ).
r_highest_column = me->lower_cell-cell_column.
endmethod.
-
-
+
+
method GET_HIGHEST_ROW.
me->update_dimension_range( ).
r_highest_row = me->lower_cell-cell_row.
endmethod.
-
-
+
+
method GET_HYPERLINKS_ITERATOR.
eo_iterator = hyperlinks->get_iterator( ).
endmethod.
-
-
+
+
method GET_HYPERLINKS_SIZE.
ep_size = hyperlinks->size( ).
endmethod.
-
-
+
+
method GET_MERGE.
DATA: lv_column_start TYPE string,
@@ -3003,9 +3029,9 @@ endmethod.
endmethod.
-
-
-
+
+
+
method GET_ROW_DIMENSION.
FIELD-SYMBOLS: <fs_row_dimension> LIKE LINE OF row_dimensions.
@@ -3025,31 +3051,31 @@ endmethod.
endmethod.
-
-
+
+
method GET_ROW_DIMENSIONS.
r_row_dimension[] = me->row_dimensions[].
endmethod.
-
-
+
+
method GET_TABLES_ITERATOR.
eo_iterator = tables->if_object_collection~get_iterator( ).
endmethod.
-
-
+
+
method GET_TABLES_SIZE.
ep_size = tables->if_object_collection~size( ).
endmethod.
-
-
-
-
-
-
-
+
+
+
+
+
+
+
method SET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
@@ -3143,11 +3169,11 @@ endmethod.
endmethod.
-
-
-
-
-
+
+
+
+
+
method SET_CELL_STYLE.
DATA: lv_column TYPE zexcel_cell_column,
@@ -3175,10 +3201,10 @@ endmethod.
endmethod.
-
-
-
-
+
+
+
+
method SET_MERGE.
DATA: lv_column_start TYPE zexcel_cell_column,
@@ -3209,13 +3235,13 @@ endmethod.
endmethod.
-
-
-
-
-
-
-
+
+
+
+
+
+
+
method SET_TABLE.
DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr,
@@ -3272,7 +3298,7 @@ endmethod.
endmethod.
-
+
method UPDATE_DIMENSION_RANGE.
DATA: ls_sheet_content TYPE zexcel_s_cell_data,
diff --git a/ZA2X/DOMA/ZEXCEL_PWD_HASH.slnk b/ZA2X/DOMA/ZEXCEL_PWD_HASH.slnk
new file mode 100644
index 0000000..2f63e69
--- /dev/null
+++ b/ZA2X/DOMA/ZEXCEL_PWD_HASH.slnk
@@ -0,0 +1,2 @@
+
+
diff --git a/ZA2X/DTEL/ZEXCEL_PWD_HASH.slnk b/ZA2X/DTEL/ZEXCEL_PWD_HASH.slnk
new file mode 100644
index 0000000..d78a12a
--- /dev/null
+++ b/ZA2X/DTEL/ZEXCEL_PWD_HASH.slnk
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk b/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk
index e42e6f5..ccbbd5f 100644
--- a/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk
+++ b/ZA2X/INTF/ZIF_EXCEL_SHEET_PROTECTION.slnk
@@ -14,13 +14,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/ZA2X/PROG/ZDEMO_EXCEL17.slnk b/ZA2X/PROG/ZDEMO_EXCEL17.slnk
index 1b0d545..3c487b3 100644
--- a/ZA2X/PROG/ZDEMO_EXCEL17.slnk
+++ b/ZA2X/PROG/ZDEMO_EXCEL17.slnk
@@ -1,5 +1,5 @@
-
+
@@ -30,7 +30,8 @@ DATA: lv_workdir TYPE string,
CONSTANTS: lv_default_file_name TYPE string VALUE '17_SheetProtection.xlsx'.
-PARAMETERS: p_path TYPE string.
+PARAMETERS: p_path TYPE string,
+ p_pwd TYPE zexcel_aes_password LOWER CASE DEFAULT 'secret'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
@@ -54,7 +55,8 @@ START-OF-SELECTION.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
- lo_worksheet->zif_excel_sheet_protection~password = 'DAA7'. "it is the encoded word "secret"
+* lo_worksheet->zif_excel_sheet_protection~password = 'DAA7'. "it is the encoded word "secret"
+ lo_worksheet->zif_excel_sheet_protection~password = zcl_excel_common=>encrypt_password( p_pwd ).
lo_worksheet->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_active.
lo_worksheet->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_active.
lo_worksheet->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_active.
diff --git a/ZA2X/PROG/ZDEMO_EXCEL20.slnk b/ZA2X/PROG/ZDEMO_EXCEL20.slnk
index 383978c..ee59875 100644
--- a/ZA2X/PROG/ZDEMO_EXCEL20.slnk
+++ b/ZA2X/PROG/ZDEMO_EXCEL20.slnk
@@ -1,5 +1,5 @@
-
+
@@ -774,30 +774,30 @@
* Demo for method zcl_excel_worksheet-bind_alv:
* export data from ALV (CL_GUI_ALV_GRID) object to excel
*--------------------------------------------------------------------*
-REPORT ZDEMO_EXCEL20.
+REPORT zdemo_excel20.
*----------------------------------------------------------------------*
* CLASS lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
-class lcl_handle_events definition.
- public section.
- methods:
- on_user_command for event added_function of cl_salv_events
- importing e_salv_function.
-endclass. "lcl_handle_events DEFINITION
+CLASS lcl_handle_events DEFINITION.
+ PUBLIC SECTION.
+ METHODS:
+ on_user_command FOR EVENT added_function OF cl_salv_events
+ IMPORTING e_salv_function.
+ENDCLASS. "lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_handle_events IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
-class lcl_handle_events implementation.
- method on_user_command.
- perform user_command." using e_salv_function text-i08.
- endmethod. "on_user_command
-endclass. "lcl_handle_events IMPLEMENTATION
+CLASS lcl_handle_events IMPLEMENTATION.
+ METHOD on_user_command.
+ PERFORM user_command." using e_salv_function text-i08.
+ ENDMETHOD. "on_user_command
+ENDCLASS. "lcl_handle_events IMPLEMENTATION
*--------------------------------------------------------------------*
* DATA DECLARATION
@@ -805,20 +805,20 @@ endclass. "lcl_handle_events IMPLEMENTATION
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
- lo_alv type ref to cl_gui_alv_grid,
- lo_salv type ref to cl_salv_table,
- gr_events type ref to lcl_handle_events,
- lr_events type ref to cl_salv_events_table,
- gt_sbook type table of sbook,
- gt_listheader type slis_t_listheader,
- wa_listheader like line of gt_listheader.
+ lo_alv TYPE REF TO cl_gui_alv_grid,
+ lo_salv TYPE REF TO cl_salv_table,
+ gr_events TYPE REF TO lcl_handle_events,
+ lr_events TYPE REF TO cl_salv_events_table,
+ gt_sbook TYPE TABLE OF sbook,
+ gt_listheader TYPE slis_t_listheader,
+ wa_listheader LIKE LINE OF gt_listheader.
-data: l_path type string, " local dir
- lv_workdir type string,
- lv_file_separator type c.
+DATA: l_path TYPE string, " local dir
+ lv_workdir TYPE string,
+ lv_file_separator TYPE c.
-constants:
- lv_default_file_name type string value '20_BindAlv.xlsx'.
+CONSTANTS:
+ lv_default_file_name TYPE string VALUE '20_BindAlv.xlsx'.
*--------------------------------------------------------------------*
*START-OF-SELECTION
*--------------------------------------------------------------------*
@@ -836,29 +836,29 @@ START-OF-SELECTION.
* Display ALV
* ------------------------------------------
- try.
+ TRY.
cl_salv_table=>factory(
- exporting
+ EXPORTING
list_display = abap_false
- importing
+ IMPORTING
r_salv_table = lo_salv
- changing
+ CHANGING
t_table = gt_sbook[] ).
- catch cx_salv_msg .
- endtry.
+ CATCH cx_salv_msg .
+ ENDTRY.
TRY.
- CALL METHOD lo_salv->SET_SCREEN_STATUS
+ CALL METHOD lo_salv->set_screen_status
EXPORTING
- REPORT = sy-repid
- PFSTATUS = 'ALV_STATUS'
- SET_FUNCTIONS = lo_salv->c_functions_all.
- catch cx_salv_msg .
+ report = sy-repid
+ pfstatus = 'ALV_STATUS'
+ set_functions = lo_salv->c_functions_all.
+ CATCH cx_salv_msg .
ENDTRY.
lr_events = lo_salv->get_event( ).
- create object gr_events.
- set handler gr_events->on_user_command for lr_events.
+ CREATE OBJECT gr_events.
+ SET HANDLER gr_events->on_user_command FOR lr_events.
lo_salv->display( ).
@@ -868,30 +868,30 @@ START-OF-SELECTION.
*&---------------------------------------------------------------------*
* ALV user command
*--------------------------------------------------------------------*
-FORM USER_COMMAND .
+FORM user_command .
IF sy-ucomm = 'EXCEL'.
* get save file path
-
+ cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = l_path ).
cl_gui_frontend_services=>directory_browse(
- exporting initial_folder = l_path
- changing selected_folder = l_path ).
+ EXPORTING initial_folder = l_path
+ CHANGING selected_folder = l_path ).
- IF l_path is initial.
+ IF l_path IS INITIAL.
cl_gui_frontend_services=>get_sapgui_workdir(
- changing sapworkdir = lv_workdir ).
+ CHANGING sapworkdir = lv_workdir ).
l_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator(
- changing file_separator = lv_file_separator ).
+ CHANGING file_separator = lv_file_separator ).
- concatenate l_path lv_file_separator lv_default_file_name
- into l_path.
+ CONCATENATE l_path lv_file_separator lv_default_file_name
+ INTO l_path.
* export file to save file path
- perform export_to_excel.
+ PERFORM export_to_excel.
ENDIF.
ENDFORM. " USER_COMMAND
@@ -901,7 +901,7 @@ ENDFORM. " USER_COMMAND
*--------------------------------------------------------------------*
* This subroutine is principal demo session
*--------------------------------------------------------------------*
-FORM EXPORT_TO_EXCEL.
+FORM export_to_excel.
* create zcl_excel_worksheet object
@@ -910,7 +910,7 @@ FORM EXPORT_TO_EXCEL.
* get ALV object from screen
- call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
+ CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_alv.
@@ -918,46 +918,46 @@ FORM EXPORT_TO_EXCEL.
wa_listheader-typ = 'H'.
wa_listheader-info = sy-title.
- append wa_listheader to gt_listheader.
+ APPEND wa_listheader TO gt_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Created by: ABAP2XLSX Group'.
- append wa_listheader to gt_listheader.
+ APPEND wa_listheader TO gt_listheader.
wa_listheader-typ = 'A'.
wa_listheader-info =
'Project hosting at https://cw.sdn.sap.com/cw/groups/abap2xlsx'.
- append wa_listheader to gt_listheader.
+ APPEND wa_listheader TO gt_listheader.
* write to excel using method Bin_ALV
- CALL METHOD lo_worksheet->BIND_ALV
+ CALL METHOD lo_worksheet->bind_alv
EXPORTING
* I_DOCUMENT_URL = SPACE " excel template
* I_XLS = 'X' " create in xls format?
- I_SAVE_PATH = l_path
- IO_ALV = lo_alv
- IT_LISTHEADER = gt_listheader
- I_TOP = 2
- I_LEFT = 1
+ i_save_path = l_path
+ io_alv = lo_alv
+ it_listheader = gt_listheader
+ i_top = 2
+ i_left = 1
* I_COLUMNS_HEADER = 'X'
* I_COLUMNS_AUTOFIT = 'X'
* I_FORMAT_COL_HEADER =
* I_FORMAT_SUBTOTAL =
* I_FORMAT_TOTAL =
EXCEPTIONS
- MISS_GUIDE = 1
- EX_TRANSFER_KKBLO_ERROR = 2
- FATAL_ERROR = 3
- INV_DATA_RANGE = 4
- DIM_MISMATCH_VKEY = 5
- DIM_MISMATCH_SEMA = 6
- ERROR_IN_SEMA = 7
- others = 8
+ miss_guide = 1
+ ex_transfer_kkblo_error = 2
+ fatal_error = 3
+ inv_data_range = 4
+ dim_mismatch_vkey = 5
+ dim_mismatch_sema = 6
+ error_in_sema = 7
+ OTHERS = 8
.
- IF SY-SUBRC <> 0.
- MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
- WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
+ IF sy-subrc <> 0.
+ MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
+ WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "EXPORT_TO_EXCEL