Skip to Content

Hi,

Recently there were some questions about transport information functions.

The program attached Y_R_EITAN_TEST_26_02 is my attempt of using some of the transport functions .

Functions:

TR_READ_GLOBAL_INFO_OF_REQUEST
TR_LOG_OVERVIEW_REQUEST
STRF_OPEN_PROT
TRINT_READ_LOG
TRINT_DISPLAY_LOG
TRINT_READ_REQUEST_HEADER

The program goes through table E070 based on user selection .

For each E070 row the program call function TR_READ_GLOBAL_INFO_OF_REQUEST , The output from the function is used to create the final output table.

The final output table is presented using cl_salv_table .

Transport Logs and Action log is availble by hotspot .

Screens:

/wp-content/uploads/2014/08/screenshot_01_528584.png

/wp-content/uploads/2014/08/screenshot_02_528586.png

Enjoy.

Update 2014/09/15

After using the program for some time I added a small “feature”

Adding two parameters:

/wp-content/uploads/2014/08/screenshot_01_528584.png

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Marko Okram

    Dear Eitan,

     

    Could you please Re-Attach the programm.

    I could not find the download link.

     

    Thank you very much.

     

    Best Regards

    Marko

    (0) 
  2. Eitan Rosenberg Post author

    REPORT y_r_eitan_test_26_02 .

    TYPE-POOLS: abap,cntb,icon,sscr .
    TYPE-POOLS: ctslg,strhi .

    TABLES: e070,e07t , /acnmx/detail .

    *———————————————————————-*
    SELECTION-SCREEN BEGIN OF BLOCK block02 WITH FRAME .

    SELECT-OPTIONS: s_trkorr FOR e070-trkorr .
    SELECT-OPTIONS: s_as4use FOR e070-as4user .
    SELECT-OPTIONS: s_as4dat FOR e070-as4date .
    SELECT-OPTIONS: s_trfunc FOR e070-trfunction .
    SELECT-OPTIONS: s_trstat FOR e070-trstatus .

    SELECTION-SCREEN SKIP .

    PARAMETER: p_text TYPE soli-line .

    SELECTION-SCREEN SKIP .

    SELECT-OPTIONS: s_trgt_i FOR e070-tarsystem MATCHCODE OBJECT tce_systems .
    SELECT-OPTIONS: s_trgt_e FOR e070-tarsystem MATCHCODE OBJECT tce_systems .

    SELECTION-SCREEN SKIP .

    SELECT-OPTIONS: s_impsts FOR /acnmx/detail-actionpend .

    SELECTION-SCREEN SKIP .

    SELECT-OPTIONS: s_trgt_s FOR e070-tarsystem MATCHCODE OBJECT tce_systems .

    SELECTION-SCREEN END OF BLOCK block02.
    *———————————————————————-*
    SELECTION-SCREEN BEGIN OF BLOCK block12 WITH FRAME .
    PARAMETERS: p_tmr_on TYPE timer_on AS CHECKBOX ,
    p_tmr_in TYPE timer_i DEFAULT 15 OBLIGATORY .
    SELECTION-SCREEN END OF BLOCK block12.
    *———————————————————————-*
    SELECTION-SCREEN BEGIN OF BLOCK block_44 WITH FRAME .
    PARAMETERS: p_vari_1 TYPE disvariant-variant .
    SELECTION-SCREEN END OF BLOCK block_44 .
    *———————————————————————-*
    *———————————————————————-*
    TYPES: BEGIN OF tp_e070_1 .
    TYPES: trkorr TYPE e070-trkorr .
    TYPES: END OF tp_e070_1 .

    TYPES: tp_e070_1_tab TYPE TABLE OF tp_e070_1 .
    *———————————————————————-*
    TYPES: BEGIN OF tp_head_1 .

    TYPES: trkorr TYPE trheader-trkorr ,
    as4user TYPE trheader-as4user .

    TYPES: icon1 TYPE icon-id ,
    icon2 TYPE icon-id .

    TYPES: as4text TYPE trheader-as4text ,
    trfunction TYPE trheader-trfunction ,
    trstatus TYPE trheader-trstatus ,
    tarsystem TYPE trheader-tarsystem ,
    strkorr TYPE trheader-strkorr ,
    as4date TYPE trheader-as4date ,
    as4time TYPE trheader-as4time .

    TYPES: END OF tp_head_1 .
    *———————————————————————-*
    TYPES: BEGIN OF tp_logs_1 .
    TYPES: systemid TYPE tstrfcofil-tarsystem,
    * clientid TYPE tstrfcofil-tarclient,
    stepid TYPE tstrfcofil-function,
    date TYPE tstrfcofil-trdate,
    time TYPE tstrfcofil-trtime,
    rc TYPE tstrfcofil-retcode.
    TYPES: END OF tp_logs_1 .
    *———————————————————————-*
    TYPES: BEGIN OF tp_acnm_1 .
    * iWave Transport Management – Transport Details
    INCLUDE TYPE /acnmx/detail .
    TYPES: END OF tp_acnm_1 .
    *———————————————————————-*
    TYPES: BEGIN OF tp_buff_x .

    INCLUDE TYPE tp_head_1 AS head RENAMING WITH SUFFIX _head .

    INCLUDE TYPE tp_acnm_1 AS acnm RENAMING WITH SUFFIX _acnm .

    INCLUDE TYPE tp_logs_1 AS logs RENAMING WITH SUFFIX _logs .

    TYPES: END OF tp_buff_x .

    TYPES: tp_buff_x_tab TYPE TABLE OF tp_buff_x .

    *———————————————————————-*
    TYPES: BEGIN OF tp_alv_data_1 .

    TYPES: index TYPE lvc_index,
    ex_flag TYPE ampel_alv,
    it_scol TYPE lvc_t_scol,
    it_styl TYPE lvc_t_styl,
    ex_info TYPE lvc_emphsz.

    TYPES: li_cntr TYPE syst-srows .

    INCLUDE TYPE tp_buff_x AS buff_1 .

    TYPES: END OF tp_alv_data_1 .

    TYPES: tp_alv_data_1_tab TYPE TABLE OF tp_alv_data_1 .

    *———————————————————————-*

    DATA: ok_code TYPE syucomm . ” Function Code

    CONSTANTS: gc_ctab_fname TYPE lvc_ctfnm VALUE ‘IT_SCOL’, ” ALV control: Field name with complex cell color coding
    gc_styl_fname TYPE lvc_ctfnm VALUE ‘IT_STYL’, ” ALV control: Field name with complex cell color coding
    gc_excp_fname TYPE lvc_exfnm VALUE ‘EX_FLAG’, ” ALV control: Field name with exception coding
    gc_info_fname TYPE lvc_cifnm VALUE ‘EX_INFO’, ” ALV control: Field name with simple row color coding
    gc_cntr_fname TYPE lvc_fname VALUE ‘LI_CNTR’ .

    CLASS: cl_event_receiver DEFINITION DEFERRED.

    CONSTANTS: gc_log_group_1 TYPE disvariant-log_group VALUE ‘ALV1’ . ” Logical group name

    DATA: gs_disvariant_1 TYPE disvariant . ” Layout (External Use)

    DATA: ob_event_receiver_1 TYPE REF TO cl_event_receiver . ” Event_receiver class

    DATA: ob_gui_alv_grid_1 TYPE REF TO cl_gui_alv_grid . ” ALV List Viewer

    DATA: ob_gui_timer TYPE REF TO cl_gui_timer .
    *———————————————————————-*
    DATA: BEGIN OF gs_globals .
    DATA: it_alv_data_1 TYPE tp_alv_data_1_tab .

    DATA: it_dd07_1 TYPE t_isu_dom_tab .
    DATA: it_dd07_2 TYPE t_isu_dom_tab .

    DATA: END OF gs_globals .
    *———————————————————————-*
    *———————————————————————-*
    CLASS cl_gui_alv_grid_tools DEFINITION .

    PUBLIC SECTION.

    CLASS-METHODS get_variant_default
    IMPORTING
    !i_report TYPE disvariant-report DEFAULT sy-cprog
    !i_log_group TYPE disvariant-log_group
    CHANGING
    !disvariant TYPE disvariant OPTIONAL
    !variant TYPE disvariant-variant OPTIONAL .

    CLASS-METHODS get_variant_existence
    IMPORTING
    !i_report TYPE disvariant-report DEFAULT sy-cprog
    value(i_log_group) TYPE disvariant-log_group
    value(i_variant) TYPE disvariant-variant
    CHANGING
    disvariant TYPE disvariant OPTIONAL .

    CLASS-METHODS get_variant_select
    IMPORTING
    !i_report TYPE disvariant-report DEFAULT sy-cprog
    value(i_log_group) TYPE disvariant-log_group
    CHANGING
    !disvariant TYPE disvariant OPTIONAL
    !variant TYPE disvariant-variant OPTIONAL .

    METHODS add_field
    IMPORTING
    fieldname TYPE lvc_s_fcat-fieldname
    ref_field TYPE lvc_s_fcat-ref_field OPTIONAL
    ref_table TYPE lvc_s_fcat-ref_table OPTIONAL
    rollname TYPE lvc_s_fcat-rollname OPTIONAL
    coltext TYPE lvc_s_fcat-coltext OPTIONAL
    key TYPE lvc_s_fcat-key OPTIONAL
    just TYPE lvc_s_fcat-just OPTIONAL
    no_out TYPE lvc_s_fcat-no_out OPTIONAL
    no_zero TYPE lvc_s_fcat-no_zero OPTIONAL
    do_sum TYPE lvc_s_fcat-do_sum OPTIONAL
    tech TYPE lvc_s_fcat-tech OPTIONAL
    hotspot TYPE lvc_s_fcat-hotspot OPTIONAL
    icon TYPE lvc_s_fcat-icon OPTIONAL
    checkbox TYPE lvc_s_fcat-checkbox OPTIONAL
    edit TYPE lvc_s_fcat-edit OPTIONAL
    outputlen TYPE lvc_s_fcat-outputlen OPTIONAL
    qfieldname TYPE lvc_s_fcat-qfieldname OPTIONAL
    cfieldname TYPE lvc_s_fcat-cfieldname OPTIONAL
    emphasize TYPE lvc_s_fcat-emphasize OPTIONAL .

    METHODS get_fieldcatalog
    IMPORTING complete TYPE abap_bool OPTIONAL
    RETURNING value(it_fieldcatalog) TYPE lvc_t_fcat .

    PRIVATE SECTION.

    DATA: it_fieldcatalog TYPE lvc_t_fcat .

    ENDCLASS . “cl_gui_alv_grid_tools DEFINITION
    *———————————————————————-*
    CLASS cl_gui_alv_grid_tools IMPLEMENTATION.
    *———————————————————————-*
    METHOD get_variant_default.

    DATA: st_disvariant_l TYPE disvariant. ” Layout (External Use)

    st_disvariant_l-report = i_report .
    st_disvariant_l-log_group = i_log_group .

    disvariant = st_disvariant_l .

    CALL FUNCTION ‘REUSE_ALV_VARIANT_DEFAULT_GET’
    EXPORTING
    i_save = ‘A’
    CHANGING
    cs_variant = st_disvariant_l
    EXCEPTIONS
    not_found = 2.

    CHECK sy-subrc EQ 0 .

    disvariant = st_disvariant_l .
    variant = st_disvariant_l-variant .

    ENDMETHOD. “get_variant_default
    *———————————————————————-*
    METHOD get_variant_existence.

    CHECK i_variant IS NOT INITIAL .

    DATA: st_disvariant TYPE disvariant.

    st_disvariant-report = i_report .
    st_disvariant-log_group = i_log_group .
    st_disvariant-variant = i_variant .

    CALL FUNCTION ‘REUSE_ALV_VARIANT_EXISTENCE’
    EXPORTING
    i_save = ‘A’
    CHANGING
    cs_variant = st_disvariant
    EXCEPTIONS
    wrong_input = 1
    not_found = 2
    program_error = 3
    OTHERS = 4.

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

    disvariant = st_disvariant .

    ENDMETHOD . “get_variant_existence
    *———————————————————————-*
    METHOD get_variant_select.

    DATA: st_disvariant TYPE disvariant.

    st_disvariant-report = i_report .
    st_disvariant-log_group = i_log_group .

    DATA: e_exit TYPE c LENGTH 1 .

    CALL FUNCTION ‘REUSE_ALV_VARIANT_F4’
    EXPORTING
    is_variant = st_disvariant
    i_save = ‘A’
    IMPORTING
    e_exit = e_exit
    es_variant = st_disvariant
    EXCEPTIONS
    not_found = 1
    program_error = 2
    OTHERS = 3.

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

    IF e_exit IS INITIAL.
    disvariant = st_disvariant .
    variant = st_disvariant-variant .
    ENDIF.

    ENDMETHOD. “get_variant_select
    *———————————————————————-*
    METHOD: add_field .

    DATA: st_fieldcatalog LIKE LINE OF it_fieldcatalog .

    st_fieldcatalog-fieldname = fieldname .
    st_fieldcatalog-ref_table = ref_table .
    st_fieldcatalog-ref_field = ref_field .
    st_fieldcatalog-rollname = rollname .
    st_fieldcatalog-coltext = coltext .

    st_fieldcatalog-key = key .
    st_fieldcatalog-just = just .
    st_fieldcatalog-no_out = no_out .
    st_fieldcatalog-no_zero = no_zero .
    st_fieldcatalog-do_sum = do_sum .
    st_fieldcatalog-tech = tech .
    st_fieldcatalog-hotspot = hotspot .
    st_fieldcatalog-icon = icon .
    st_fieldcatalog-checkbox = checkbox .
    st_fieldcatalog-edit = edit .
    st_fieldcatalog-outputlen = outputlen .
    st_fieldcatalog-qfieldname = qfieldname .
    st_fieldcatalog-cfieldname = cfieldname .
    st_fieldcatalog-emphasize = emphasize .

    TRANSLATE st_fieldcatalog-fieldname TO UPPER CASE.
    TRANSLATE st_fieldcatalog-ref_field TO UPPER CASE.
    TRANSLATE st_fieldcatalog-ref_table TO UPPER CASE.
    TRANSLATE st_fieldcatalog-rollname TO UPPER CASE.
    TRANSLATE st_fieldcatalog-qfieldname TO UPPER CASE.
    TRANSLATE st_fieldcatalog-cfieldname TO UPPER CASE.

    APPEND st_fieldcatalog TO it_fieldcatalog.

    ENDMETHOD . “add_field
    *———————————————————————-*
    METHOD: get_fieldcatalog .

    it_fieldcatalog = me->it_fieldcatalog .

    CHECK complete EQ abap_true .

    ** Add details to field catalogue
    CALL FUNCTION ‘LVC_FIELDCAT_COMPLETE’
    CHANGING
    ct_fieldcat = it_fieldcatalog.

    ENDMETHOD . “get_fieldcatalog
    *———————————————————————-*
    ENDCLASS . “cl_gui_alv_grid_tools IMPLEMENTATION
    *———————————————————————-*
    *———————————————————————-*
    CLASS cl_event_receiver DEFINITION .

    PUBLIC SECTION .

    METHODS: toolbar
    FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING e_object e_interactive .

    METHODS: user_command
    FOR EVENT user_command OF cl_gui_alv_grid
    IMPORTING e_ucomm .

    METHODS: hotspot_click
    FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no .

    METHODS: finished
    FOR EVENT finished OF cl_gui_timer .

    METHODS: user_command_1_refresh .

    CONSTANTS: c_refresh TYPE syucomm VALUE ‘REFRESH’ .

    DATA: e_ucomm TYPE syucomm .

    PRIVATE SECTION .

    ENDCLASS . “cl_event_receiver DEFINITION
    *———————————————————————-*
    *———————————————————————-*
    CLASS cl_event_receiver IMPLEMENTATION.
    *———————————————————————-*
    *———————————————————————-*
    METHOD toolbar.

    FIELD-SYMBOLS: <st_button> LIKE LINE OF e_object->mt_toolbar .

    * Append a separator
    APPEND INITIAL LINE TO e_object->mt_toolbar ASSIGNING <st_button> .
    <st_button>-butn_type = cntb_btype_sep .

    APPEND INITIAL LINE TO e_object->mt_toolbar ASSIGNING <st_button> .
    <st_button>-icon = icon_refresh .
    <st_button>-function = c_refresh .
    <st_button>-quickinfo = c_refresh .

    ENDMETHOD . “toolbar
    *———————————————————————-*
    METHOD user_command .

    me->e_ucomm = e_ucomm .

    CASE e_ucomm.
    WHEN c_refresh .
    me->user_command_1_refresh( ) .
    ENDCASE .

    ENDMETHOD . “handle_user_command
    *———————————————————————-*
    METHOD hotspot_click .

    CHECK es_row_no-row_id GT 0 .

    FIELD-SYMBOLS: <st_alv_data_1> LIKE LINE OF gs_globals-it_alv_data_1 .

    READ TABLE gs_globals-it_alv_data_1 INDEX es_row_no-row_id ASSIGNING <st_alv_data_1> .

    CASE e_column_id-fieldname .

    WHEN ‘TRKORR_HEAD’ .

    SET PARAMETER ID ‘KOR’ FIELD <st_alv_data_1>-buff_1-head-trkorr. ” KOR is Parameter ID for Transport Requst number
    CALL TRANSACTION ‘SE01’.

    WHEN ‘ICON1_HEAD’ .

    DATA: st_strhi TYPE strhi_popup .

    st_strhi-start_row = 1 .
    st_strhi-end_column = 150 .
    st_strhi-end_row = 30 .

    CALL FUNCTION ‘TR_LOG_OVERVIEW_REQUEST’
    EXPORTING
    iv_trkorr = <st_alv_data_1>-buff_1-head-trkorr
    iv_detailed_chronology = abap_true
    is_popup = st_strhi
    EXCEPTIONS
    e_wrong_call = 1
    OTHERS = 2.

    IF sy-subrc NE 0.
    ENDIF.

    WHEN ‘ICON2_HEAD’ .

    DATA: sysname TYPE tcesyst-sysname .

    DATA: cant_open TYPE char_lg_01 ,
    filepath TYPE tstrf01-file ,
    filename TYPE tstrf01-filename .

    sysname = sy-sysid .

    CALL FUNCTION ‘STRF_OPEN_PROT’
    EXPORTING
    access = ‘R’
    acttype = ‘Z’
    dirtype = ‘T’
    sysname = sysname
    trkorr = <st_alv_data_1>-buff_1-head-trkorr
    IMPORTING
    cant_open = cant_open
    file = filepath
    filename = filename
    EXCEPTIONS
    wrong_call = 1
    OTHERS = 2.

    CHECK sy-subrc EQ 0 .

    CHECK cant_open EQ abap_false .

    DATA: et_lines TYPE TABLE OF trlog .

    CALL FUNCTION ‘TRINT_READ_LOG’
    EXPORTING
    iv_logname_file = filepath
    TABLES
    et_lines = et_lines
    EXCEPTIONS
    invalid_input = 1
    file_access_error = 2
    db_access_error = 3
    OTHERS = 4.

    CALL FUNCTION ‘TRINT_DISPLAY_LOG’
    EXPORTING
    iv_heading1 = filepath
    TABLES
    ct_lines = et_lines.

     

    ENDCASE .

    ENDMETHOD . “hotspot_click
    *———————————————————————-*
    METHOD finished .

    CHECK p_tmr_on EQ abap_true .

    ob_gui_timer->cancel( ) .
    ob_gui_timer->interval = p_tmr_in .
    ob_gui_timer->run( ).

    * This will eventually will call “refresh_alv1”
    CALL METHOD ob_gui_alv_grid_1->raise_event
    EXPORTING
    i_ucomm = c_refresh.

    ENDMETHOD. “finished
    *———————————————————————-*
    METHOD user_command_1_refresh .

    CALL FUNCTION ‘SAPGUI_PROGRESS_INDICATOR’
    EXPORTING
    percentage = 100
    EXCEPTIONS
    OTHERS = 0.

    DATA: subrc_1 TYPE sysubrc .

    PERFORM get_data_1
    CHANGING
    gs_globals-it_alv_data_1 .

    * Status Puffer zur├╝cksetzen
    CALL FUNCTION ‘STATUS_BUFFER_REFRESH’.

    DATA: message_text TYPE c LENGTH 200 .

    WRITE sy-uzeit TO message_text LEFT-JUSTIFIED NO-GAP .

    CONCATENATE ‘Last refresh occur at:’ message_text
    INTO message_text SEPARATED BY space .

    MESSAGE s001(00) WITH message_text+0(50) message_text+49(50) .

    LEAVE TO SCREEN 100 .

    ENDMETHOD. “refresh_alv1
    *———————————————————————-*
    ENDCLASS . “cl_event_receiver IMPLEMENTATION
    *———————————————————————-*

    INITIALIZATION.
    PERFORM at_initialization .

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari_1 .
    cl_gui_alv_grid_tools=>get_variant_select( EXPORTING i_log_group = gc_log_group_1 CHANGING disvariant = gs_disvariant_1 variant = p_vari_1 ) .

    AT SELECTION-SCREEN .
    PERFORM at_selection_screen_input .

    START-OF-SELECTION .
    PERFORM at_start_of_selection .

    END-OF-SELECTION .
    PERFORM at_end_of_selection .

    *———————————————————————-*
    *———————————————————————-*
    FORM at_initialization .

    s_as4use-sign = ‘I’.
    s_as4use-option = ‘EQ’.
    s_as4use-low = sy-uname .
    APPEND s_as4use .

    s_trfunc-sign = ‘I’.
    s_trfunc-option = ‘EQ’ .

    s_trfunc-low = ‘K’ . APPEND s_trfunc .
    s_trfunc-low = ‘W’ . APPEND s_trfunc .
    s_trfunc-low = ‘T’ . APPEND s_trfunc .

    s_as4dat-sign = ‘I’ .
    s_as4dat-option = ‘BT’ .
    s_as4dat-high = sy-datum .

    CALL FUNCTION ‘MONTH_PLUS_DETERMINE’
    EXPORTING
    months = -2
    olddate = s_as4dat-high
    IMPORTING
    newdate = s_as4dat-low.

    APPEND s_as4dat .

    DATA: it_seltexts TYPE TABLE OF rsseltexts .
    FIELD-SYMBOLS: <st_seltexts> LIKE LINE OF it_seltexts .

    APPEND INITIAL LINE TO it_seltexts ASSIGNING <st_seltexts> .
    <st_seltexts>-name = ‘S_TRGT_I’ .
    <st_seltexts>-kind = ‘S’ .
    <st_seltexts>-text = ‘Must be in system'(011) .

    APPEND INITIAL LINE TO it_seltexts ASSIGNING <st_seltexts> .
    <st_seltexts>-name = ‘S_TRGT_E’ .
    <st_seltexts>-kind = ‘S’ .
    <st_seltexts>-text = ‘Must NOT be in system'(012) .

    APPEND INITIAL LINE TO it_seltexts ASSIGNING <st_seltexts> .
    <st_seltexts>-name = ‘S_TRGT_S’ .
    <st_seltexts>-kind = ‘S’ .
    <st_seltexts>-text = ‘Show only'(013) .

    APPEND INITIAL LINE TO it_seltexts ASSIGNING <st_seltexts> .
    <st_seltexts>-name = ‘P_TEXT’ .
    <st_seltexts>-kind = ‘P’ .
    <st_seltexts>-text = ‘Description (REGEX no * !!)'(014) .

    APPEND INITIAL LINE TO it_seltexts ASSIGNING <st_seltexts> .
    <st_seltexts>-name = ‘S_IMPSTS’ .
    <st_seltexts>-kind = ‘S’ .
    <st_seltexts>-text = ‘Import status'(015) .

    * ‘Import status’

    CALL FUNCTION ‘SELECTION_TEXTS_MODIFY’
    EXPORTING
    program = sy-cprog
    TABLES
    seltexts = it_seltexts
    EXCEPTIONS
    program_not_found = 1
    program_cannot_be_generated = 2
    OTHERS = 3.

    DATA: st_restriction TYPE sscr_restrict .

    FIELD-SYMBOLS: <st_opt> LIKE LINE OF st_restriction-opt_list_tab .
    FIELD-SYMBOLS: <st_ass> LIKE LINE OF st_restriction-ass_tab.

    CONSTANTS: c_rule_1 LIKE <st_opt>-name VALUE ‘RULE_1’ .
    CONSTANTS: c_rule_3 LIKE <st_opt>-name VALUE ‘RULE_3’ .

    APPEND INITIAL LINE TO st_restriction-opt_list_tab ASSIGNING <st_opt> .
    <st_opt>-name = c_rule_1 .
    <st_opt>-options-eq = abap_true .

    APPEND INITIAL LINE TO st_restriction-opt_list_tab ASSIGNING <st_opt> .
    <st_opt>-name = c_rule_3 .
    <st_opt>-options-eq = abap_true .
    <st_opt>-options-ne = abap_true .

    APPEND INITIAL LINE TO st_restriction-ass_tab ASSIGNING <st_ass> .
    <st_ass>-kind = ‘S’ .
    <st_ass>-name = ‘S_TRGT_I’ .
    <st_ass>-sg_main = ‘I’ .
    <st_ass>-sg_addy = abap_false .
    <st_ass>-op_main = c_rule_1 .

    APPEND INITIAL LINE TO st_restriction-ass_tab ASSIGNING <st_ass> .
    <st_ass>-kind = ‘S’ .
    <st_ass>-name = ‘S_TRGT_E’ .
    <st_ass>-sg_main = ‘I’ .
    <st_ass>-sg_addy = abap_false .
    <st_ass>-op_main = c_rule_1 .

    APPEND INITIAL LINE TO st_restriction-ass_tab ASSIGNING <st_ass> .
    <st_ass>-kind = ‘S’ .
    <st_ass>-name = ‘S_IMPSTS’ .
    <st_ass>-sg_main = ‘I’ .
    <st_ass>-sg_addy = abap_false .
    <st_ass>-op_main = c_rule_3 .

    CALL FUNCTION ‘SELECT_OPTIONS_RESTRICT’
    EXPORTING
    restriction = st_restriction
    EXCEPTIONS
    too_late = 1
    repeated = 2
    selopt_without_options = 3
    selopt_without_signs = 4
    invalid_sign = 5
    empty_option_list = 6
    invalid_kind = 7
    repeated_kind_a = 8
    OTHERS = 9.

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

    cl_gui_alv_grid_tools=>get_variant_default( EXPORTING i_log_group = gc_log_group_1 CHANGING disvariant = gs_disvariant_1 variant = p_vari_1 ) .

    ENDFORM . “at_initialization
    *———————————————————————-*
    FORM at_selection_screen_input .

    cl_gui_alv_grid_tools=>get_variant_existence( EXPORTING i_log_group = gc_log_group_1 i_variant = p_vari_1 CHANGING disvariant = gs_disvariant_1 ) .

    ENDFORM . “at_selection_screen_input
    *———————————————————————-*
    FORM at_start_of_selection .

    PERFORM get_data_1
    CHANGING
    gs_globals-it_alv_data_1 .

    ENDFORM . “at_start_of_selection
    *———————————————————————-*
    FORM at_end_of_selection .

    DATA: dbcnt TYPE sydbcnt .

    dbcnt = LINES( gs_globals-it_alv_data_1 ) .

    IF dbcnt IS INITIAL .
    MESSAGE s668(vl) DISPLAY LIKE ‘E’.
    RETURN .
    ENDIF.

    CALL SCREEN 100 .

    ENDFORM . “at_end_of_selection
    *———————————————————————-*
    FORM get_data_1
    CHANGING
    it_alv_data_1 TYPE tp_alv_data_1_tab .

    CLEAR it_alv_data_1[] .

    DATA: it_e070_1 TYPE tp_e070_1_tab .

    DATA: r_as4use TYPE RANGE OF e070-as4user ,
    r_as4dat TYPE RANGE OF e070-as4date ,
    r_trfunc TYPE RANGE OF e070-trfunction ,
    r_trstat TYPE RANGE OF e070-trstatus .

    IF s_trkorr[] IS NOT INITIAL .
    MESSAGE s000(oo) WITH ‘Selection is based only on transport numbers.’ .
    ELSE .
    r_as4use[] = s_as4use[] .
    r_as4dat[] = s_as4dat[] .
    r_trfunc[] = s_trfunc[] .
    r_trstat[] = s_trstat[] .
    ENDIF .

    SELECT trkorr INTO TABLE it_e070_1
    FROM e070
    WHERE
    trkorr IN s_trkorr AND
    as4user IN r_as4use AND
    as4date IN r_as4dat AND
    trfunction IN r_trfunc AND
    trstatus IN r_trstat .

    CHECK sy-subrc EQ 0 .

    DATA: it_buff_1 TYPE tp_buff_x_tab .

    DATA: st_request TYPE trwbo_request_header .

    DATA: ob_abap_regex TYPE REF TO cl_abap_regex .
    DATA: ob_abap_matcher TYPE REF TO cl_abap_matcher .
    DATA: use_regex TYPE abap_bool .
    DATA: ob_root TYPE REF TO cx_root .
    DATA: text TYPE string .
    DATA: it_match TYPE match_result_tab .

    IF p_text IS NOT INITIAL .

    TRY.

    DATA: pattern TYPE string .

    pattern = p_text . CONDENSE pattern .

    CREATE OBJECT ob_abap_regex
    EXPORTING
    pattern = p_text
    ignore_case = abap_true.

    use_regex = abap_true .

    CATCH cx_sy_regex INTO ob_root .
    text = ob_root->get_text( ).
    MESSAGE s000(oo) WITH text DISPLAY LIKE ‘W’ .
    RETURN .
    ENDTRY.

    ENDIF .

    FIELD-SYMBOLS: <st_e070_1> LIKE LINE OF it_e070_1 .

    LOOP AT it_e070_1 ASSIGNING <st_e070_1> .

    st_request-trkorr = <st_e070_1>-trkorr .

    CALL FUNCTION ‘TRINT_READ_REQUEST_HEADER’
    EXPORTING
    iv_read_e070 = abap_true
    iv_read_e07t = abap_true
    CHANGING
    cs_request = st_request
    EXCEPTIONS
    empty_trkorr = 1
    not_exist_e070 = 2
    OTHERS = 3.

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

    IF use_regex EQ abap_true .

    ob_abap_matcher = ob_abap_regex->create_matcher( text = st_request-as4text ).

    CALL METHOD ob_abap_matcher->find_all
    RECEIVING
    matches = it_match.

    CHECK it_match IS NOT INITIAL .

    ENDIF .

    PERFORM get_info_of_request
    USING
    st_request
    CHANGING
    it_buff_1 .

    ENDLOOP .

    FIELD-SYMBOLS: <st_buff_1> LIKE LINE OF it_buff_1 .

    FIELD-SYMBOLS: <st_alv_data_1> LIKE LINE OF it_alv_data_1 .

    DATA: st_scol LIKE LINE OF <st_alv_data_1>-it_scol .

    st_scol-color-col = ‘6’ .
    st_scol-color-int = ‘1’ .
    st_scol-color-inv = ‘0’ .

    LOOP AT it_buff_1 ASSIGNING <st_buff_1> .

    APPEND INITIAL LINE TO it_alv_data_1 ASSIGNING <st_alv_data_1> .

    <st_alv_data_1>-buff_1 = <st_buff_1> .

    <st_alv_data_1>-buff_1-head-icon1 = icon_history .
    <st_alv_data_1>-buff_1-head-icon2 = icon_protocol .

    <st_alv_data_1>-ex_flag = ‘0’ .”

    IF <st_alv_data_1>-buff_1-logs-rc NE 0 .

    IF <st_alv_data_1>-buff_1-logs-rc GE 8 .
    st_scol-color-col = ‘6’ .
    <st_alv_data_1>-ex_flag = ‘1’ .
    ELSEIF <st_alv_data_1>-buff_1-logs-rc GE 4 .
    st_scol-color-col = ‘3’ .
    <st_alv_data_1>-ex_flag = ‘2’ .
    ENDIF.

    st_scol-fname = ‘SYSTEMID_LOGS’ .

    APPEND st_scol TO <st_alv_data_1>-it_scol .

    ENDIF.

    ENDLOOP .

    ENDFORM . “get_data_1
    *———————————————————————-*
    FORM get_info_of_request
    USING
    st_request TYPE trwbo_request_header
    CHANGING
    it_buff_1 TYPE tp_buff_x_tab .

    DATA: user TYPE e070-as4user .
    DATA: trkorr TYPE trkorr .

    DATA: st_cofile TYPE ctslg_cofile .

    CALL FUNCTION ‘TR_READ_GLOBAL_INFO_OF_REQUEST’
    EXPORTING
    iv_trkorr = st_request-trkorr
    IMPORTING
    es_cofile = st_cofile
    ev_user = user
    ev_project = trkorr.

    FIELD-SYMBOLS: <st_systems> TYPE LINE OF ctslg_systems .
    FIELD-SYMBOLS: <st_steps> TYPE LINE OF ctslg_steps .
    FIELD-SYMBOLS: <st_actions> TYPE LINE OF ctslg_actions .

    DATA: it_buff_t TYPE tp_buff_x_tab .
    DATA: st_buff_t LIKE LINE OF it_buff_t .

    MOVE-CORRESPONDING st_request TO st_buff_t-head .

    DATA: it_acnmx_detail TYPE TABLE OF /acnmx/detail .

    * iWave Transport Management info (delete if you do not have this)

    SELECT * INTO TABLE it_acnmx_detail
    FROM /acnmx/detail
    WHERE
    primescape EQ space AND
    trkorr EQ st_request-trkorr AND
    actionpend NE space .

    SORT it_acnmx_detail BY actiondate DESCENDING actiontime DESCENDING .

    READ TABLE it_acnmx_detail INTO st_buff_t-acnm INDEX 1 .

    CHECK st_buff_t-acnm-actionpend IN s_impsts .

    * Modifiable ?
    IF st_cofile-systems[] IS INITIAL .

    CHECK st_buff_t-logs-systemid IN s_trgt_s .

    CHECK st_buff_t-logs-systemid IN s_trgt_i .

    IF s_trgt_e[] IS NOT INITIAL .
    CHECK st_buff_t-logs-systemid NOT IN s_trgt_i .
    ENDIF .

    APPEND st_buff_t TO it_buff_1 .

    RETURN .

    ENDIF .

    DATA: score_i TYPE dismpocx-score .
    DATA: score_e TYPE dismpocx-score .

    LOOP AT st_cofile-systems[] ASSIGNING <st_systems> .

    IF <st_systems>-systemid IN s_trgt_i .
    ADD 1 TO score_i .
    ENDIF .

    IF s_trgt_e[] IS NOT INITIAL AND
    <st_systems>-systemid IN s_trgt_e .
    ADD 1 TO score_e .
    ENDIF .

    CHECK <st_systems>-systemid IN s_trgt_s .

    CLEAR st_buff_t-logs . “01/03/2017

    st_buff_t-logs-systemid = <st_systems>-systemid .

    LOOP AT <st_systems>-steps[] ASSIGNING <st_steps> .

    st_buff_t-logs-stepid = <st_steps>-stepid .

    * Use the latest date/time (see definitions of actions )
    LOOP AT <st_steps>-actions ASSIGNING <st_actions> .

    st_buff_t-logs-date = <st_actions>-date .
    st_buff_t-logs-time = <st_actions>-time .

    * Get the most severe problem for the current system
    IF <st_actions>-rc GT st_buff_t-logs-rc .
    st_buff_t-logs-rc = <st_actions>-rc .
    ENDIF .

    ENDLOOP .

    ENDLOOP .

    APPEND st_buff_t TO it_buff_t .

    ENDLOOP .

    DATA: lines TYPE i .

    lines = LINES( s_trgt_i ) .

    IF score_i GE lines AND
    score_e EQ 0 .
    APPEND LINES OF it_buff_t TO it_buff_1 .
    ENDIF .

    ENDFORM . “get_info_of_request
    *———————————————————————-*
    FORM get_field_catalog
    USING
    disvariant TYPE disvariant
    CHANGING
    it_fieldcatalog TYPE lvc_t_fcat .

    CLEAR it_fieldcatalog .

    DATA: ob_gui_alv_grid_tools TYPE REF TO cl_gui_alv_grid_tools .

    CREATE OBJECT ob_gui_alv_grid_tools .

    CALL METHOD ob_gui_alv_grid_tools->add_field
    EXPORTING:
    fieldname = ‘trkorr_head ‘ ref_table = ‘trheader ‘ ref_field = ‘trkorr ‘ hotspot = abap_true ,
    fieldname = ‘as4user_head ‘ ref_table = ‘trheader ‘ ref_field = ‘as4user ‘ ,

    fieldname = ‘icon1_head ‘ ref_table = ‘icon ‘ ref_field = ‘id ‘ coltext = ‘Transport Logs’ hotspot = abap_true ,
    fieldname = ‘icon2_head ‘ ref_table = ‘icon ‘ ref_field = ‘id ‘ coltext = ‘Action log’ hotspot = abap_true ,

    fieldname = ‘as4text_head ‘ ref_table = ‘trheader ‘ ref_field = ‘as4text ‘ ,

    fieldname = ‘trfunction_head ‘ ref_table = ‘trheader ‘ ref_field = ‘trfunction ‘ ,
    fieldname = ‘trstatus_head ‘ ref_table = ‘trheader ‘ ref_field = ‘trstatus ‘ ,

    fieldname = ‘tarsystem_head ‘ ref_table = ‘trheader ‘ ref_field = ‘tarsystem ‘ no_out = abap_true ,

    fieldname = ‘actionpend_acnm ‘ ref_table = ‘/acnmx/detail ‘ ref_field = ‘actionpend ‘ coltext = ‘Import status'(015) ,

    fieldname = ‘as4date_head ‘ ref_table = ‘trheader ‘ ref_field = ‘as4date ‘ ,
    fieldname = ‘as4time_head ‘ ref_table = ‘trheader ‘ ref_field = ‘as4time ‘ coltext = ‘Last changed at'(017) ,

    fieldname = ‘strkorr_head ‘ ref_table = ‘trheader ‘ ref_field = ‘strkorr ‘ ,

    fieldname = ‘systemid_logs ‘ ref_table = ‘tstrfcofil’ ref_field = ‘tarsystem ‘ ,
    fieldname = ‘date_logs ‘ ref_table = ‘tstrfcofil’ ref_field = ‘trdate ‘ no_zero = abap_true ,
    fieldname = ‘time_logs ‘ ref_table = ‘tstrfcofil’ ref_field = ‘trtime ‘ no_zero = abap_true ,

    fieldname = ‘li_cntr ‘ ref_table = ‘syst’ ref_field = ‘srows ‘ tech = abap_true .

    it_fieldcatalog = ob_gui_alv_grid_tools->get_fieldcatalog( complete = abap_true ) .

    FIELD-SYMBOLS: <st_fieldcatalog> LIKE LINE OF it_fieldcatalog .

    LOOP AT it_fieldcatalog ASSIGNING <st_fieldcatalog> .

    IF <st_fieldcatalog>-coltext IS NOT INITIAL .
    <st_fieldcatalog>-tooltip = <st_fieldcatalog>-scrtext_m = <st_fieldcatalog>-seltext = <st_fieldcatalog>-scrtext_l = <st_fieldcatalog>-coltext .
    ELSE .
    <st_fieldcatalog>-coltext = <st_fieldcatalog>-scrtext_l .
    ENDIF .

    ENDLOOP .

    ENDFORM . “get_field_catalog
    *———————————————————————-*
    *———————————————————————-*
    MODULE at_pbo OUTPUT .
    PERFORM at_pbo .
    ENDMODULE . “at_pbo OUTPUT
    *———————————————————————-*
    FORM at_pbo .

    CLEAR: ok_code .

    DATA: title TYPE sytitle . ” Title Line

    title = sy-title .

    SET TITLEBAR ‘TITLE_COMMON’ WITH title .

    CASE syst-dynnr.
    WHEN 0100 .
    PERFORM at_pbo_100 .
    ENDCASE.

    ENDFORM . “at_pbo
    *———————————————————————-*
    FORM at_pbo_100 .

    DATA: ex_ucomm TYPE ddshfcodes . ” Function Code

    DATA: it_sort TYPE lvc_t_sort .
    FIELD-SYMBOLS: <st_sort> LIKE LINE OF it_sort .

    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘TRKORR_HEAD ‘ . <st_sort>-up = abap_true .
    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘AS4USER_HEAD’ . <st_sort>-up = abap_true .
    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘AS4TEXT_HEAD’ . <st_sort>-up = abap_true .
    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘AS4DATE_HEAD’ . <st_sort>-up = abap_true .
    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘AS4TIME_HEAD’ . <st_sort>-up = abap_true .
    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘TRFUNCTION_HEAD’ . <st_sort>-up = abap_true .
    APPEND INITIAL LINE TO it_sort ASSIGNING <st_sort> . <st_sort>-fieldname = ‘TRSTATUS_HEAD’ . <st_sort>-up = abap_true .

    PERFORM set_gui_alv_grid
    USING
    space
    gs_disvariant_1
    CHANGING
    ob_gui_alv_grid_1
    ob_event_receiver_1
    it_sort
    gs_globals-it_alv_data_1 .

    IF ob_gui_timer IS INITIAL .
    CREATE OBJECT ob_gui_timer .
    SET HANDLER ob_event_receiver_1->finished FOR ob_gui_timer .
    ENDIF .

    * Start timer .
    IF p_tmr_on EQ abap_true .
    ob_gui_timer->interval = p_tmr_in .
    ob_gui_timer->run( ).
    ENDIF.

    SET PF-STATUS ‘STATUS_COMMON’ EXCLUDING ex_ucomm .

    ENDFORM . “at_pbo_100
    *———————————————————————-*
    FORM set_gui_alv_grid
    USING
    grid_title TYPE lvc_title ” ALV Control: Title bar text
    disvariant TYPE disvariant ” Layout (External Use)
    CHANGING
    ob_gui_alv_grid TYPE REF TO cl_gui_alv_grid ” ALV List Viewer
    ob_event_receiver TYPE REF TO cl_event_receiver ” Event_receiver class
    it_sort TYPE lvc_t_sort
    it_outtab TYPE table .

    DATA: st_layout TYPE lvc_s_layo. ” ALV control: Layout structure
    DATA: st_print TYPE lvc_s_prnt. ” Print settings for LVC

    DATA: it_fieldcatalog TYPE lvc_t_fcat.

    DATA: ob_gui_splitter_container TYPE REF TO cl_gui_splitter_container . ” Splitter Control
    DATA: ob_gui_container TYPE REF TO cl_gui_container. ” Abstract Container for GUI Controls

    IF ob_gui_alv_grid IS INITIAL .

    IF sy-batch IS INITIAL .

    CREATE OBJECT ob_gui_splitter_container
    EXPORTING
    parent = cl_gui_container=>screen0
    rows = 1
    columns = 1.

    CALL METHOD ob_gui_splitter_container->set_border
    EXPORTING
    border = cl_gui_cfw=>false.

    CALL METHOD ob_gui_splitter_container->set_column_mode
    EXPORTING
    mode = cl_gui_splitter_container=>mode_absolute.

    CALL METHOD ob_gui_splitter_container->get_container
    EXPORTING
    row = 1
    column = 1
    RECEIVING
    container = ob_gui_container.

    ENDIF .

    CREATE OBJECT ob_gui_alv_grid
    EXPORTING
    i_parent = ob_gui_container.

    CREATE OBJECT ob_event_receiver .

    * registers the event handlers
    SET HANDLER ob_event_receiver->toolbar FOR ob_gui_alv_grid .
    SET HANDLER ob_event_receiver->user_command FOR ob_gui_alv_grid .
    SET HANDLER ob_event_receiver->hotspot_click FOR ob_gui_alv_grid .

    st_layout-sel_mode = ‘A’ .
    st_layout-cwidth_opt = abap_true .
    st_layout-excp_fname = gc_excp_fname .
    st_layout-grid_title = grid_title .
    st_layout-excp_led = abap_true .

    st_layout-ctab_fname = gc_ctab_fname .
    st_layout-stylefname = gc_styl_fname .
    st_layout-info_fname = gc_info_fname .
    st_layout-countfname = gc_cntr_fname .

    PERFORM get_field_catalog
    USING
    disvariant
    CHANGING
    it_fieldcatalog .

    CALL METHOD ob_gui_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = st_layout
    is_print = st_print
    i_save = ‘A’
    is_variant = disvariant
    CHANGING
    it_sort = it_sort
    it_fieldcatalog = it_fieldcatalog
    it_outtab = it_outtab.

    ELSE . ” ELSE -> IF ob_gui_alv_grid IS INITIAL

    DATA: st_stable TYPE lvc_s_stbl .

    st_stable-row = abap_true .
    st_stable-col = abap_true .

    CALL METHOD ob_gui_alv_grid->refresh_table_display
    EXPORTING
    * i_soft_refresh = abap_true
    is_stable = st_stable.

    ENDIF. ” IF ob_gui_alv_grid IS INITIAL

    ENDFORM . “set_gui_alv_grid
    *———————————————————————-*
    MODULE at_pai_exit INPUT.
    PERFORM at_pai_exit .
    ENDMODULE . “at_pai_exit INPUT
    *———————————————————————-*
    FORM at_pai_exit .

    DATA: ok_save TYPE syucomm. ” Function Code
    DATA: varkey TYPE rstable-varkey .

    ok_save = ok_code .

    CASE ok_save .
    WHEN ‘EXIT’ .
    LEAVE PROGRAM .
    WHEN ‘BACK’ OR ‘CANCEL’ .
    CASE syst-dynnr .
    WHEN 0100 .
    LEAVE TO SCREEN 0 .
    ENDCASE .
    ENDCASE .

    ENDFORM . “at_pai_exit

     

    (0) 

Leave a Reply