[ABAP] Mehrere interne Tabellen in eigenem Fullscreen-Fenster (cl_gui_dialogbox_container) anzeigen

CLASS lcl_show_window DEFINITION FINAL.

  PUBLIC SECTION.

    CLASS-METHODS show
      IMPORTING
        !i_title TYPE string
      CHANGING
        !c_itab  TYPE STANDARD TABLE .

    CLASS-METHODS show2
      IMPORTING
        !i_title1 TYPE string
        !i_title2 TYPE string
      CHANGING
        !c_itab1  TYPE STANDARD TABLE
        !c_itab2  TYPE STANDARD TABLE .

  PROTECTED SECTION.

  PRIVATE SECTION.

    CLASS-METHODS on_close
      FOR EVENT close OF cl_gui_dialogbox_container
      IMPORTING
        !sender .
ENDCLASS.

CLASS lcl_show_window IMPLEMENTATION.

  METHOD on_close.
    IF sender IS NOT INITIAL.
      sender->free( ).
    ENDIF.
  ENDMETHOD.

  METHOD show.

    TRY.
* Window-Style hier ohne cl_gui_control=>ws_thickframe vordefinieren, da sonst das Fenster nicht richtig maximized werden kann
        DATA(i_style) = cl_gui_control=>ws_minimizebox + cl_gui_control=>ws_maximizebox + cl_gui_control=>ws_sysmenu.

* Bildschirmauflösung ermitteln
        DATA(lv_metric_factors) = cl_gui_props_consumer=>create_consumer( )->get_metric_factors( ).

* https://download.consolut.com/direct/SAP_PrintDoku/de/BCCIDOCK/BCCIDOCK.PDF
* Top, Left, Width, Height in Pixel
        DATA(o_cnt) = NEW cl_gui_dialogbox_container( no_autodef_progid_dynnr = abap_true
                                                      caption                 = |{ i_title }|
                                                      top                     = 1
                                                      left                    = 1
                                                      width                   = lv_metric_factors-screen-x
                                                      height                  = lv_metric_factors-screen-y
                                                      style                   = i_style
                                                      metric                  = cl_gui_dialogbox_container=>metric_pixel ).

* Dialogbox-Container fullscreen (maximized) setzen
*        o_cnt->set_alignment( cl_gui_control=>align_at_left + cl_gui_control=>align_at_right + cl_gui_control=>align_at_top + cl_gui_control=>align_at_bottom ).

* OnClose-Handler für cl_gui_dialogbox_container
        SET HANDLER on_close FOR o_cnt.

* SALV-Grid
        DATA: o_salv TYPE REF TO cl_salv_table.

        cl_salv_table=>factory( EXPORTING r_container  = o_cnt
                                IMPORTING r_salv_table = o_salv
                                CHANGING  t_table      = c_itab ).

        o_salv->get_functions( )->set_all( abap_true ).
        o_salv->get_columns( )->set_optimize( abap_true ).
        o_salv->get_display_settings( )->set_list_header( |{ i_title }| ).
        o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
        o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

        o_salv->display( ).

      CATCH cx_root.
    ENDTRY.
  ENDMETHOD.

  METHOD show2.

    TRY.
* Window-Style hier ohne cl_gui_control=>ws_thickframe vordefinieren, da sonst das Fenster nicht richtig maximized werden kann
        DATA(i_style) = cl_gui_control=>ws_minimizebox + cl_gui_control=>ws_maximizebox + cl_gui_control=>ws_sysmenu.

* Bildschirmauflösung ermitteln
        DATA(lv_metric_factors) = cl_gui_props_consumer=>create_consumer( )->get_metric_factors( ).

* https://download.consolut.com/direct/SAP_PrintDoku/de/BCCIDOCK/BCCIDOCK.PDF
* Top, Left, Width, Height in Pixel
        DATA(o_cnt) = NEW cl_gui_dialogbox_container( no_autodef_progid_dynnr = abap_true
                                                      caption                 = |{ i_title1 }, { i_title2 }|
                                                      top                     = 1
                                                      left                    = 1
                                                      width                   = lv_metric_factors-screen-x
                                                      height                  = lv_metric_factors-screen-y
                                                      style                   = i_style
                                                      metric                  = cl_gui_dialogbox_container=>metric_pixel ).

* Dialogbox-Container fullscreen (maximized) setzen
*        o_cnt->set_alignment( cl_gui_control=>align_at_left + cl_gui_control=>align_at_right + cl_gui_control=>align_at_top + cl_gui_control=>align_at_bottom ).

* OnClose-Handler für cl_gui_dialogbox_container
        SET HANDLER on_close FOR o_cnt.

* Referenzen auf GUI-Objekte
* Splitter
        DATA: o_splitter TYPE REF TO cl_gui_splitter_container.

* horizontaler Splitter in cl_gui_dialogbox_container einbetten
        o_splitter = NEW #( parent                  = o_cnt
                            no_autodef_progid_dynnr = abap_true
                            rows                    = 2
                            columns                 = 1 ).

* Splittercontainer auf 50%
        o_splitter->set_row_height( id = 1 height = 50 ).

* Splittercontainer oben/unten holen
        DATA(o_cnt_s1) = o_splitter->get_container( row = 1 column = 1 ).
        DATA(o_cnt_s2) = o_splitter->get_container( row = 2 column = 1 ).

* SALV-Grid 1 in Splittercontainer oben
        DATA: o_salv1 TYPE REF TO cl_salv_table.

        cl_salv_table=>factory( EXPORTING r_container  = o_cnt_s1
                                IMPORTING r_salv_table = o_salv1
                                CHANGING  t_table      = c_itab1 ).

        o_salv1->get_functions( )->set_all( abap_true ).
        o_salv1->get_columns( )->set_optimize( abap_true ).
        o_salv1->get_display_settings( )->set_list_header( |{ i_title1 }| ).
        o_salv1->get_display_settings( )->set_striped_pattern( abap_true ).
        o_salv1->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

        o_salv1->display( ).

* SALV-Grid 2 in Splittercontainer unten
        DATA: o_salv2 TYPE REF TO cl_salv_table.

        cl_salv_table=>factory( EXPORTING r_container  = o_cnt_s2
                                IMPORTING r_salv_table = o_salv2
                                CHANGING  t_table      = c_itab2 ).

        o_salv2->get_functions( )->set_all( abap_true ).
        o_salv2->get_columns( )->set_optimize( abap_true ).
        o_salv2->get_display_settings( )->set_list_header( |{ i_title2 }| ).
        o_salv2->get_display_settings( )->set_striped_pattern( abap_true ).

        o_salv2->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

        o_salv2->display( ).
      CATCH cx_root.
    ENDTRY.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.

* Beispieldaten
  SELECT
    FROM mara
    FIELDS *
    INTO TABLE @DATA(it_mara)
    UP TO 100 ROWS.

  IF sy-subrc = 0.
    SELECT
      FROM marc
      FIELDS *
      INTO TABLE @DATA(it_marc)
      UP TO 100 ROWS.

    IF sy-subrc = 0.
* interne Tabelle im Window anzeigen
      lcl_show_window=>show( EXPORTING i_title = |MARA|
                             CHANGING  c_itab  = it_mara ).

* zwei interne Tabellen in einem Window mit Splitter anzeigen
      lcl_show_window=>show2( EXPORTING i_title1 = |MARA|
                                        i_title2 = |MARC|
                              CHANGING  c_itab1  = it_mara
                                        c_itab2  = it_marc ).
    ENDIF.
  ENDIF.

* cl_gui_container=>default_screen erzwingen
  WRITE: space.

[ABAP] SALV: Eventhandler für Auswahl einer Zeile (Row) bzw. Spalte (Col)

* Eventhandler
CLASS lcl_events DEFINITION.
  PUBLIC SECTION.

* Platzhalter für Referenz auf SALV-Grid
    CLASS-DATA: o_salv TYPE REF TO cl_salv_table.
* Platzhalter für Referenz auf interne Tabelle
    CLASS-DATA: it_t024 TYPE STANDARD TABLE OF t024 WITH DEFAULT KEY.

* Eventhandler-Methode für Change-Select, Verzögerung ~1.5s
    CLASS-METHODS: on_row_select FOR EVENT delayed_changed_sel_callback OF cl_gui_alv_grid
      IMPORTING sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Event behandelt die Auswahl Zeilen/Spalten im Gitter mit 1,5s Verzögerung
  METHOD on_row_select.
    TRY.
* referenz auf ALV-Grid holen
        DATA(o_alv) = CAST cl_gui_alv_grid( sender ).

* selektierte Zeilen, abh. vom if_salv_c_selection_mode
        o_alv->get_selected_rows( IMPORTING et_row_no     = DATA(it_sel_rows)
                                            et_index_rows = DATA(it_sel_rows_idx) ).

* selektierte Spalten, abh. vom if_salv_c_selection_mode
        o_alv->get_selected_columns( IMPORTING et_index_columns = DATA(it_sel_cols_idx) ).

        LOOP AT it_sel_cols_idx ASSIGNING FIELD-SYMBOL(<col>).
        ENDLOOP.

        LOOP AT it_sel_rows_idx ASSIGNING FIELD-SYMBOL(<row>).
        ENDLOOP.

      CATCH cx_root.
    ENDTRY.
  ENDMETHOD.
ENDCLASS.

CLASS lcl_salv_helper DEFINITION INHERITING FROM cl_salv_model_base FINAL.
  PUBLIC SECTION.

    CLASS-METHODS:
      get_alv_from_salv
        IMPORTING
          io_salv_grid   TYPE REF TO cl_salv_table
        RETURNING
          VALUE(ro_grid) TYPE REF TO cl_gui_alv_grid.
ENDCLASS.

CLASS lcl_salv_helper IMPLEMENTATION.
*---------------------------------------------------------------------*
* Wandelt eine Referenz auf cl_salv_table in ein cl_gui_alv_grid um.
*---------------------------------------------------------------------*
* -> io_model - Referenz auf cl_salv_table
* <- ro_grid  - Referenz auf cl_gui_alv_grid, bei Fehler INITIAL
*---------------------------------------------------------------------*
  METHOD get_alv_from_salv.

    IF io_salv_grid IS BOUND.
      TRY.
          DATA(o_model) = CAST cl_salv_model_base( io_salv_grid->extended_grid_api( ) ).

* Funktioniert nur, wenn SALV-Table schon mit display( ) angezeigt und
* somit schon ein Container dafür erzeugt wurde. Andernfalls ist r_adapter INITIAL.
          IF o_model->r_controller IS BOUND AND o_model->r_controller->r_adapter IS BOUND.

            IF o_model->r_controller->r_adapter IS INSTANCE OF if_salv_table_display_adapter.
              ro_grid = CAST if_salv_table_display_adapter( o_model->r_controller->r_adapter )->get_grid( ).
            ENDIF.

          ENDIF.
        CATCH cx_root.
      ENDTRY.
    ENDIF.

  ENDMETHOD.

ENDCLASS.

START-OF-SELECTION.

  TRY.
* Beispieldaten (Einkäufergruppen) holen
      SELECT FROM t024
        FIELDS *
        INTO TABLE @lcl_events=>it_t024
        UP TO 10 ROWS.

      IF sy-subrc = 0.
        cl_salv_table=>factory( EXPORTING r_container  = cl_gui_container=>default_screen
                                IMPORTING r_salv_table = lcl_events=>o_salv
                                CHANGING  t_table      = lcl_events=>it_t024 ).

* Standardbuttons der SALV-Table
        lcl_events=>o_salv->get_functions( )->set_all( abap_true ).

* if_salv_c_selection_mode=>single    : es kann eine Zeile im SALV/ALV selektiert werden
* if_salv_c_selection_mode=>row_column: es können mehrere Zeile und Spalten im SALV/ALV selektiert werden
* nach 1,5s wird dann der Event on_delayed_change_select ausgelöst
        lcl_events=>o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>single ).

* SALV anzeigen
        lcl_events=>o_salv->display( ).

* ALV-Objektreferenz aus dem SALV-Grid holen, funktioniert erst nach o_salv->display( )
        DATA(o_alv) = lcl_salv_helper=>get_alv_from_salv( lcl_events=>o_salv ).
        IF o_alv IS BOUND.
* Event-Handler des ALV
          SET HANDLER lcl_events=>on_row_select FOR o_alv.
* Event registrieren
          o_alv->register_delayed_event( i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select ).
        ENDIF.

* Toolbar der Listausgabe unterdrücken
        cl_abap_list_layout=>suppress_toolbar( ).

* Listausgabe erzwingen für Erzeugung von cl_gui_container=>default_screen
        WRITE: space.

      ENDIF.
    CATCH cx_root INTO DATA(e_txt).
      WRITE: / e_txt->get_text( ).
  ENDTRY.

[ABAP] Höhe einer Dynpro-Zeile bzw. Breite einer Dynpro-Spalte in Pixeln ausgeben

* Höhe einer Dynpro-Zeile in Pixeln
DATA(lv_height_px) = cl_gui_cfw=>compute_metric_from_dynp( EXPORTING metric = cl_gui_control=>metric_pixel
                                                                     x_or_y = 'Y'
                                                                     in     = 1 ).

WRITE: / lv_height_px.

* Breite einer Dynpro-Spalte in Pixeln
DATA(lv_width_px) = cl_gui_cfw=>compute_metric_from_dynp( EXPORTING metric = cl_gui_control=>metric_pixel
                                                                    x_or_y = 'X'
                                                                    in     = 1 ).

WRITE: / lv_width_px.

[ABAP] Statusinformationen des ICMAN lesen

DATA: lv_info_data TYPE icm_info.
DATA: it_servlist TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.
DATA: it_thrlist TYPE STANDARD TABLE OF icm_thrlst WITH DEFAULT KEY.
DATA: it_servlist3 TYPE STANDARD TABLE OF icm_sinfo3 WITH DEFAULT KEY.

* Statistikdaten des ICM lesen
CALL FUNCTION 'ICM_GET_INFO2'
  IMPORTING
    info_data          = lv_info_data
  TABLES
    servlist           = it_servlist
    thrlist            = it_thrlist
    servlist3          = it_servlist3
  EXCEPTIONS
    icm_error          = 1
    icm_timeout        = 2
    icm_not_authorized = 3
    OTHERS             = 4.

IF sy-subrc = 0.
* Hier Objekte für die Ausgabe hinzufügen
  cl_demo_output=>write_data( lv_info_data ).
  cl_demo_output=>write_data( it_servlist ).
  cl_demo_output=>write_data( it_thrlist ).
  cl_demo_output=>write_data( it_servlist3 ).

* HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING title       = 'Daten'
                                        html_string = lv_html
                                        container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
  WRITE: space.
ENDIF.

[ABAP] SAP-ShortCode-Datei (*.sap) erzeugen

Variante 1 (SWN_CREATE_SHORTCUT -> *.sap-Datei speichern)

* SAP ShortCode-Dateien sind mit der installierten SAPGUI verknüpft und werden von dieser beim Doppelklick auf den Dateinamen geöffnet und ausgeführt
* SAP ShortCode-Dateien können auch im SAPGUI über den Button "Erstellt eine Verknüpfung" erzeugt werden
* SAP Hinweis: 103019 - SAPshortcut: Programmparameter
* http://troublefreeabap.blogspot.com/2013/06/creating-sapgui-shortcuts.html
PARAMETERS: p_matnr TYPE mara-matnr.

START-OF-SELECTION.

* Kommando (i_system_command):
* - fasst i_transaction und i_parameter zusammen
* - Transaktion MM03 in neuem Fenster anzeigen
*   - '/o' --> neuen Modus öffnen
*   - '*' --> überspringt Selektionsbild
* - Übergabe: MATNR an Dynpro-Feld für die MATNR im Selektionsbild (RMMG1-MATNR)
* - entfernen führenden Nullen (ALPHA = OUT)
  DATA(lv_cmd) = |/o*MM03 RMMG1-MATNR={ p_matnr ALPHA = OUT }|.
* Texttabelle mit generierten Daten für die Shortcut-Datei (*.sap)
  DATA(it_sap_shortcut_data) = VALUE soli_tab( ).

* WF Notif: SAP Shortcut als Anlage erzeugen
  CALL FUNCTION 'SWN_CREATE_SHORTCUT'
    EXPORTING
      i_system_command        = CONV char40( lv_cmd )
*      i_transaction           = '*MM03'
*      i_parameter             = CONV text255( |RMMG1-MATNR={ p_matnr ALPHA = OUT }| )
      i_user                  = ''
      i_windowsize            = 'Maximized' " oder 'Normal window'
      i_title                 = CONV char80( |MM03 - Material anzeigen| )
    IMPORTING
      shortcut_table          = it_sap_shortcut_data
    EXCEPTIONS
      inconsistent_parameters = 1
      OTHERS                  = 2.

  IF sy-subrc = 0.
* *.sap ShortCut-Datei speichern
    TRY.
        DATA: lv_action TYPE i.
        DATA: lv_filename TYPE string.
        DATA: lv_fullpath TYPE string.
        DATA: lv_path TYPE string.

* Save-Dialog
        cl_gui_frontend_services=>file_save_dialog( EXPORTING default_file_name = 'Start_MM03.sap'
                                                              default_extension = 'sap'
                                                              file_filter       = |ShortCut-Datei (*.sap)\|*.sap\|{ cl_gui_frontend_services=>filetype_all }|
                                                    CHANGING  filename          = lv_filename
                                                              path              = lv_path
                                                              fullpath          = lv_fullpath
                                                              user_action       = lv_action ).

        IF lv_action EQ cl_gui_frontend_services=>action_ok.
* Datei lokal speichern
          cl_gui_frontend_services=>gui_download( EXPORTING filename     = lv_fullpath
                                                            filetype     = 'DAT'
                                                  CHANGING  data_tab     = it_sap_shortcut_data ).

        ENDIF.
      CATCH cx_root INTO DATA(e_text).
        MESSAGE e_text->get_text( ) TYPE 'I'.
    ENDTRY.
  ENDIF.

Variante 2 (SICF-Service /sap/public/bc/workflow/shortcut)

PARAMETERS: p_matnr TYPE mara-matnr.

START-OF-SELECTION.

  DATA: it_servlist TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.

* Statistikdaten des ICM lesen
  CALL FUNCTION 'ICM_GET_INFO2'
    TABLES
      servlist           = it_servlist
    EXCEPTIONS
      icm_error          = 1
      icm_timeout        = 2
      icm_not_authorized = 3
      OTHERS             = 4.

  IF sy-subrc = 0.
* protocol 1: HTTP
* protocol 2: HTTPS
    IF line_exists( it_servlist[ protocol = 2 ] ).
* URL für workflow-shortcut zusammenbauen
* SICF-Service muss aktiv sein: /sap/public/bc/workflow/shortcut
* Daten werden in der Klasse CL_SWN_HTTP_SHORTCUT prozessiert
      DATA(lv_server) = it_servlist[ protocol = 2 ].
      DATA(lv_html) = |https://{ lv_server-hostname }:{ lv_server-service }|.
      lv_html = lv_html && |/sap/public/bc/workflow/shortcut?|.
      lv_html = lv_html && |sysid={ sy-sysid }&client={ sy-mandt }|.
      lv_html = lv_html && |&logonid=&uname={ sy-uname }|.
      lv_html = lv_html && |&langu=DE|.
      lv_html = lv_html && |&transaction=*MM03|.
      lv_html = lv_html && |&param=RMMG1-MATNR%3d{ p_matnr ALPHA = OUT }|.

      WRITE: / lv_html.
    ENDIF.
  ENDIF.

[ABAP] ITS: Aufruf einer Transaktion über HTTPS in der WebGui

PARAMETERS: p_matnr TYPE mara-matnr.

START-OF-SELECTION.

  DATA: it_servlist TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.

* Statistikdaten des ICM lesen
  CALL FUNCTION 'ICM_GET_INFO2'
    TABLES
      servlist           = it_servlist
    EXCEPTIONS
      icm_error          = 1
      icm_timeout        = 2
      icm_not_authorized = 3
      OTHERS             = 4.

  IF sy-subrc = 0.
* protocol 1: HTTP
* protocol 2: HTTPS
    IF line_exists( it_servlist[ protocol = 2 ] ).
* URL für Transaktions-Anzeige in der ITS-WebGui zusammenbauen
* SICF-Service muss aktiv sein: /sap/bc/gui/sap/its/webgui
* Daten werden in der Klasse CL_HTTP_EXT_ITS prozessiert
      DATA(lv_server) = it_servlist[ protocol = 2 ].
      DATA(lv_html) = |https://{ lv_server-hostname }:{ lv_server-service }|.
      lv_html = lv_html && |/sap/bc/gui/sap/its/webgui?|.
      lv_html = lv_html && |~transaction=*MM03%20RMMG1-MATNR={ p_matnr ALPHA = OUT WIDTH = 10 }|. " MM03 + MATNR --> Selektionbild überspringen
      lv_html = lv_html && |&sap-client={ sy-mandt }|.
      lv_html = lv_html && |&sap-language=DE|.

* Browserfenster mit default_screen als Container
      DATA(o_hv) = NEW cl_gui_html_viewer( parent = cl_gui_container=>default_screen ).
* SSO
*      o_hv->enable_sapsso( enabled = abap_true ).
* ITS: WebGui inline (im SAPGUI) anzeigen
      o_hv->show_url( url      = CONV swk_url( lv_html )
                      in_place = abap_true ).

* Führt alle gesammelten OLE-Calls aus
      cl_gui_cfw=>flush( ).

* Toolbar ausblenden
      cl_abap_list_layout=>suppress_toolbar( ).

* erzwingt Anzeige über cl_gui_container=>default_screen
      WRITE: / space.
    ENDIF.
  ENDIF.

Links

[ABAP] Daten einer Internetseite als interne Tabelle bereitstellen

PARAMETERS: p_url TYPE w3url DEFAULT 'https://google.de'.

DATA: lv_size          TYPE  i.
DATA: lv_errorstate    TYPE  i.
DATA: lv_ret_type      TYPE  c.
DATA: lv_ret_subtype   TYPE  c.
DATA: lv_date          TYPE  sy-datum.
DATA: lv_time          TYPE  sy-uzeit.
DATA: it_response TYPE STANDARD TABLE OF docs WITH DEFAULT KEY.

* Stellt die Daten eines URLs in eine interne Tabelle
CALL FUNCTION 'DP_GET_STREAM_FROM_URL'
  EXPORTING
    url               = p_url
  IMPORTING
    size              = lv_size
    errorstate        = lv_errorstate
    ret_type          = lv_ret_type
    ret_subtype       = lv_ret_subtype
    date              = lv_date
    time              = lv_time
  TABLES
    data              = it_response
  EXCEPTIONS
    dp_fail           = 1
    dp_failed_init    = 2
    blocked_by_policy = 3
    unknown_error     = 4
    OTHERS            = 5.

IF sy-subrc = 0.
* Hier Objekte für die Ausgabe hinzufügen
  cl_demo_output=>write_data( lv_size ).
  cl_demo_output=>write_data( lv_errorstate ).
  cl_demo_output=>write_data( lv_ret_type ).
  cl_demo_output=>write_data( lv_ret_subtype ).
  cl_demo_output=>write_data( lv_date ).
  cl_demo_output=>write_data( lv_time ).
  cl_demo_output=>write_data( it_response ).

*   HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

*   Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING
                                title        = 'Daten'
                                html_string  = lv_html
                                container    = cl_gui_container=>default_screen ).

*   cl_gui_container=>default_screen erzwingen
  WRITE: space.
ENDIF.

[ABAP] UTC-Zeitstempel nach POSIX-Standard

* UTC-Zeitstempel nach POSIX-Standard
DATA(lv_utc_long) = utclong_current( ).

WRITE: / lv_utc_long.

* addiert die übergebenen Werte zu UTC-Zeitstempel
DATA(lv_utc_long_add) = utclong_add( val     = lv_utc_long
                                     days    = 1000
                                     hours   = 100
                                     minutes = 10 ).

WRITE: / lv_utc_long_add.

* berechnet die Zeitdifferenz zwischen zwei UTC-Zeitstempeln
DATA(lv_utc_long_diff) = utclong_diff( high = lv_utc_long_add
                                       low  = lv_utc_long ).
WRITE: / lv_utc_long_diff.

* Zeitdauer zwischen zwei Zeitstempelwerten bestimmen
cl_abap_utclong=>diff( EXPORTING high    = lv_utc_long_add
                                 low     = lv_utc_long
                       IMPORTING days    = DATA(lv_days)
                                 hours   = DATA(lv_hours)
                                 minutes = DATA(lv_minutes)
                                 seconds = DATA(lv_seconds) ).

WRITE: / lv_days.
WRITE: / lv_hours.
WRITE: / lv_minutes.
WRITE: / lv_seconds.

[ABAP] Übernahme von Dokumenteninfosätzen beim Anlegen von Einkaufsbelegen unterdrücken

Das Beispiel zeigt, wie die Übernahme der Dokumenteninfosätze beim Anlegen einer neuen Bestellung aus einem Kontrakt unterdrückt werden kann.

* Programm: SAPLMEPO
* INCLUDE: LMEPOF7X
* FORM mepo_documents_copy (handles PO, contract and RFQ only; no requisitions)
* Implizites Enhancement
ENHANCEMENT 1  Z_YOUR_ENH_NAME.

* wenn Bestell-Belegart = 'NB' und Quelle ein Kontrakt
IF im_nekko-bsart EQ 'NB' AND NOT im_nekko-konnr IS INITIAL.
* Abbruch der Übernahme der DI in die neue Bestellung
  EXIT.
ENDIF.

ENDENHANCEMENT.