Skip to content

Commit

Permalink
Marc-Bernard-Tools#12 added support for more types of parameter t-codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alih-b authored Apr 17, 2024
1 parent c542694 commit 1a93b9a
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions src/#mbtools#cl_command__show.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ CLASS /mbtools/cl_command__show IMPLEMENTATION.
lt_param TYPE string_table,
ls_report TYPE srepovari,
ls_mtdkey TYPE seocpdkey,
lv_object_is_tcode TYPE abap_bool,
lv_object TYPE c LENGTH 120.

lv_tcode = iv_object_name.
Expand All @@ -165,29 +166,30 @@ CLASS /mbtools/cl_command__show IMPLEMENTATION.
report_structure = ls_report
EXCEPTIONS
no_report_transaction = 1
others = 2.
OTHERS = 2.
IF sy-subrc = 0 AND ls_report-report IS NOT INITIAL.
rs_tadir_key-object = 'PROG'.
CASE ls_report-reporttype.
WHEN INITIAL.
WHEN ''.
rs_tadir_key-obj_name = ls_report-report.
WHEN 'TR'.
" It is very unlikely to have a parameter t-code for
" another parameter t-code
" and SAP discourages it with warning
" so this is sufficient
lv_tcode = ls_report-report.
CALL FUNCTION 'SRT_GET_REPORT_OF_TCODE'
EXPORTING
tcode = lv_tcode
IMPORTING
report_structure = ls_report
EXCEPTIONS
no_report_transaction = 1
others = 2.

lv_tcode = ls_report-report.
CALL FUNCTION 'SRT_GET_REPORT_OF_TCODE'
EXPORTING
tcode = lv_tcode
IMPORTING
report_structure = ls_report
EXCEPTIONS
no_report_transaction = 1
OTHERS = 2.
rs_tadir_key-obj_name = ls_report-report.
WHEN OTHERS.
WHEN OTHERS.
MESSAGE 'It is a generated report' type 'I'.

Check failure on line 191 in src/#mbtools#cl_command__show.clas.abap

View check run for this annotation

abaplint / abaplint

Keyword should be upper case: "type"

https://rules.abaplint.org/keyword_case
RETURN.
ENDCASE.
RETURN.
ENDIF.
Expand All @@ -198,12 +200,35 @@ CLASS /mbtools/cl_command__show IMPLEMENTATION.
ENDIF.

SPLIT lv_param AT ';' INTO TABLE lt_param.

FIND REGEX '\\PROGRAM=(.+)\\CLASS' IN TABLE lt_param SUBMATCHES lv_object.
IF sy-subrc <> 0.
FIND REGEX 'RS38M-PROGRAMM=(.+)' IN TABLE lt_param SUBMATCHES lv_object ##SUBRC_OK.

Check failure on line 205 in src/#mbtools#cl_command__show.clas.abap

View check run for this annotation

abaplint / abaplint

SUBRC_OK can be removed as sy-subrc is checked

https://rules.abaplint.org/unnecessary_pragma
CHECK sy-subrc <> 0.
" if skip initial screen is checked and it is assigned to t-code
FIND REGEX '\/\*(\w+)' IN TABLE lt_param SUBMATCHES lv_object.
IF sy-subrc = 0.
lv_object_is_tcode = abap_true.
ENDIF.
CHECK sy-subrc <> 0.
" if skip initial screen is not checked
FIND REGEX '\/N(\w+)' IN TABLE lt_param SUBMATCHES lv_object.
IF sy-subrc = 0.
lv_object_is_tcode = abap_true.
ENDIF.
ENDIF.
IF lv_object IS NOT INITIAL AND lv_object_is_tcode.

Check failure on line 219 in src/#mbtools#cl_command__show.clas.abap

View check run for this annotation

abaplint / abaplint

Statement does not exist in ABAPv702(or a parser error), "IF"

https://rules.abaplint.org/parser_error
CALL FUNCTION 'SRT_GET_REPORT_OF_TCODE'
EXPORTING
tcode = lv_object
IMPORTING
report_structure = ls_report
EXCEPTIONS
no_report_transaction = 1
OTHERS = 2.
rs_tadir_key-object = 'PROG'.
rs_tadir_key-obj_name = ls_report-report.
RETURN.
ENDIF.

IF lv_object IS NOT INITIAL.
rs_tadir_key-object = 'PROG'.
rs_tadir_key-obj_name = lv_object.
Expand Down

0 comments on commit 1a93b9a

Please sign in to comment.