Zum Inhalt springen

xurgestaltx

Mitglieder
  • Gesamte Inhalte

    3
  • Benutzer seit

  • Letzter Besuch

Beiträge von xurgestaltx

  1. Guten Morgen, ich hab ein Problem in einem SAP ABAP Programm, ich habe 2 mal ein Programm geschrieben: 1 mal mit Dynamischer Selektion und 1 mal mit einer ALV Ausgabe - Problem: Ich bin vermutlich zu doof für Copy & Paste! Kann jemand da bitte drüber schauen und mir sagen, warum er mir keine ALV Ausgabe bietet und mir erklären, was ich falsch mache?

    *&---------------------------------------------------------------------*
    *& Report Z_BC_AUTH
    *&
    *&---------------------------------------------------------------------*
    *&Infosystem zur Abfrage von:
    *& 1. Transaktionen -> Welche Rollen behinhalten die ausgewählte Transaktion
    *& 2. Rollen -> Welche Transaktionen können mit der ausgewählten Rolle aufgerufen werden
    *& 3. Benutzer -> Welche Rollen haben ausgewählte Benutzer
    *& Ausagbe: ALV-Liste
    *&---------------------------------------------------------------------*

    report z_bc_auth.

    tables: sscrfields,
    agr_tcodes,
    agr_texts.


    data: lttstct type table of tstct,
    wa_tstct type tstct.
    data: ltrole_owner type table of /realtime/apmc23-role_owner,
    ltagr_texts type table of agr_texts.

    types: begin of ls_roles,
    agr_name type agr_name,
    text type agr_title,
    role_owner type /realtime/apm_owner,
    end of ls_roles.

    types: begin of ls_tcode,
    tcode type agxreport,
    ttext type ttext_stct,
    end of ls_tcode.


    data: wa_agr_tcodes type agr_tcodes,
    lt_agr_tcodes type table of agr_tcodes.
    data: wa_tcode type ls_tcode,
    lt_tcode type table of ls_tcode.

    data: wa_roles type zsd_roles,
    lt_roles type table of zsd_roles.

    data: lv_counter1 type flag,
    lv_counter2 type flag,
    lv_counter3 type flag.

    data: ok_code like sy-ucomm,
    * allgemeiner Container für die Darstellung (Custom Controls)
    g_custom_container type ref to cl_gui_custom_container,
    * Containername im Dynpro (Custom Controls)
    g_container type scrfname value 'LT_ROLES',
    * Klasse mit allen Methoden und Attributen für die ALV-Grid Darstellung
    grid1 type ref to cl_gui_alv_grid,
    * Layoutvariante, welche vorgegeben werden kann
    lv_variant type disvariant.




    selection-screen begin of screen 100 as subscreen.

    parameters: rb_tcode radiobutton group a1 user-command uc2 default 'X',
    rb_role radiobutton group a1,
    rb_user radiobutton group a1.
    selection-screen skip.
    parameters: p_tcode type agr_tcodes-tcode modif id uc1.
    parameters: p_role type agr_tcodes-agr_name default 'Z:*' modif id uc1.
    parameters: p_user type sy-uname default sy-uname matchcode object kw_f4_username modif id uc1.

    selection-screen end of screen 100.

    selection-screen begin of tabbed block block1 for 6 lines.
    selection-screen tab (30) tab1 user-command '' default screen 100.
    selection-screen end of block block1.

    initialization.
    tab1 = 'Auswahl über'.

    at selection-screen output.
    loop at screen.
    * Radiobutton rb_tcode
    if screen-group1 = 'UC1'.
    if rb_tcode eq 'X' and ( screen-name = 'P_TCODE' or screen-name = '%_P_TCODE_%_APP_%-TEXT' ).
    screen-active = 1.
    screen-invisible = 0.
    modify screen.
    * Radiobutton rb_tcode
    elseif rb_tcode ne 'X' and ( screen-name = 'P_TCODE' or screen-name = '%_P_TCODE_%_APP_%-TEXT' ).
    screen-active = 0.
    screen-invisible = 1.
    modify screen.
    endif.
    * Radiobutton rb_role
    if rb_role eq 'X' and ( screen-name = 'P_ROLE' or screen-name = '%_P_ROLE_%_APP_%-TEXT' ).
    screen-active = 1.
    screen-invisible = 0.
    modify screen.
    * Radiobutton rb_role
    elseif rb_role ne 'X' and ( screen-name = 'P_ROLE' or screen-name = '%_P_ROLE_%_APP_%-TEXT' ).
    screen-active = 0.
    screen-invisible = 1.
    modify screen.
    endif.
    * Radiobutton rb_user
    if rb_user eq 'X' and ( screen-name = 'P_USER' or screen-name = '%_P_USER_%_APP_%-TEXT' ).
    screen-active = 1.
    screen-invisible = 0.
    modify screen.
    * Radiobutton rb_user
    elseif rb_user ne 'X' and ( screen-name = 'P_USER' or screen-name = '%_P_USER_%_APP_%-TEXT' ).
    screen-active = 0.
    screen-invisible = 1.
    modify screen.
    endif.
    endif.
    endloop.

    start-of-selection.

    if rb_tcode = 'X'.
    perform read_roles.
    *Lesen aller Rollen, welche den abgefragten TCode beinhalten.
    elseif rb_role = 'X'.
    perform read_tcode.
    *Lesen aller Tcodes, welche in der abgefragten Rolle enthalten sind.
    elseif rb_user = 'X'.
    perform read_user.
    *Lesen aller Rollen, welche dem abgefragten User zugeordnet sind.
    endif.


    *&---------------------------------------------------------------------*
    *& Form read_roles
    *&---------------------------------------------------------------------*
    * Lesen aller Rollen, welche den abgefragten TCode beinhalten
    *----------------------------------------------------------------------*
    form read_roles.

    data: wa_activity_groups type agr_tcodes,
    lt_activity_groups type table of agr_tcodes.

    call function 'PRGN_READ_ACTIVITY_GR_TCODE'
    exporting
    tcode = p_tcode
    tables
    activity_groups = lt_activity_groups
    exceptions
    no_activity_groups_available = 1
    others = 2.

    loop at lt_activity_groups into wa_activity_groups.
    if wa_activity_groups-agr_name cs 'Z:'.
    if lv_counter1 is initial.
    write: / 'Rollenname', 32 'Rollenbezeichnung', 113 'Rolleneigentümer'.
    lv_counter1 = 'X'.
    endif.
    wa_roles-agr_name = wa_activity_groups-agr_name.
    select single role_owner from /realtime/apmc23 into wa_roles-role_owner where agr_name = wa_roles-agr_name.

    select single text from agr_texts into wa_roles-text where agr_name = wa_roles-agr_name and spras = 'D'.
    append wa_roles to lt_roles.
    *WRITE: / wa_roles-agr_name, wa_roles-text, wa_roles-role_owner.
    endif.
    endloop.
    endform. "read_roles


    *&---------------------------------------------------------------------*
    *& Module PROCESS_BEFORE_OUTPUT OUTPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    module process_before_output output.

    * optional für die Bereitstellung des Feldkatalogs
    data: lt_fieldcat type lvc_t_fcat,
    wa_fieldcat type line of lvc_t_fcat.

    if g_custom_container is initial.
    create object g_custom_container
    exporting
    container_name = g_container.
    create object grid1
    exporting
    i_parent = g_custom_container.
    perform fieldcat.

    call method grid1->set_table_for_first_display
    exporting
    i_structure_name = 'ZSD_ROLES'
    i_save = 'A'
    * is_variant = lv_variant
    changing
    it_outtab = lt_roles.
    *optionaler Aufbau des Feldkatalogs der Tabelle, wenn keine Struktur vorhanden.
    * it_fieldcatalog = lt_fieldcat.

    endif.


    endmodule. " PROCESS_BEFORE_OUTPUT OUTPUT
    *&---------------------------------------------------------------------*
    *& Form FIELDCAT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    form fieldcat .
    wa_fieldcat-fieldname = 'AGR_NAME'.
    wa_fieldcat-ref_table = 'ZSD_ROLES'.
    wa_fieldcat-just = 'L'.
    append wa_fieldcat to lt_fieldcat.

    wa_fieldcat-fieldname = 'TEXT'.
    wa_fieldcat-ref_table = 'ZSD_ROLES'.
    wa_fieldcat-just = 'L'.
    append wa_fieldcat to lt_fieldcat.

    wa_fieldcat-fieldname = 'ROLE_OWNER'.
    wa_fieldcat-ref_table = 'ZSD_ROLES'.
    wa_fieldcat-just = 'C'.
    append wa_fieldcat to lt_fieldcat.
    endform. " FIELDCAT
    *&---------------------------------------------------------------------*
    *& Module PROCESS_AFTER_INPUT INPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    module process_after_input input.
    case ok_code.
    when 'EXIT'.
    leave program.
    when 'BACK'.
    leave to screen 0.
    when others.
    leave program.
    endcase.
    clear ok_code.
    endmodule. " PROCESS_AFTER_INPUT INPUT[/PHP]

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...