Vorlage Upload CSV-Datei mit Job-Steps und Suche nach Stichwort in Programmen

Aus SAP-Wiki
Zur Navigation springenZur Suche springen

Siehe Reporting.

Siehe Report-Vorlage mit Form-Routinen.

Siehe Report-Vorlage mit Lokaler Klasse.

Siehe ALV-Vorlage CL GUI ALV GRID.

Siehe ALV-Vorlage REUSE ALV GRID DISPLAY LVC.

Siehe ALV-Vorlage CL SALV* (Factory).

Siehe Vorlage Upload/Download Datei Frontend.

Siehe Vorlage Upload CSV-Datei mit Job-Steps und Suche nach Stichwort in Programmen.

Siehe Kategorie: ABAP-Vorlagen.

************************************************************************
* Programmname...............:  ZLESHP_JOBANALYSE                      *
* Entwickler.................:  René Eberstein                         *
* CR.........................:  Programmanalysen fixe                  *
*                               Nummernkreise Ausgangslieferungen      *
* Ansprechpartner Berater....:                                         *
* Erstellt am................:  18.10.2023                             *
* Online/Batch/USER-EXIT ....:  Online                                 *
* Tabellen                   :  TBTCP (Steps von einem Job)            *
* Funktionsbeschreibung .....:                                         *
* Es wird eine CSV-Datei hochgeladen mit letzten 3 Monaten Jobs auf    *
* Z-Programme aus dem Produktivsystem (Tabelle TBTCP) und diese nach   *
* einem String (hier "S_VEELN") durchsucht.                             *
*----------------------------------------------------------------------*
*& Ä N D E R U N G E N:                                                *
*& <nr>, <sy-uname>, <sy-datum>, <ticket>, <beschreibung>              *
*&---------------------------------------------------------------------*
REPORT zleshp_jobanalyse_vbeln.

****************
* DATA & TYPES *
****************
TYPES: BEGIN OF ty_itab,
         jobname   TYPE tbtcp-jobname,   "Jobname
         jobcount  TYPE tbtcp-jobcount,  "Jobcounter
         stepcount TYPE tbtcp-stepcount, "Counter
         progname  TYPE tbtcp-progname,  "Programmname
         sdldate   TYPE tbtcp-sdldate,   "Datum
         sdltime   TYPE tbtcp-sdltime,   "Uhrzeit
         sdluname  TYPE tbtcp-sdluname,  "Einplaner
         variant   TYPE tbtcp-variant,   "Variante
         vbeln_x   TYPE xfeld,           "'S_VBELN' vorhanden in Report
         devclass  TYPE tadir-devclass,  "Paket
       END OF ty_itab.

Tables: tbtcp.

TYPES: tty_itab TYPE STANDARD TABLE OF ty_itab.

TYPES: BEGIN OF ty_file,
         data(900),
       END OF ty_file.
TYPES: tty_file TYPE STANDARD TABLE OF ty_file.

TYPES: BEGIN OF ty_upload,
         jobname    TYPE char100,
         jobcount   TYPE char100,
         stepcount  TYPE char100,
         progname   TYPE char100,
         progfromln TYPE char100,
         progtoln   TYPE char100,
         sdldate    TYPE char100,
         sdltime    TYPE char100,
         sdluname   TYPE char100,
         variant    TYPE char100,
         authcknam  TYPE char100,
         listident  TYPE char100,
         xpgpid     TYPE char100,
         xpgtgtsys  TYPE char100,
         xpgrfcdest TYPE char100,
         xpgprog    TYPE char100,
         xpgparams  TYPE char100,
         xpgflag    TYPE char100,
         conncntl   TYPE char100,
         stdincntl  TYPE char100,
         stdoutcntl TYPE char100,
         stderrcntl TYPE char100,
         tracecntl  TYPE char100,
         termcntl   TYPE char100,
         status     TYPE char100,
         exitcode   TYPE char100,
         language   TYPE char100,
         extcmd     TYPE char100,
         opsystem   TYPE char100,
         pdest      TYPE char100,
         prcop      TYPE char100,
         plist      TYPE char100,
         prtxt      TYPE char100,
         primm      TYPE char100,
         prrel      TYPE char100,
         prnew      TYPE char100,
         pexpi      TYPE char100,
         linct      TYPE char100,
         linsz      TYPE char100,
         paart      TYPE char100,
         prbig      TYPE char100,
         prsap      TYPE char100,
         prrec      TYPE char100,
         prabt      TYPE char100,
         rest       TYPE char255,
       END OF ty_upload.

TYPES: tty_upload TYPE STANDARD TABLE OF ty_upload.
DATA: gt_file    TYPE STANDARD TABLE OF ty_file,
      gt_upload  TYPE tty_upload,
      gt_itab    TYPE tty_itab,
      gt_outfile TYPE tty_file.

DATA: gv_down_file TYPE rlgrap-filename.

**********************
* PARAMETER - SCREEN *
**********************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. "Selektion

PARAMETERS: p_file  TYPE rlgrap-filename.
Parameters: p_split TYPE char1           DEFAULT ',',
            p_head  AS CHECKBOX DEFAULT abap_true,
            p_verd  AS CHECKBOX DEFAULT abap_true,
            p_suche TYPE char50 default 'S_VBELN'.
Select-Options s_prog  for tbtcp-progname.
SELECTION-SCREEN END OF BLOCK b1.

****************************************
* AT SELECTION-SCREEN ON VALUE-REQUEST *
****************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
* Open-File-Dialog zur Auswahl Inputdatei
  PERFORM get_filename.

***********************
* AT SELECTION-SCREEN *
***********************
AT SELECTION-SCREEN.

**********************
* START-OF-SELECTION *
**********************
START-OF-SELECTION.

* Datei hochladen in Flatfile von Frontend
  PERFORM upload_file
    USING p_file
    CHANGING gt_file.

* Flatfile in strukturierte interne Tabelle GT_UPLOAD konvertieren
  PERFORM read_flatfile_into_upload
    USING    gt_file
    CHANGING gt_upload.

* Fülle Itab
  PERFORM fill_itab
    USING    gt_upload
    CHANGING gt_itab.

  IF p_suche is not initial.
    PERFORM check_suchstring
      CHANGING gt_itab.
  ENDIF.

  PERFORM get_paket
    CHANGING gt_itab.

  PERFORM alv_itab
    USING gt_itab.

**&---------------------------------------------------------------------
**& Form alv_itab
*&---------------------------------------------------------------------
* ALV Function Mod. 'REUSE_ALV_GRID_DISPLAY_LVC'
*----------------------------------------------------------------------
FORM alv_itab
     USING it_itab TYPE tty_itab.

  TYPE-POOLS: slis.

  DATA: lv_repid   TYPE sy-repid,
        lt_fcat    TYPE lvc_t_fcat,
        ls_layout  TYPE lvc_s_layo,
*       ls_sort    type LVC_S_SORT,
*       lt_sort    type LVC_T_SORT,
        lt_events  TYPE slis_t_event,
        ls_variant TYPE disvariant.

  lv_repid = sy-repid.

****************
* Fill Variant *
****************
*  ls_variant = value #( report   = lv_repid
*                        username = sy-uname
*                        variant  = p_vari ).


***************
* Fill Layout *
***************
  PERFORM alv_itab_layout
    CHANGING ls_layout.


*************
* Fill Sort *
*************
*lt_sort = value #( base lt_sort
*                    ( fieldname = ' '          "Identische Werte, die übereinander stehen, werden
*                     spos      = '1'          "verbunden und nur der oberste Wert wird angezeigt
*                     up        = 'X'
*                     group     = 'UL'
*                     subtot    = 'X' ) ).     "Zwischensummen

***************
* Fill Events *
***************
  PERFORM alv_itab_events            "Definition Events und Form-Routinten für
    CHANGING lt_events.              "User-Command, Top-Of-List und Status

*****************
* Fill Fieldcat *
*****************
  PERFORM alv_itab_fcat              "Definition Felder, die ausgegeben werden sollen
    CHANGING lt_fcat.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_interface_check  = 'I'
      i_callback_program = lv_repid
      is_layout_lvc      = ls_layout    "Layout ALV
      it_fieldcat_lvc    = lt_fcat      "Tabellen mit Feldern der Liste
      "it_sort_lvc       = lt_sort      "Sortierung
      i_default          = 'X'          "Default Variante kann abgespeichert werden
      i_save             = 'A'          "Benutzerabhängige Varianten können gespeichert werden
      is_variant         = ls_variant   "Layoutvariante ziehen
      it_events          = lt_events    "Event-Tabelle
    TABLES
      t_outtab           = it_itab    "Daten Ausgabetabelle
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.

  IF sy-subrc <> 0.
    MESSAGE i531(0u) WITH 'Problem beim Fuba REUSE_ALV_GRID_DISPLAY_LVC'.
  ENDIF.

ENDFORM. " alv_itab

*&---------------------------------------------------------------------*
*& Form ALV_ITAB_LAYOUT
*&---------------------------------------------------------------------*
*& ALV Layout füllen
*&---------------------------------------------------------------------*
FORM alv_itab_layout
  CHANGING cs_layout TYPE lvc_s_layo.

* cs_layout-zebra      = 'X'.        "Liste wird im Zebra-Look ausgegeben
* cs_layout-box_fname  = 'SELKZ'.    "Zeilen der Liste können markiert werden mit Spalte SELKZ
* cs_layout-no_rowmark = abap_true.
* cs_layout-no_toolbar = 'X'.        "Keine Toolbar
* cs_layout-excp_fname = 'AMPEL'.    "'1'=rot, '2'=gelb, '3'=grün
* cs_layout-excp_led   = 'X'.        " 'X'=LED, sonst Ampel
* cs_layout-totals_bef = 'X'.        "Summen vor Einzelsätzen
  cs_layout-cwidth_opt = 'A'.        "Spaltenbreite wird optimiert
  cs_layout-ctab_fname = 'CELLCOL'.  "Tabellenfeld mit Zellfarben
ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  pf_status_set
*&---------------------------------------------------------------------*
*       Kopie des Standardstatus STANDARD aus der Funktionsgruppe SALV
*----------------------------------------------------------------------*
FORM alv_itab_pf_status_set
    USING it_extab TYPE slis_t_extab.                       "#EC CALLED

  SET PF-STATUS 'STATUS' EXCLUDING it_extab.
  "set TITLEBAR 'TITLE'.

ENDFORM.                    "pf_status_set

*&---------------------------------------------------------------------*
*&      Form  alv_itab_events
*&---------------------------------------------------------------------*
*       ALV-Events
*----------------------------------------------------------------------*
FORM alv_itab_events
   CHANGING pct_events TYPE slis_t_event.

  pct_events = VALUE #( ( name = 'USER_COMMAND'
                          form = 'ALV_ITAB_USER_COMMAND' )

                        ( name = 'TOP_OF_PAGE'
                          form = 'ALV_ITAB_TOP_OF_PAGE' )

                        ( name = 'PF_STATUS_SET'
                          form = 'ALV_ITAB_PF_STATUS_SET' )
                      ).

ENDFORM.                    " alv_itab_events

*&---------------------------------------------------------------------*
*&      Form  alv_itab_fcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM alv_itab_fcat  "LVC_S_FCAT
  CHANGING ct_fcat TYPE lvc_t_fcat.

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'VBELN_X'
                                    key         = abap_true
                                  ) ).

* Field = Entwicklungsklasse
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'DEVCLASS'
                                    ref_field   = 'DEVCLASS'
                                    ref_table   = 'TADIR'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'JOBNAME'
                                    ref_field   = 'JOBNAME'
                                    ref_table   = 'TBTCP'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'JOBCOUNT'
                                    ref_field   = 'JOBCOUNT'
                                    ref_table   = 'TBTCP'
                                  ) ).
* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'STEPCOUNT'
                                    ref_field   = 'STEPCOUNT'
                                    ref_table   = 'TBTCP'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'PROGNAME'
                                    ref_field   = 'PROGNAME'
                                    ref_table   = 'TBTCP'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'SDLDATE'
                                    ref_field   = 'SDLDATE'
                                    ref_table   = 'TBTCP'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'SDLTIME'
                                    ref_field   = 'SDLTIME'
                                    ref_table   = 'TBTCP'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'SDLUNAME'
                                    ref_field   = 'SDLUNAME'
                                    ref_table   = 'TBTCP'
                                  ) ).

* Field =
  ct_fcat = VALUE #( BASE ct_fcat ( fieldname   = 'VARIANT'
                                    ref_field   = 'VARIANT'
                                    ref_table   = 'TBTCP'
                                  ) ).




** Field =
* ct_fcat = value #( base ct_fcat ( fieldname   = ' '
*                                   ref_field   = ' '
*                                   ref_table   = ' '
*                                 ) ).
*
* fieldname   = ' '         "Fieldname Itab ALV, obligatory field
* ref_field   = ' '         "Referencefield
* ref_table   = ' '         "Referecetable
* rollname    = ' '         "Dataelement (alternativ to referencefield and referencetable)
* cfieldname  = ' '         "Reference currency fields
* qfieldname  = ' '         "Referenz quantity fields
* SCRTEXT_L   = ' '
* SCRTEXT_M   = ' '
* SCRTEXT_S   = ' '         "max 10 letters
* REPTEXT     = ' '
* SELTEXT     = ' '
* tooltip     = ' '         "Tooltip
* convexit    = 'ALPHA'     "Konvertierungsexit ALPHA (Columnvalues without leading 0)
* outputlen   = 10          "Outputlength
* emphasize   = 'C300'      "Color column Beige
* edit        = abap_true   "Field with input
* f4availabl  = abap_true   "F4-Valuehelp will be forced
* do_sum      = abap_true   "Sum values on field
* icon        = abap_true   "Display value as Icon
* checkbox    = abap_true   "Display field as checkbox (space/X intern)
* key         = abap_true   "Display field as key (blue color and stable colum while scrolling left/right)
* no_zero     = abap_true   "No display 0-values


ENDFORM.                    " alv_fcat

*&---------------------------------------------------------------------
*& Form USER_COMMAND
*&---------------------------------------------------------------------
*  User Command
*----------------------------------------------------------------------
FORM alv_itab_user_command                                  "#EC CALLED
  USING r_ucomm     TYPE sy-ucomm
        rs_selfield TYPE slis_selfield.

  DATA: ls_itab TYPE ty_itab.

  DATA: lo_ref_alv       TYPE REF TO cl_gui_alv_grid,
        lt_index_columns TYPE lvc_t_col,
        lv_valid         TYPE c.                            "#EC NEEDED

* geänderte Daten holen
* Referenz auf ALV holen
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = lo_ref_alv.

* Gibt die geänderte ITAB zurück
* Wenn die Feldprüfung für geänderte Daten nicht erfolgreich, dann ist lv_valid = space
  CALL METHOD lo_ref_alv->check_changed_data
    IMPORTING
      e_valid = lv_valid.

* Liest die selektierten Spalten
  CALL METHOD lo_ref_alv->get_selected_columns
    IMPORTING
      et_index_columns = lt_index_columns.

* Prüfe ob ein Doppelklick auf eine Zeile erfolgte
  CASE r_ucomm.

    WHEN '&IC1'.

*   Read line of clicked item
      READ TABLE gt_itab INDEX rs_selfield-tabindex
      INTO ls_itab.

*    case rs_selfield-fieldname.

*
*      when ' '.

*  endcase.
  ENDCASE.

ENDFORM. " USER_COMMAND_ITAB

*---------------------------------------------------------------------
*      FORM top_of_page
*---------------------------------------------------------------------
*      Fülle Header für ALV-Listen
*----------------------------------------------------------------------
FORM alv_itab_top_of_page.                                  "#EC CALLED

  DATA: lt_listheader TYPE slis_t_listheader,
        lv_datum(10)  TYPE c.

* Schreibe Anzahl Datensätze Reporte in Grid Titel
  DATA(lv_lines) = lines( gt_itab ).

* Datum in Ausgabeform bringen
  WRITE sy-datum TO lv_datum.

  lt_listheader = VALUE #( ( typ = 'S'
                             key = 'Datum'
                             info = lv_datum )

                           ( typ = 'S'
                             key = 'Anzahl Datensätze'
                             info = lv_lines )
                         ).

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = lt_listheader.
*          I_LOGO             =
*          I_END_OF_LIST_GRID =

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  GET_FILENAME
*&---------------------------------------------------------------------*
*       Popupdialog für Uploadpfad in Parameter laden
*----------------------------------------------------------------------*
FORM get_filename.

  DATA: lt_file_table TYPE filetable,
        ls_file       TYPE file_table,
        lv_rc         TYPE i.

  ls_file-filename = p_file.
  APPEND ls_file TO lt_file_table.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
*    EXPORTING
*      WINDOW_TITLE            =
*      DEFAULT_EXTENSION       =
*      DEFAULT_FILENAME        =
*      FILE_FILTER             =
*      WITH_ENCODING           =
*      INITIAL_DIRECTORY       =
*      MULTISELECTION          =
    CHANGING
      file_table              = lt_file_table
      rc                      = lv_rc
*     USER_ACTION             =
*     FILE_ENCODING           =
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid   "Nachrichtenklasse
          TYPE sy-msgty   "Typ (E = Error, S = Success, I = Info, A = Abbruch)
        NUMBER sy-msgno   "Nachrichtennummer
          WITH sy-msgv1   "Platzhaltervariable1
               sy-msgv2   "Platzhaltervariable2
               sy-msgv3   "Platzhaltervariable3
               sy-msgv4.  "Platzhaltervariable4
    MESSAGE i800(29) WITH p_file.  "Die sequentielle Datei & konnte nicht geöffnet werden
    MESSAGE i821(29).               "Verarbeitung wurde abgebrochen
    LEAVE PROGRAM.
  ENDIF.

  READ TABLE lt_file_table INTO ls_file INDEX 1.

  IF sy-subrc = 0.
    p_file = ls_file-filename.
  ENDIF.

ENDFORM.                    " GET_FILENAME

*&---------------------------------------------------------------------*
*&      Form  UPLOAD_FILE
*&---------------------------------------------------------------------*
*       Upload Datei
*----------------------------------------------------------------------*
FORM upload_file
   USING iv_file   TYPE rlgrap-filename
   CHANGING ct_file TYPE tty_file.

  DATA: lv_filename TYPE string.

  CONSTANTS: lc_11 TYPE i VALUE 11,
             lc_12 TYPE i VALUE 12,
             lc_13 TYPE i VALUE 13,
             lc_14 TYPE i VALUE 14,
             lc_15 TYPE i VALUE 15,
             lc_16 TYPE i VALUE 16,
             lc_17 TYPE i VALUE 17,
             lc_18 TYPE i VALUE 18,
             lc_19 TYPE i VALUE 19.


  lv_filename = iv_file.

  CALL METHOD cl_gui_frontend_services=>gui_upload
    EXPORTING
      filename                = lv_filename
*     FILETYPE                = 'ASC'
*     HAS_FIELD_SEPARATOR     = SPACE
*     HEADER_LENGTH           = 0
*     READ_BY_LINE            = 'X'
*     DAT_MODE                = SPACE
*     CODEPAGE                = '1100'   "SAP(ISO)-Codepage 1100 Bezug auf ISO-Codepage 8859-1 (umfasst meiste westeuropäischen Zeichen)
*     IGNORE_CERR             = ABAP_TRUE
*     REPLACEMENT             = '#'
*     VIRUS_SCAN_PROFILE      =
*    IMPORTING
*     FILELENGTH              =
*     HEADER                  =
    CHANGING
      data_tab                = ct_file
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = lc_11
      unknown_dp_error        = lc_12
      access_denied           = lc_13
      dp_out_of_memory        = lc_14
      disk_full               = lc_15
      dp_timeout              = lc_16
      not_supported_by_gui    = lc_17
      error_no_gui            = lc_18
      OTHERS                  = lc_19.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    " UPLOAD_FILE

*&---------------------------------------------------------------------*
*&      Form  READ_FLATFILE_INTO_UPLOAD
*&---------------------------------------------------------------------*
*       Flatfile in strukturierte ITAB konvertieren
*----------------------------------------------------------------------*
FORM read_flatfile_into_upload
 USING    it_file   TYPE tty_file
 CHANGING ct_upload TYPE tty_upload.

  DATA: ls_file   TYPE ty_file,
        ls_upload TYPE ty_upload.

  LOOP AT it_file INTO ls_file.

    CLEAR ls_upload.

    SPLIT ls_file-data
          AT p_split
          INTO ls_upload-jobname
               ls_upload-jobcount
               ls_upload-stepcount
               ls_upload-progname
               ls_upload-progfromln
               ls_upload-progtoln
               ls_upload-sdldate
               ls_upload-sdltime
               ls_upload-sdluname
               ls_upload-variant
               ls_upload-authcknam
               ls_upload-listident
               ls_upload-xpgpid
               ls_upload-xpgtgtsys
               ls_upload-xpgrfcdest
               ls_upload-xpgprog
               ls_upload-xpgparams
               ls_upload-xpgflag
               ls_upload-conncntl
               ls_upload-stdincntl
               ls_upload-stdoutcntl
               ls_upload-stderrcntl
               ls_upload-tracecntl
               ls_upload-termcntl
               ls_upload-status
               ls_upload-exitcode
               ls_upload-language
               ls_upload-extcmd
               ls_upload-opsystem
               ls_upload-pdest
               ls_upload-prcop
               ls_upload-plist
               ls_upload-prtxt
               ls_upload-primm
               ls_upload-prrel
               ls_upload-prnew
               ls_upload-pexpi
               ls_upload-linct
               ls_upload-linsz
               ls_upload-paart
               ls_upload-prbig
               ls_upload-prsap
               ls_upload-prrec
               ls_upload-prabt
               ls_upload-rest.

    check ls_upload-progname in s_prog.

    APPEND ls_upload TO ct_upload.

  ENDLOOP.

ENDFORM.                    " READ_FLATFILE_INTO_UPLOAD
*&---------------------------------------------------------------------*
*&      Form  FILL_ITAB
*&---------------------------------------------------------------------*
*       Füllen Interne Tabelle
*----------------------------------------------------------------------*
FORM fill_itab
   USING    it_upload  TYPE tty_upload
   CHANGING ct_itab    TYPE tty_itab.

  DATA: ls_file TYPE ty_file,
        ls_itab TYPE ty_itab.

*********************
* Füllen Positionen *
*********************
  LOOP AT it_upload ASSIGNING FIELD-SYMBOL(<fs_upload>).

*   Überschriftenzeile übergehen
    IF p_head = abap_true AND sy-tabix = 1 and s_prog is initial.
      CONTINUE.
    ENDIF.

*   Umformatieren Zeit, wenn führende Null fehlt
    if strlen( <fs_upload>-sdltime ) = 7.
      <fs_upload>-sdltime = '0' && <fs_upload>-sdltime.
    endif.

*   Felder CT_ITAB füllen
    ls_itab = VALUE #( jobname   = <fs_upload>-jobname
                       jobcount  = <fs_upload>-jobcount
                       stepcount = <fs_upload>-stepcount
                       progname  = <fs_upload>-progname
                       sdldate   = |{ <fs_upload>-sdldate+6(4) }{ <fs_upload>-sdldate+3(2) }{ <fs_upload>-sdldate(2) }|
                       sdltime   = |{ <fs_upload>-sdltime+(2) }{ <fs_upload>-sdltime+3(2) }{ <fs_upload>-sdltime+6(2) }|
                       sdluname  = <fs_upload>-sdluname
                       variant   = <fs_upload>-variant
                     ).

    APPEND ls_itab TO ct_itab.

  ENDLOOP.

ENDFORM.                    " FILL_OUTPUT

*&---------------------------------------------------------------------*
*&      Form  CHECK_SUCHSTRING
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM check_suchstring
  CHANGING ct_itab TYPE tty_itab.

  TYPES: BEGIN OF ty_hash,
           progname TYPE tbtcp-progname,
           vbeln_x  TYPE xfeld,
         END OF ty_hash.

  DATA: lt_hash TYPE HASHED TABLE OF ty_hash WITH UNIQUE KEY progname,
        ls_hash TYPE ty_hash.

  TYPES: BEGIN OF ty_file,
           data TYPE c LENGTH 900,
         END OF ty_file.

  DATA:  lt_file TYPE STANDARD TABLE OF ty_file.

  LOOP AT ct_itab ASSIGNING FIELD-SYMBOL(<fs_itab>).
*   Prüfe erst mal von der Hash-Tabelle
    READ TABLE lt_hash INTO ls_hash WITH KEY progname = <fs_itab>-progname.

    IF sy-subrc = 0.
      CASE ls_hash-vbeln_x.
        WHEN abap_true.
          <fs_itab>-vbeln_x = abap_true.
          CONTINUE.
        WHEN abap_false.
          <fs_itab>-vbeln_x = abap_false.
          CONTINUE.
      ENDCASE.
    ENDIF.

*   Wenn nicht Hash-Tabelle, dann prüfe in Programmcode, ob 'S_VBELN' vorhanden ist
    READ REPORT <fs_itab>-progname INTO lt_file.

    LOOP AT lt_file ASSIGNING FIELD-SYMBOL(<fs_file>).
      TRANSLATE <fs_file>-data TO UPPER CASE.

      SEARCH <fs_file>-data FOR p_suche.

      IF sy-subrc = 0.
        <fs_itab>-vbeln_x = abap_true.
        EXIT.
      ENDIF.
    ENDLOOP.

    ls_hash = VALUE #( progname = <fs_itab>-progname
                       vbeln_x  = <fs_itab>-vbeln_x ).
    INSERT ls_hash INTO TABLE lt_hash.


  ENDLOOP.

* Lösche alle Programme, wo nicht S_VBELN auftaucht
  DELETE ct_itab WHERE vbeln_x = abap_false.

  IF p_verd = abap_true.
    SORT ct_itab BY progname sdldate DESCENDING.
    DELETE ADJACENT DUPLICATES FROM ct_itab COMPARING progname.
  ENDIF.

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  GET_PAKET
*&---------------------------------------------------------------------*
*       Lese Paket zum Entwicklungsobjekt
*----------------------------------------------------------------------*
FORM get_paket
  CHANGING ct_itab TYPE tty_itab.

  LOOP AT ct_itab ASSIGNING FIELD-SYMBOL(<fs_itab>).
    SELECT SINGLE
      devclass
      INTO <fs_itab>-devclass
      FROM tadir
      WHERE pgmid    = 'R3TR'
        AND object   = 'PROG'
        AND obj_name = <fs_itab>-progname.
  ENDLOOP.

ENDFORM.