Anzeige einer Klasse und/oder Methode (Globale Klassen)

Alles rund um die Sprache ABAP®: Funktionsbausteine, Listen, ALV
4 Beiträge Seite 1 von 1
4 Beiträge Seite 1 von 1

Anzeige einer Klasse und/oder Methode (Globale Klassen)

Beitrag von hfahrian (ForumUser / 53 / 7 / 0 ) » 2. Apr 2018 07:33

Hallo zusammen,
ich suche nach einer Möglichkeit per FUBA oder Klasse eine existierende globale Klasse (angelegt über SE24) anzuzeigen.
Desweiteren sollte eine Möglichkeit (per FUBA oder Klasse) eine Klasse und Methode vorzugeben. Mit diesen Vorgaben sollte das Methodencoding angezeigt werden.
Habe mehrere Möglichkeiten versucht, war allerdings bisher erfolglos.
Vielleicht kennt jemand eine FUBA der dies auslöst.
Vielen Dank für alle Ideen!
Henry
Henry Fahrian
Director Innovate ITC - SAP Consulting/Development
Mauritius


Re: Anzeige einer Klasse und/oder Methode (Globale Klassen)

Beitrag von gtoXX (Specialist / 111 / 22 / 14 ) » 2. Apr 2018 08:23

Hallo Henry,

ein Absprung in die SE24 genügt nicht ?

Gruß,

GTO

Re: Anzeige einer Klasse und/oder Methode (Globale Klassen)

Beitrag von hfahrian (ForumUser / 53 / 7 / 0 ) » 4. Apr 2018 10:45

Ich konnte nun eine sehr effiziente Lösung umsetzen:
Es werden passende Request für den WB-Manager anhand von Vorgaben aufgebaut und abschliessen der WB-Manager über die Klasse cl_wb_startup versorgt.
Funktioniert perfekt.

Code: Alles auswählen.

* ======================================================================
* FUBA: Klassen-Objekte anzeigen anhand Objektvorgaben
* ======================================================================
* Anhand der Vorgaben werden die entsprechenden Objekte im WB-Manager
* angezeigt. Dies erfolgt über Request-Aufbau für den WB-Manager.
* ======================================================================
* HINWEIS: Umsetzung erfolgte durch BREAK-POINT in der Methode
* CL_WB_MANAGER=>PROCESS_REQUEST_QUEUE und Analyse der Request-Definitionen!
* Dabei Aufruf einer Klasse aus SE24 / Interface-Aufruf / Doppelklick
* auf eine Methode ...
* ======================================================================

  DATA: ld_class       TYPE seoclsname,
        ld_method      TYPE seomtdname,
        ld_name        TYPE progname,
        ld_cnt         TYPE i,
        ld_edit_mode   TYPE xflag,
        ld_obj_defined TYPE xflag,
        ld_class_exist TYPE xflag,
        ld_meth_exist  TYPE xflag,
        ld_is_intf     TYPE xflag,
        ls_poolinc     TYPE zst_tuit_clas_includes_extend,
        ls_methinc     TYPE zst_tuit_clas_includes_extend.
  DATA: lro_request       TYPE REF TO cl_wb_request,
        lt_wb_request_set TYPE swbm_wb_request_set,
        ld_object_name    TYPE seu_objkey,
        ld_object_type    TYPE seu_objtyp,
        ld_operation      TYPE seu_action,
        lro_container     TYPE REF TO cl_wb_data_container,
        ls_error          TYPE wberror.

* =>Prüfungen ...
  IF id_obj_name IS INITIAL.
    EXIT.
  ENDIF.
* =>Verarbeitung anstossen; Objekt-Namen festlegen
  ld_name = id_obj_name.
* =>Reduce falls nicht direkt Klassenname übergeben wurde
  CALL FUNCTION 'Z_FB_TUIT_CLASS_OVERLAY_REDUCE'
    CHANGING
      cd_rep_inc = ld_name.
  ld_class     = ld_name.
  ld_method    = id_method.
  ld_edit_mode = id_edit_mode.

* =>Existensprüfung + Prüfung ob Interface!
  CALL FUNCTION 'Z_FB_TUIT_CLASS_EXIST_SPECIAL'
    EXPORTING
      id_obj_name     = ld_class
      id_method       = ld_method
    CHANGING
      cd_class_exist  = ld_class_exist
      cd_is_intf      = ld_is_intf
      cd_method_exist = ld_meth_exist.
  CHECK NOT ld_class_exist IS INITIAL.

* =>Klassen-Includes und Details ermitteln
  CALL FUNCTION 'Z_FB_TUIT_CLASS_GET_ALL_INCL'
    EXPORTING
      id_obj_name       = ld_class
      id_method         = ld_method
    CHANGING
      cs_cls_inc_method = ls_methinc
      cs_cls_inc_pool   = ls_poolinc.

* ======================================================================
* =>Objekt zur Verarbeitung festlegen anhand Vorgaben
* ======================================================================
  CLEAR ld_obj_defined.
  IF NOT id_class_obj IS INITIAL.
*   ====================================================================
*    =>Objekt: Klassen Objekt gewünscht
*   ====================================================================
    IF ld_is_intf IS INITIAL.
      ld_object_type = swbm_c_type_class.      "OC => Klasse
    ELSE.
      ld_object_type = swbm_c_type_interface.  "OI => Interface
    ENDIF.
*   =>Objektname aufbauen
    CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
      EXPORTING
        p_key_component1        = ld_class
        p_external_id           = ld_object_type
      RECEIVING
        p_key                   = ld_object_name
      EXCEPTIONS
        too_many_key_components = 1
        objecttype_not_existing = 2
        key_component_too_long  = 3
        OTHERS                  = 4.
    IF sy-subrc <> 0.
      CLEAR ld_obj_defined.
    ELSE.
      ld_obj_defined = gsx.
    ENDIF.
*   =>Edit-Mode oder Display?
    IF NOT ld_edit_mode IS INITIAL.
      IF NOT id_chk_permission IS INITIAL.
*       =>Check Permission durchführen (COMPLEX)
        CALL FUNCTION 'Z_FB_TUIT_PROG_OBJ_CHK_ACCESS'
          EXPORTING
            id_prog_obj     = ls_poolinc-name
            id_object_class = 'ABAP'
            id_chk_main_obj = gsp
            id_edit_mode    = ld_edit_mode
            id_chk_system   = gsx
          CHANGING
            cd_permission   = ld_edit_mode.
      ELSE.
*       =>Check Permission durchführen (SIMPLE)
        IF NOT ls_poolinc-is_sap_incl IS INITIAL.
          CLEAR ld_edit_mode.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
* ======================================================================
* =>Requests für WB-Manager aufbauen
* ======================================================================
  IF NOT ld_obj_defined IS INITIAL.
    IF NOT ld_edit_mode IS INITIAL.
      ld_operation = swbm_c_op_edit.     "'EDIT'
    ELSE.
      ld_operation = swbm_c_op_display.  "'DISPLAY'
    ENDIF.
    CREATE OBJECT lro_request
      EXPORTING
        p_object_type = ld_object_type
        p_object_name = ld_object_name
        p_operation   = ld_operation.
    APPEND lro_request TO lt_wb_request_set.
  ENDIF.

  CLEAR ld_obj_defined.
  IF NOT id_class_def_obj IS INITIAL.
*   ====================================================================
*    =>Objekt: Klassen Eigenschaften gewünscht
*   ====================================================================
    IF ld_is_intf IS INITIAL.
      ld_object_type = swbm_c_type_cls_definition.  "OCD => Klasse-Eigenschaften
    ELSE.
      ld_object_type = swbm_c_type_cls_definition.  "OCD => Klasse-Eigenschaften
    ENDIF.
*   =>Objektname aufbauen
    CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
      EXPORTING
        p_key_component1        = ld_class
        p_external_id           = ld_object_type
      RECEIVING
        p_key                   = ld_object_name
      EXCEPTIONS
        too_many_key_components = 1
        objecttype_not_existing = 2
        key_component_too_long  = 3
        OTHERS                  = 4.
    IF sy-subrc <> 0.
      CLEAR ld_obj_defined.
    ELSE.
      ld_obj_defined = gsx.
    ENDIF.
*   =>Edit-Mode oder Display?
    IF NOT ld_edit_mode IS INITIAL.
      IF NOT id_chk_permission IS INITIAL.
*       =>Check Permission durchführen (COMPLEX)
        CALL FUNCTION 'Z_FB_TUIT_PROG_OBJ_CHK_ACCESS'
          EXPORTING
            id_prog_obj     = ls_poolinc-name
            id_object_class = 'ABAP'
            id_chk_main_obj = gsp
            id_edit_mode    = ld_edit_mode
            id_chk_system   = gsx
          CHANGING
            cd_permission   = ld_edit_mode.
      ELSE.
*       =>Check Permission durchführen (SIMPLE)
        IF NOT ls_poolinc-is_sap_incl IS INITIAL.
          CLEAR ld_edit_mode.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
* ======================================================================
* =>Requests für WB-Manager aufbauen
* ======================================================================
  IF NOT ld_obj_defined IS INITIAL.
    IF NOT ld_edit_mode IS INITIAL.
      ld_operation = swbm_c_op_edit.     "'EDIT'
    ELSE.
      ld_operation = swbm_c_op_display.  "'DISPLAY'
    ENDIF.
    CREATE OBJECT lro_request
      EXPORTING
        p_object_type = ld_object_type
        p_object_name = ld_object_name
        p_operation   = ld_operation.
    APPEND lro_request TO lt_wb_request_set.
  ENDIF.

  CLEAR ld_obj_defined.
  IF NOT id_class_attr_obj IS INITIAL.
*   ====================================================================
*    =>Objekt: Klassen Attribute gewünscht
*   ====================================================================
    IF ld_is_intf IS INITIAL.
      ld_object_type = swbm_c_type_cls_attribute.  "OA => Klasse-Attribute
    ELSE.
      ld_object_type = swbm_c_type_intf_attribute. "IA => Interface-Attribute
    ENDIF.
*   =>Objektname aufbauen
    CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
      EXPORTING
        p_key_component1        = ld_class
        p_external_id           = ld_object_type
      RECEIVING
        p_key                   = ld_object_name
      EXCEPTIONS
        too_many_key_components = 1
        objecttype_not_existing = 2
        key_component_too_long  = 3
        OTHERS                  = 4.
    IF sy-subrc <> 0.
      CLEAR ld_obj_defined.
    ELSE.
      ld_obj_defined = gsx.
    ENDIF.
*   =>Edit-Mode oder Display?
    IF NOT ld_edit_mode IS INITIAL.
      IF NOT id_chk_permission IS INITIAL.
*       =>Check Permission durchführen (COMPLEX)
        CALL FUNCTION 'Z_FB_TUIT_PROG_OBJ_CHK_ACCESS'
          EXPORTING
            id_prog_obj     = ls_poolinc-name
            id_object_class = 'ABAP'
            id_chk_main_obj = gsp
            id_edit_mode    = ld_edit_mode
            id_chk_system   = gsx
          CHANGING
            cd_permission   = ld_edit_mode.
      ELSE.
*       =>Check Permission durchführen (SIMPLE)
        IF NOT ls_poolinc-is_sap_incl IS INITIAL.
          CLEAR ld_edit_mode.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
* ======================================================================
* =>Requests für WB-Manager aufbauen
* ======================================================================
  IF NOT ld_obj_defined IS INITIAL.
    IF NOT ld_edit_mode IS INITIAL.
      ld_operation = swbm_c_op_edit.     "'EDIT'
    ELSE.
      ld_operation = swbm_c_op_display.  "'DISPLAY'
    ENDIF.
    CREATE OBJECT lro_request
      EXPORTING
        p_object_type = ld_object_type
        p_object_name = ld_object_name
        p_operation   = ld_operation.
    APPEND lro_request TO lt_wb_request_set.
  ENDIF.

  CLEAR ld_obj_defined.
  IF NOT id_class_type_obj IS INITIAL.
*   ====================================================================
*    =>Objekt: Klassen Typen gewünscht
*   ====================================================================
    IF ld_is_intf IS INITIAL.
      ld_object_type = swbm_c_type_cls_type.  "OT => Klasse-Typen
    ELSE.
      ld_object_type = swbm_c_type_intf_type. "IT => Interface-Typen
    ENDIF.
*   =>Objektname aufbauen
    CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
      EXPORTING
        p_key_component1        = ld_class
        p_external_id           = ld_object_type
      RECEIVING
        p_key                   = ld_object_name
      EXCEPTIONS
        too_many_key_components = 1
        objecttype_not_existing = 2
        key_component_too_long  = 3
        OTHERS                  = 4.
    IF sy-subrc <> 0.
      CLEAR ld_obj_defined.
    ELSE.
      ld_obj_defined = gsx.
    ENDIF.
*   =>Edit-Mode oder Display?
    IF NOT ld_edit_mode IS INITIAL.
      IF NOT id_chk_permission IS INITIAL.
*       =>Check Permission durchführen (COMPLEX)
        CALL FUNCTION 'Z_FB_TUIT_PROG_OBJ_CHK_ACCESS'
          EXPORTING
            id_prog_obj     = ls_poolinc-name
            id_object_class = 'ABAP'
            id_chk_main_obj = gsp
            id_edit_mode    = ld_edit_mode
            id_chk_system   = gsx
          CHANGING
            cd_permission   = ld_edit_mode.
      ELSE.
*       =>Check Permission durchführen (SIMPLE)
        IF NOT ls_poolinc-is_sap_incl IS INITIAL.
          CLEAR ld_edit_mode.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
* ======================================================================
* =>Requests für WB-Manager aufbauen
* ======================================================================
  IF NOT ld_obj_defined IS INITIAL.
    IF NOT ld_edit_mode IS INITIAL.
      ld_operation = swbm_c_op_edit.     "'EDIT'
    ELSE.
      ld_operation = swbm_c_op_display.  "'DISPLAY'
    ENDIF.
    CREATE OBJECT lro_request
      EXPORTING
        p_object_type = ld_object_type
        p_object_name = ld_object_name
        p_operation   = ld_operation.
    APPEND lro_request TO lt_wb_request_set.
  ENDIF.

  CLEAR ld_obj_defined.
  IF NOT id_meth_imp_obj IS INITIAL AND NOT ld_meth_exist IS INITIAL.
*   ====================================================================
*   =>Objekt: Methoden-Implementierung gewünscht
*   Hinweis: Macht nur Sinn bei CLAS nicht INTF
*   ====================================================================
    IF ld_is_intf IS INITIAL.
      ld_object_type = swbm_c_type_cls_mtd_impl.   "OM => Methoden
    ELSE.
      ld_object_type = swbm_c_type_intf_mtd_def.   "IO => Interface-Methode
    ENDIF.
*   =>Objektname aufbauen
    CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
      EXPORTING
        p_key_component1        = ld_class
        p_key_component2        = ld_method
        p_external_id           = ld_object_type
      RECEIVING
        p_key                   = ld_object_name
      EXCEPTIONS
        too_many_key_components = 1
        objecttype_not_existing = 2
        key_component_too_long  = 3
        OTHERS                  = 4.
    IF sy-subrc <> 0.
      CLEAR ld_obj_defined.
    ELSE.
      ld_obj_defined = gsx.
    ENDIF.
*   =>Edit-Mode oder Display?
    IF NOT ld_edit_mode IS INITIAL.
      IF NOT id_chk_permission IS INITIAL.
*       =>Check Permission durchführen (COMPLEX)
        CALL FUNCTION 'Z_FB_TUIT_PROG_OBJ_CHK_ACCESS'
          EXPORTING
            id_prog_obj     = ls_methinc-name
            id_object_class = 'ABAP'
            id_chk_main_obj = gsp
            id_edit_mode    = ld_edit_mode
            id_chk_system   = gsx
          CHANGING
            cd_permission   = ld_edit_mode.
      ELSE.
*       =>Check Permission durchführen (SIMPLE)
        IF NOT ls_methinc-is_sap_incl IS INITIAL.
          CLEAR ld_edit_mode.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
* ======================================================================
* =>Requests für WB-Manager aufbauen
* ======================================================================
  IF NOT ld_obj_defined IS INITIAL.
    IF NOT ld_edit_mode IS INITIAL.
      ld_operation = swbm_c_op_edit.     "'EDIT'
    ELSE.
      ld_operation = swbm_c_op_display.  "'DISPLAY'
    ENDIF.
    CREATE OBJECT lro_request
      EXPORTING
        p_object_type = ld_object_type
        p_object_name = ld_object_name
        p_operation   = ld_operation.
    APPEND lro_request TO lt_wb_request_set.
  ENDIF.

  CLEAR ld_obj_defined.
  IF NOT id_meth_para_obj IS INITIAL AND NOT ld_meth_exist IS INITIAL.
*   ====================================================================
*   =>Objekt: Objekt: Methoden-Parameter gewünscht
*   ====================================================================
    IF ld_is_intf IS INITIAL.
      ld_object_type = swbm_c_type_cls_mtd_param.   "OOP => Methoden-Parameter
    ELSE.
      ld_object_type = swbm_c_type_intf_mtd_param.  "IOP => Interface Methoden-Parameter
    ENDIF.
*   =>Objektname aufbauen
    CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
      EXPORTING
        p_key_component1        = ld_class
        p_key_component2        = ld_method
        p_external_id           = ld_object_type
      RECEIVING
        p_key                   = ld_object_name
      EXCEPTIONS
        too_many_key_components = 1
        objecttype_not_existing = 2
        key_component_too_long  = 3
        OTHERS                  = 4.
    IF sy-subrc <> 0.
      CLEAR ld_obj_defined.
    ELSE.
      ld_obj_defined = gsx.
    ENDIF.
*   =>Edit-Mode oder Display?
    IF NOT ld_edit_mode IS INITIAL.
      IF NOT id_chk_permission IS INITIAL.
*         =>Check Permission durchführen (COMPLEX)
        CALL FUNCTION 'Z_FB_TUIT_PROG_OBJ_CHK_ACCESS'
          EXPORTING
            id_prog_obj     = ls_methinc-name
            id_object_class = 'ABAP'
            id_chk_main_obj = gsp
            id_edit_mode    = ld_edit_mode
            id_chk_system   = gsx
          CHANGING
            cd_permission   = ld_edit_mode.
      ELSE.
*       =>Check Permission durchführen (SIMPLE)
        IF NOT ls_methinc-is_sap_incl IS INITIAL.
          CLEAR ld_edit_mode.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
* ======================================================================
* =>Requests für WB-Manager aufbauen
* ======================================================================
  IF NOT ld_obj_defined IS INITIAL.
    IF NOT ld_edit_mode IS INITIAL.
      ld_operation = swbm_c_op_edit.     "'EDIT'
    ELSE.
      ld_operation = swbm_c_op_display.  "'DISPLAY'
    ENDIF.
    CREATE OBJECT lro_request
      EXPORTING
        p_object_type = ld_object_type
        p_object_name = ld_object_name
        p_operation   = ld_operation.
    APPEND lro_request TO lt_wb_request_set.
  ENDIF.

* ======================================================================
* =>WB Call durchführen
* ======================================================================
* =>Realer WB Call nur falls nun Request für WB vorliegen!
  DESCRIBE TABLE lt_wb_request_set LINES ld_cnt.
  IF ld_cnt IS INITIAL.
    EXIT.
  ENDIF.
  CREATE OBJECT lro_container.
  CLASS cl_wb_startup DEFINITION LOAD.
  CALL METHOD cl_wb_startup=>start
    EXPORTING
      p_wb_request_set         = lt_wb_request_set
    IMPORTING
      p_wb_error               = ls_error
    CHANGING
      p_wb_data_container      = lro_container
    EXCEPTIONS
      manager_not_yet_released = 1.
  IF sy-subrc = 0.
    EXIT.
  ENDIF.

ENDFUNCTION.
Henry Fahrian
Director Innovate ITC - SAP Consulting/Development
Mauritius

Re: Anzeige einer Klasse und/oder Methode (Globale Klassen)

Beitrag von ewx (Top Expert / 3940 / 161 / 359 ) » 21. Sep 2018 16:19

Danke für's Teilen!
Allerdings ist der Code nur teilweise sinnvoll, wenn man nicht weiß, was deine ganzen Z_FB_TUIT-Bausteine im Detail machen...
Einige Machen nur Berechtigungsprüfungen, aber was machen diese:
- Z_FB_TUIT_CLASS_EXIST_SPECIAL
- Z_FB_TUIT_CLASS_GET_ALL_INCL
- Z_FB_TUIT_CLASS_OVERLAY_REDUCE

??

Seite 1 von 1

Aktuelle Forenbeiträge

Abrechnung Konditionskontrakte Wildcards
vor 18 Minuten von SAP_ENTWICKLER 3 / 34
Userexit vor dem Transport-import
vor 2 Stunden von il.ost 5 / 70
ABAP Clean Code
vor 5 Stunden von ralf.wenzel 38 / 857
ADOBE Forms - geschachtelte Tabellen
vor 16 Stunden von a-dead-trousers 3 / 51
Merkmale in Abhängigkeit vom Beziehungswissen
vor 19 Stunden von wreichelt 6 / 178

Unbeantwortete Forenbeiträge

[GELÖST] Feld KNVV-BOIDT
vor 4 Tagen von SAP_ENTWICKLER 1 / 49
Sortierbegriffe einer Stückliste ändern
vor 5 Tagen von mbiesenb 1 / 40
Feiertagsklasse und Lohnart Verknüpfung entfernen
vor 5 Tagen von Flashtie 1 / 39
Berechtigungen für Batch User
vor einer Woche von JohnLocklay 1 / 86