Skip to content

Instantly share code, notes, and snippets.

@mbtools
Created June 18, 2020 19:49
Show Gist options
  • Save mbtools/e3a9d5e551f50fb211679e09d2c8fdd5 to your computer and use it in GitHub Desktop.
Save mbtools/e3a9d5e551f50fb211679e09d2c8fdd5 to your computer and use it in GitHub Desktop.
Check max length and namespace support for object supported by abapGit
REPORT zabapgit_object_type_check LINE-SIZE 255.
TABLES: objh.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS:
s_obj FOR objh-objectname.
SELECTION-SCREEN END OF BLOCK b1.
TYPES:
BEGIN OF ty_alv,
object TYPE tadir-object,
text TYPE ko100-text,
max_length TYPE i,
namespace TYPE string,
example TYPE string,
END OF ty_alv.
START-OF-SELECTION.
PERFORM run.
FORM run.
DATA:
lt_types TYPE zcl_abapgit_objects=>ty_types_tt,
lv_type LIKE LINE OF lt_types,
ls_obj TYPE ko100,
lt_obj TYPE STANDARD TABLE OF ko100,
ls_alv TYPE ty_alv,
lt_alv TYPE STANDARD TABLE OF ty_alv,
ls_i_e071 TYPE e071,
lv_result TYPE trpari-s_checked,
ls_tadir TYPE tadir,
lv_objlen TYPE tlock-len.
CALL FUNCTION 'TR_OBJECT_TABLE'
TABLES
wt_object_text = lt_obj.
lt_types = zcl_abapgit_objects=>supported_list( ).
LOOP AT lt_types INTO lv_type.
CHECK lv_type IN s_obj.
CLEAR ls_alv.
ls_alv-object = lv_type.
READ TABLE lt_obj INTO ls_obj WITH KEY pgmid = 'R3TR' object = lv_type.
IF sy-subrc = 0.
ls_alv-text = ls_obj-text.
ELSE.
CONTINUE.
ENDIF.
ls_i_e071-pgmid = 'R3TR'.
ls_i_e071-object = lv_type.
ls_i_e071-obj_name = 'Z2345678901234567890123456789012345678901234567890123456789012345678901234567890'.
CALL FUNCTION 'TR_CHECK_TYPE'
EXPORTING
wi_e071 = ls_i_e071
IMPORTING
pe_result = lv_result
we_tadir = ls_tadir
ev_objlen = lv_objlen.
ls_alv-max_length = lv_objlen.
SELECT SINGLE * INTO ls_tadir FROM tadir
WHERE pgmid = 'R3TR' AND object = lv_type AND obj_name LIKE '/%'.
IF sy-subrc = 0.
ls_alv-namespace = 'namespace supported'.
ls_alv-example = ls_tadir-obj_name.
ELSE.
ls_alv-namespace = 'no namespaced object found'.
ENDIF.
APPEND ls_alv TO lt_alv.
ENDLOOP.
CALL FUNCTION 'RSDU_CALL_ALV_TABLE'
EXPORTING
i_title = 'abapGit Object Types'
i_ta_data = lt_alv.
ENDFORM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment