Skip to content

Commit

Permalink
Merge pull request #2 from thedoginthewok/remove-hungarian-notation
Browse files Browse the repository at this point in the history
Remove hungarian notation
  • Loading branch information
WegnerDan authored Apr 9, 2022
2 parents f41390b + 507505a commit 8b885a8
Show file tree
Hide file tree
Showing 7 changed files with 874 additions and 901 deletions.
644 changes: 312 additions & 332 deletions src/zcl_wd_csv.clas.abap

Large diffs are not rendered by default.

672 changes: 332 additions & 340 deletions src/zcl_wd_csv_dyn_helper.clas.abap

Large diffs are not rendered by default.

239 changes: 120 additions & 119 deletions src/zcl_wd_csv_file.clas.abap

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/zcx_wd_csv_invalid_delimiter.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ CLASS zcx_wd_csv_invalid_delimiter DEFINITION PUBLIC INHERITING FROM zcx_wd_csv_
attr4 TYPE scx_attrname VALUE '',
END OF zcx_wd_csv_invalid_delimiter.
DATA:
delimiter TYPE zcl_wd_csv=>mty_delimiter READ-ONLY.
delimiter TYPE zcl_wd_csv=>ty_delimiter READ-ONLY.
METHODS:
constructor IMPORTING delimiter TYPE zcl_wd_csv=>mty_delimiter.
constructor IMPORTING delimiter TYPE zcl_wd_csv=>ty_delimiter.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
Expand Down
4 changes: 2 additions & 2 deletions src/zcx_wd_csv_invalid_separator.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ CLASS zcx_wd_csv_invalid_separator DEFINITION PUBLIC INHERITING FROM zcx_wd_csv_
attr4 TYPE scx_attrname VALUE '',
END OF zcx_wd_csv_invalid_separator.
DATA:
separator TYPE zcl_wd_csv=>mty_separator READ-ONLY.
separator TYPE zcl_wd_csv=>ty_separator READ-ONLY.
METHODS:
constructor IMPORTING separator TYPE zcl_wd_csv=>mty_separator.
constructor IMPORTING separator TYPE zcl_wd_csv=>ty_separator.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
Expand Down
102 changes: 51 additions & 51 deletions src/zwd_csv_generation_sample.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ CLASS lcl DEFINITION.
pai.
PRIVATE SECTION.
DATA:
mv_delimiter TYPE zcl_wd_csv=>mty_delimiter,
mv_separator TYPE zcl_wd_csv=>mty_separator,
mv_endofline TYPE string.
delimiter TYPE zcl_wd_csv=>ty_delimiter,
separator TYPE zcl_wd_csv=>ty_separator,
endofline TYPE string.
ENDCLASS.

*=======================================================================
Expand Down Expand Up @@ -112,27 +112,27 @@ CLASS lcl IMPLEMENTATION.
* ---------------------------------------------------------------------
CASE abap_true.
WHEN del_dq.
mv_delimiter = zcl_wd_csv=>mc_delimiter_double_quote.
delimiter = zcl_wd_csv=>c_delimiter_double_quote.
WHEN del_sq.
mv_delimiter = zcl_wd_csv=>mc_delimiter_single_quote.
delimiter = zcl_wd_csv=>c_delimiter_single_quote.
ENDCASE.

* ---------------------------------------------------------------------
CASE abap_true.
WHEN septab.
mv_separator = zcl_wd_csv=>mc_separator_tab.
separator = zcl_wd_csv=>c_separator_tab.
WHEN sepother.
mv_separator = sep.
separator = sep.
ENDCASE.

* ---------------------------------------------------------------------
CASE abap_true.
WHEN crlf.
mv_endofline = zcl_wd_csv=>mc_endofline_cr_lf.
endofline = zcl_wd_csv=>c_endofline_cr_lf.
WHEN lf.
mv_endofline = zcl_wd_csv=>mc_endofline_lf.
endofline = zcl_wd_csv=>c_endofline_lf.
WHEN cr.
mv_endofline = zcl_wd_csv=>mc_endofline_cr.
endofline = zcl_wd_csv=>c_endofline_cr.
ENDCASE.

* ---------------------------------------------------------------------
Expand All @@ -141,26 +141,26 @@ CLASS lcl IMPLEMENTATION.
METHOD shlp_path.
* ---------------------------------------------------------------------
DATA:
lt_files TYPE filetable,
lv_rc TYPE i,
lv_action TYPE i,
lv_filename TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string.

* ---------------------------------------------------------------------
cl_gui_frontend_services=>file_save_dialog( CHANGING filename = lv_filename
path = lv_path
fullpath = lv_fullpath
user_action = lv_action
files TYPE filetable,
rc TYPE i,
action TYPE i,
filename TYPE string,
l_path TYPE string,
fullpath TYPE string.

* ---------------------------------------------------------------------
cl_gui_frontend_services=>file_save_dialog( CHANGING filename = filename
path = l_path
fullpath = fullpath
user_action = action
EXCEPTIONS OTHERS = 1 ).
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

* ---------------------------------------------------------------------
IF lv_action = cl_gui_frontend_services=>action_ok.
path = lv_fullpath.
IF action = cl_gui_frontend_services=>action_ok.
path = fullpath.
ENDIF.

* ---------------------------------------------------------------------
Expand All @@ -170,60 +170,60 @@ CLASS lcl IMPLEMENTATION.
METHOD run.
* ---------------------------------------------------------------------
DATA:
lo_typedescr TYPE REF TO cl_abap_typedescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_csv_file TYPE REF TO zcl_wd_csv_file,
lt_components TYPE cl_abap_structdescr=>component_table,
lr_data TYPE REF TO data,
lx TYPE REF TO cx_root.
typedescr TYPE REF TO cl_abap_typedescr,
structdescr TYPE REF TO cl_abap_structdescr,
tabledescr TYPE REF TO cl_abap_tabledescr,
csv_file TYPE REF TO zcl_wd_csv_file,
components TYPE cl_abap_structdescr=>component_table,
source_table TYPE REF TO data,
error TYPE REF TO cx_root.
FIELD-SYMBOLS:
<lt_data> TYPE STANDARD TABLE.
<source_table> TYPE STANDARD TABLE.

* ---------------------------------------------------------------------
" fake select to check table name
TRY.
SELECT COUNT(*) UP TO 1 ROWS FROM (table).
CATCH cx_sy_dynamic_osql_syntax
cx_sy_dynamic_osql_semantics INTO lx.
MESSAGE lx TYPE 'S' DISPLAY LIKE 'E'.
cx_sy_dynamic_osql_semantics INTO error.
MESSAGE error TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDTRY.

lo_typedescr = cl_abap_structdescr=>describe_by_name( table ).
typedescr = cl_abap_structdescr=>describe_by_name( table ).
TRY.
lo_tabledescr = cl_abap_tabledescr=>create( CAST #( lo_typedescr ) ).
CATCH cx_sy_table_creation INTO lx.
MESSAGE lx TYPE 'S' DISPLAY LIKE 'E'.
tabledescr = cl_abap_tabledescr=>create( CAST #( typedescr ) ).
CATCH cx_sy_table_creation INTO error.
MESSAGE error TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDTRY.

* ---------------------------------------------------------------------
CREATE DATA lr_data TYPE HANDLE lo_tabledescr.
ASSIGN lr_data->* TO <lt_data>.
CREATE DATA source_table TYPE HANDLE tabledescr.
ASSIGN source_table->* TO <source_table>.

* ---------------------------------------------------------------------
TRY.
SELECT * UP TO @rows ROWS
FROM (table)
INTO TABLE @<lt_data>
INTO TABLE @<source_table>
ORDER BY PRIMARY KEY.
CATCH cx_sy_dynamic_osql_syntax
cx_sy_dynamic_osql_semantics INTO lx.
MESSAGE lx TYPE 'S' DISPLAY LIKE 'E'.
cx_sy_dynamic_osql_semantics INTO error.
MESSAGE error TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDTRY.

* ---------------------------------------------------------------------
TRY.
lo_csv_file = NEW #( iv_endofline = mv_endofline
iv_separator = mv_separator
iv_delimiter = mv_delimiter ).
lo_csv_file->generate_file_local( iv_with_header = header
it_data = <lt_data>
iv_path = path ).
CATCH cx_root INTO lx.
MESSAGE lx TYPE 'S' DISPLAY LIKE 'E'.
csv_file = NEW #( endofline = endofline
separator = separator
delimiter = delimiter ).
csv_file->generate_file_local( with_header = header
source_table = <source_table>
path = path ).
CATCH cx_root INTO error.
MESSAGE error TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDTRY.

Expand Down
Loading

0 comments on commit 8b885a8

Please sign in to comment.