Skip to content

Commit

Permalink
Add support for jumping to basis objects
Browse files Browse the repository at this point in the history
  • Loading branch information
mbtools committed Apr 7, 2024
1 parent 0dc2dea commit faaa28c
Show file tree
Hide file tree
Showing 2 changed files with 243 additions and 23 deletions.
200 changes: 177 additions & 23 deletions src/sap/#mbtools#cl_sap.clas.abap
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
CLASS /mbtools/cl_sap DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
CREATE PUBLIC.


************************************************************************
* MBT SAP
Expand All @@ -17,75 +18,88 @@ CLASS /mbtools/cl_sap DEFINITION
valpos TYPE valpos,
appval TYPE ddappval,
ddtext TYPE val_text,
END OF ty_domain_value .
TYPES:
ty_domain_values TYPE STANDARD TABLE OF ty_domain_value WITH DEFAULT KEY .
END OF ty_domain_value,
ty_domain_values TYPE STANDARD TABLE OF ty_domain_value WITH DEFAULT KEY.

CLASS-METHODS class_constructor.

CLASS-METHODS class_constructor .
CLASS-METHODS get_object_wo_namespace
IMPORTING
!iv_obj_name TYPE csequence
RETURNING
VALUE(rv_result) TYPE /mbtools/if_definitions=>ty_name .
VALUE(rv_result) TYPE /mbtools/if_definitions=>ty_name.

CLASS-METHODS get_namespace
IMPORTING
!iv_obj_name TYPE csequence
RETURNING
VALUE(rv_result) TYPE namespace .
VALUE(rv_result) TYPE namespace.

CLASS-METHODS get_object_text
IMPORTING
VALUE(iv_object) TYPE csequence
RETURNING
VALUE(rv_text) TYPE ddtext .
VALUE(rv_text) TYPE ddtext.

CLASS-METHODS get_object_texts
RETURNING
VALUE(rt_object_texts) TYPE /mbtools/if_definitions=>ty_object_texts .
VALUE(rt_object_texts) TYPE /mbtools/if_definitions=>ty_object_texts.

CLASS-METHODS get_text_from_domain
IMPORTING
!iv_domain TYPE any DEFAULT 'YESNO'
!iv_value TYPE any
EXPORTING
VALUE(ev_text) TYPE clike .
VALUE(ev_text) TYPE clike.

CLASS-METHODS get_values_from_domain
IMPORTING
!iv_domain TYPE any
RETURNING
VALUE(rt_values) TYPE ty_domain_values .
VALUE(rt_values) TYPE ty_domain_values.

CLASS-METHODS is_devc_deleted
IMPORTING
!iv_obj_name TYPE csequence
RETURNING
VALUE(rv_result) TYPE abap_bool .
VALUE(rv_result) TYPE abap_bool.

CLASS-METHODS is_fugr_deleted
IMPORTING
!iv_obj_name TYPE csequence
RETURNING
VALUE(rv_result) TYPE abap_bool .
VALUE(rv_result) TYPE abap_bool.

CLASS-METHODS is_prog_deleted
IMPORTING
!iv_obj_name TYPE csequence
RETURNING
VALUE(rv_result) TYPE abap_bool .
VALUE(rv_result) TYPE abap_bool.

CLASS-METHODS is_sap_note
IMPORTING
!iv_input TYPE csequence
RETURNING
VALUE(rv_result) TYPE abap_bool .
VALUE(rv_result) TYPE abap_bool.

CLASS-METHODS is_tobj_deleted
IMPORTING
!iv_obj_name TYPE csequence
RETURNING
VALUE(rv_result) TYPE abap_bool .
VALUE(rv_result) TYPE abap_bool.

CLASS-METHODS object_name_check
IMPORTING
!iv_input TYPE csequence
RETURNING
VALUE(rv_result) TYPE string .
VALUE(rv_result) TYPE string.

CLASS-METHODS show_icon
IMPORTING
!iv_icon TYPE csequence
RETURNING
VALUE(rv_exit) TYPE abap_bool .
VALUE(rv_exit) TYPE abap_bool.

CLASS-METHODS show_object
IMPORTING
!iv_pgmid TYPE csequence DEFAULT 'R3TR'
Expand All @@ -94,23 +108,28 @@ CLASS /mbtools/cl_sap DEFINITION
!iv_line_number TYPE i OPTIONAL
!iv_sub_obj_name TYPE csequence OPTIONAL
RETURNING
VALUE(rv_exit) TYPE abap_bool .
VALUE(rv_exit) TYPE abap_bool.

CLASS-METHODS run_transaction
IMPORTING
!iv_tcode TYPE csequence
RETURNING
VALUE(rv_exit) TYPE abap_bool .
VALUE(rv_exit) TYPE abap_bool.

CLASS-METHODS run_program
IMPORTING
!iv_program TYPE csequence
RETURNING
VALUE(rv_exit) TYPE abap_bool .
VALUE(rv_exit) TYPE abap_bool.

PROTECTED SECTION.

PRIVATE SECTION.

CONSTANTS c_note_min TYPE cwbntnumm VALUE '1' ##NO_TEXT.
CONSTANTS c_note_max TYPE cwbntnumm VALUE '4999999' ##NO_TEXT.
CONSTANTS:
c_note_min TYPE cwbntnumm VALUE '1',
c_note_max TYPE cwbntnumm VALUE '4999999'
.

Check failure on line 132 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

A line should not contain only "." or ")."

https://rules.abaplint.org/line_only_punc
CLASS-DATA gt_object_texts TYPE /mbtools/if_definitions=>ty_object_texts.

CLASS-METHODS _map_object
Expand All @@ -122,6 +141,13 @@ CLASS /mbtools/cl_sap DEFINITION
!ev_pgmid TYPE e071-pgmid
!ev_object TYPE e071-object
!ev_obj_name TYPE e071-obj_name.

CLASS-METHODS _jump_basis
IMPORTING
!iv_pgmid TYPE csequence DEFAULT 'R3TR'
!iv_object TYPE csequence
!iv_obj_name TYPE csequence.

ENDCLASS.


Expand Down Expand Up @@ -170,6 +196,42 @@ CLASS /mbtools/cl_sap IMPLEMENTATION.
ls_object_text-text = 'Concept (Online Text Repository) - Long Texts'(106).
COLLECT ls_object_text INTO gt_object_texts.

" Add Basis Objects
ls_object_text-pgmid = 'ZZZZ'.
ls_object_text-object = 'ZACT'.
ls_object_text-text = 'Activity'(110).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZCLI'.
ls_object_text-text = 'Client'(111).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZPCK'.
ls_object_text-text = 'Package'(112).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZOWN'.
ls_object_text-text = 'Owner'(113).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZPRJ'.
ls_object_text-text = 'Project'(114).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZREQ'.
ls_object_text-text = 'Transport Request'(115).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZSYS'.
ls_object_text-text = 'System'(116).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZGRP'.
ls_object_text-text = 'Target Group'(117).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZLAY'.
ls_object_text-text = 'Transport Layer'(118).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZTGT'.
ls_object_text-text = 'Transport Target'(119).
COLLECT ls_object_text INTO gt_object_texts.
ls_object_text-object = 'ZUSR'.
ls_object_text-text = 'User'(120).
COLLECT ls_object_text INTO gt_object_texts.

" Add Workbench Development Objects
SELECT type AS object type AS type singular AS text FROM euobjt APPENDING TABLE gt_object_texts
WHERE spras = sy-langu ORDER BY type singular ##SUBRC_OK. "#EC CI_GENBUFF
Expand Down Expand Up @@ -621,6 +683,16 @@ CLASS /mbtools/cl_sap IMPLEMENTATION.
ENDIF.
ENDIF.

" Basis objects
IF iv_pgmid = 'ZZZZ'.
_jump_basis(
iv_pgmid = iv_pgmid
iv_object = iv_object
iv_obj_name = iv_obj_name ).

RETURN.
ENDIF.

lv_object = iv_object.
lv_obj_name = iv_obj_name.
lv_sub_obj_name = iv_sub_obj_name.
Expand Down Expand Up @@ -685,6 +757,88 @@ CLASS /mbtools/cl_sap IMPLEMENTATION.
ENDMETHOD.


METHOD _jump_basis.

DATA:
lv_activity TYPE tractivity,
lv_client TYPE mandt,
lv_devclass TYPE devclass,
lv_trkorr TYPE trkorr,
lv_project TYPE trkorr_p,
lv_system TYPE sysname,
lv_translayer TYPE devlayer,
lv_username TYPE xubname.

CASE iv_object.
WHEN /mbtools/if_command_field=>c_objects_basis-activity.

Check failure on line 773 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_activity = iv_obj_name.

CALL FUNCTION 'TR_SHOW_ACTIVITY'
EXPORTING
iv_activity = lv_activity.

WHEN /mbtools/if_command_field=>c_objects_basis-client.

Check failure on line 780 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_client = iv_obj_name.

CALL FUNCTION 'TR_SHOW_CLIENT'
EXPORTING
iv_client = lv_client.

WHEN /mbtools/if_command_field=>c_objects_basis-devclass.

Check failure on line 787 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_devclass = iv_obj_name.

CALL FUNCTION 'TR_SHOW_DEVCLASS'
EXPORTING
iv_devclass = lv_devclass.

WHEN /mbtools/if_command_field=>c_objects_basis-owner.

Check failure on line 794 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_trkorr = iv_obj_name.

CALL FUNCTION 'TR_SHOW_OWNER'
EXPORTING
iv_trkorr = lv_trkorr.

WHEN /mbtools/if_command_field=>c_objects_basis-project.

Check failure on line 801 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_project = iv_obj_name.

CALL FUNCTION 'TR_SHOW_PROJECT'
EXPORTING
iv_project = lv_project.

WHEN /mbtools/if_command_field=>c_objects_basis-request.

Check failure on line 808 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_trkorr = iv_obj_name.

CALL FUNCTION 'TR_SHOW_REQUEST'
EXPORTING
iv_trkorr = lv_trkorr
iv_popup = abap_true.

WHEN /mbtools/if_command_field=>c_objects_basis-system.

Check failure on line 816 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_system = iv_obj_name.

CALL FUNCTION 'TR_SHOW_SYSTEM'
EXPORTING
iv_system = lv_system.

WHEN /mbtools/if_command_field=>c_objects_basis-translayer.

Check failure on line 823 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_translayer = iv_obj_name.

CALL FUNCTION 'TR_SHOW_TRANSLAYER'
EXPORTING
iv_translayer = lv_translayer.

WHEN /mbtools/if_command_field=>c_objects_basis-user.

Check failure on line 830 in src/sap/#mbtools#cl_sap.clas.abap

View check run for this annotation

abaplint / abaplint

Unknown class /mbtools/if_command_field

https://rules.abaplint.org/check_syntax
lv_username = iv_obj_name.

CALL FUNCTION 'TR_SHOW_USER'
EXPORTING
iv_username = lv_username.

ENDCASE.

ENDMETHOD.


METHOD _map_object.

DATA:
Expand Down
66 changes: 66 additions & 0 deletions src/sap/#mbtools#cl_sap.clas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,72 @@
<ENTRY>System Head</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>110</KEY>
<ENTRY>Activity</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>111</KEY>
<ENTRY>Client</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>112</KEY>
<ENTRY>Package</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>113</KEY>
<ENTRY>Owner</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>114</KEY>
<ENTRY>Project</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>115</KEY>
<ENTRY>Transport Request</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>116</KEY>
<ENTRY>System</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>117</KEY>
<ENTRY>Target Group</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>118</KEY>
<ENTRY>Transport Layer</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>119</KEY>
<ENTRY>Transport Target</ENTRY>
<LENGTH>60</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>120</KEY>
<ENTRY>User</ENTRY>
<LENGTH>60</LENGTH>
</item>
</TPOOL>
<DESCRIPTIONS>
<SEOCOMPOTX>
Expand Down

0 comments on commit faaa28c

Please sign in to comment.