*&---------------------------------------------------------------------*
*& Report ZWF_TRANSPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zwf_transport NO STANDARD PAGE HEADING LINE-COUNT 30.
TABLES: tmsbufreq, tstrfcofil, e070.
TYPE-POOLS: ctslg, slis, icon.
SELECTION-SCREEN BEGIN OF BLOCK b1 .
SELECT-OPTIONS:
request FOR e070-trkorr,
date FOR e070-as4date,
user FOR e070-as4user NO INTERVALS NO-EXTENSION,
sys1 FOR tstrfcofil-tarsystem NO INTERVALS DEFAULT 'TST',
sys2 FOR tstrfcofil-tarsystem NO INTERVALS DEFAULT 'PRD'.
SELECTION-SCREEN END OF BLOCK b1.
TYPES: BEGIN OF info,
icon TYPE icon-id,
indicator TYPE c, " Indicator
indicator2 TYPE c,
systemid TYPE tarsystem, " target system
clientid TYPE mandt," target client
rc TYPE i, " return code
date TYPE as4date,
time TYPE as4time,
trkorr TYPE trkorr,
trfunction TYPE e070-trfunction,
as4user TYPE tr_as4user,
emailid TYPE string,
as4text TYPE e07t-as4text,
cdate TYPE as4date,
uname TYPE ad_namtext,
END OF info.
DATA: itab TYPE TABLE OF info,
data TYPE info,
jtab TYPE TABLE OF info,
data1 TYPE info,
ktab TYPE TABLE OF info,
data2 TYPE info.
TYPES:BEGIN OF ty_request,
trkorr TYPE e070-trkorr,
as4date TYPE e070-as4date,
as4user TYPE e070-as4user,
trfunction TYPE e070-trfunction,
END OF ty_request.
DATA: it_request TYPE TABLE OF ty_request,
wa_request TYPE ty_request.
TYPES: BEGIN OF prod,
trkorr TYPE trkorr,
as4user TYPE as4user,
END OF prod.
TYPES:BEGIN OF ty_e07t,
trkorr TYPE e07t-trkorr,
as4text TYPE e07t-as4text,
END OF ty_e07t.
DATA: it_text TYPE TABLE OF ty_e07t,
wa_text LIKE LINE OF it_text.
DATA: es_cofile TYPE ctslg_cofile,
system TYPE ctslg_system,
step TYPE ctslg_step,
action TYPE ctslg_action.
DATA: text(20) TYPE c VALUE 'Transport Details'.
DATA: catalog TYPE slis_fieldcat_alv, "FIELDCAT
tcatalog TYPE slis_t_fieldcat_alv, "IT FIELDCAT
event TYPE slis_alv_event, "EVENT
tevent TYPE slis_t_event, "IT EVENT
layout TYPE slis_layout_alv, "LAYOUT
pg_top TYPE slis_formname VALUE 'TOP_OF_PAGE',
pg_head TYPE slis_t_listheader,
exit1 TYPE slis_exit_by_user,
sortf TYPE slis_sortinfo_alv,
tsort TYPE slis_t_sortinfo_alv,
var1 TYPE disvariant,
var2 TYPE disvariant,
v_uname TYPE ad_namtext.
INITIALIZATION.
LOOP AT SCREEN.
IF screen-name = 'SYS1-LOW' OR screen-name = 'SYS2-LOW'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN .
IF request IS INITIAL AND date IS INITIAL AND user IS INITIAL.
MESSAGE 'Enter atleast 1 value' TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'SYS1-LOW' OR screen-name = 'SYS2-LOW'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_events USING tevent.
PERFORM text USING pg_head.
PERFORM display_alv_report.
**********************************************************************
* FORM : DATA_RETRIEVAL
**********************************************************************
FORM data_retrieval .
SELECT trkorr as4date as4user trfunction INTO CORRESPONDING FIELDS OF TABLE
it_request FROM e070
WHERE trkorr IN request
AND ( trfunction = 'K' OR trfunction = 'W' )
AND as4date IN date
AND as4user IN user.
SORT it_request BY trkorr.
LOOP AT it_request INTO wa_request.
CALL FUNCTION 'TR_READ_GLOBAL_INFO_OF_REQUEST'
EXPORTING
iv_trkorr = wa_request-trkorr
IMPORTING
es_cofile = es_cofile.
IF es_cofile-exists = 'X'.
LOOP AT es_cofile-systems INTO system WHERE systemid IN sys1 OR systemid IN sys2. " target system
LOOP AT system-steps INTO step WHERE clientid = ' '. " step of transport
CLEAR data.
data-systemid = system-systemid.
* data-clientid = step-clientid.
data-rc = step-rc.
LOOP AT step-actions INTO action. " action
data-date = action-date.
data-time = action-time.
ENDLOOP.
data-trkorr = wa_request-trkorr.
data-as4user = wa_request-as4user.
data-cdate = wa_request-as4date.
data-trfunction = wa_request-trfunction.
COLLECT data INTO itab.
ENDLOOP.
ENDLOOP.
ELSE.
CLEAR data.
data-trkorr = wa_request-trkorr.
data-as4user = wa_request-as4user.
data-cdate = wa_request-as4date.
data-trfunction = wa_request-trfunction.
APPEND data TO itab.
ENDIF.
DELETE ADJACENT DUPLICATES FROM itab COMPARING trkorr systemid .
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL
**********************************************************************
* FORM : build_fieldcatalog.
**********************************************************************
FORM build_fieldcatalog.
DATA: pos TYPE i.
DATA : name(25) TYPE c.", spac VALUE ' '.
DATA: name2(25) TYPE c.
CONCATENATE 'TR in ' sys2-low INTO name SEPARATED BY space.
CONCATENATE 'TR in ' sys1-low INTO name2 SEPARATED BY space.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'ICON'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'Status'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'TRKORR'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'Request no'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'TRFUNCTION'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'Request type'.
* catalog-no_zero = 'X'.
* catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'AS4USER'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'Request owner'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'UNAME'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'User name'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'INDICATOR2'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = name2.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'INDICATOR'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = name.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'CDATE'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'TR release date'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'DATE'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'TR transport date'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'AS4TEXT'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'Request Description'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
ENDFORM. " build_fieldcatalog.
**********************************************************************
* FORM : build_events.
**********************************************************************
FORM build_events USING p_tevent.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1
IMPORTING
et_events = tevent.
READ TABLE tevent WITH KEY name = slis_ev_top_of_page INTO event.
IF sy-subrc = 0.
MOVE pg_top TO event-form.
APPEND event TO tevent.
ENDIF.
ENDFORM. "build_events.
*&---------------------------------------------------------------------*
*& Form TOP_OF_PAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM top_of_page .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = ' '
it_list_commentary = pg_head.
* I_END_OF_LIST_GRID =
* I_ALV_FORM = .
ENDFORM. "TOP-OF-PAGE
**********************************************************************
* FORM : TEXT
**********************************************************************
FORM text USING v_head TYPE slis_t_listheader.
DATA: line TYPE slis_listheader.
CLEAR line.
line-typ = 'H'.
line-info = 'Transport request log'.
APPEND line TO pg_head..
CLEAR line.
ENDFORM. "TEXT
**********************************************************************
* FORM : display_alv_report.
**********************************************************************
FORM display_alv_report.
layout-colwidth_optimize = 'X'.
layout-box_tabname = 'IT'.
layout-info_fieldname = 'LINE_COLOR'.
layout-zebra = 'X'.
layout-cell_merge = 'X'.
jtab = itab .
LOOP AT itab INTO data.
CLEAR data1.
LOOP AT jtab INTO data1 WHERE trkorr = data-trkorr AND systemid = sys2-low.
ENDLOOP.
IF sy-subrc = 0.
data-indicator = 'X'.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
ktab = itab .
LOOP AT itab INTO data.
CLEAR data2.
LOOP AT ktab INTO data2 WHERE trkorr = data-trkorr AND systemid = sys1-low.
ENDLOOP.
IF sy-subrc = 0.
data-indicator2 = 'X'.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
SORT itab BY trkorr date DESCENDING.
DELETE ADJACENT DUPLICATES FROM itab COMPARING trkorr.
SELECT * FROM e07t INTO CORRESPONDING FIELDS OF TABLE it_text
FOR ALL ENTRIES IN itab
WHERE trkorr = itab-trkorr.
LOOP AT itab INTO data.
CLEAR wa_text.
READ TABLE it_text INTO wa_text WITH KEY trkorr = data-trkorr.
IF sy-subrc = 0.
data-as4text = wa_text-as4text.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
LOOP AT itab INTO data.
IF data-indicator2 EQ 'X' AND data-indicator EQ 'X'.
data-icon = icon_green_light.
MODIFY itab FROM data INDEX sy-tabix.
ELSEIF data-indicator2 EQ 'X' AND data-indicator NE 'X'.
data-icon = icon_yellow_light.
MODIFY itab FROM data INDEX sy-tabix.
ELSE.
data-icon = icon_red_light.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
LOOP AT itab INTO data.
CLEAR v_uname.
SELECT SINGLE name_text FROM user_addrp INTO v_uname
WHERE bname = data-as4user.
IF sy-subrc = 0.
data-uname = v_uname.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
SORT itab BY trkorr.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = tcatalog
* it_events = tevent[]
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2 .
*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. "display_alv_report.
*& Report ZWF_TRANSPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zwf_transport NO STANDARD PAGE HEADING LINE-COUNT 30.
TABLES: tmsbufreq, tstrfcofil, e070.
TYPE-POOLS: ctslg, slis, icon.
SELECTION-SCREEN BEGIN OF BLOCK b1 .
SELECT-OPTIONS:
request FOR e070-trkorr,
date FOR e070-as4date,
user FOR e070-as4user NO INTERVALS NO-EXTENSION,
sys1 FOR tstrfcofil-tarsystem NO INTERVALS DEFAULT 'TST',
sys2 FOR tstrfcofil-tarsystem NO INTERVALS DEFAULT 'PRD'.
SELECTION-SCREEN END OF BLOCK b1.
TYPES: BEGIN OF info,
icon TYPE icon-id,
indicator TYPE c, " Indicator
indicator2 TYPE c,
systemid TYPE tarsystem, " target system
clientid TYPE mandt," target client
rc TYPE i, " return code
date TYPE as4date,
time TYPE as4time,
trkorr TYPE trkorr,
trfunction TYPE e070-trfunction,
as4user TYPE tr_as4user,
emailid TYPE string,
as4text TYPE e07t-as4text,
cdate TYPE as4date,
uname TYPE ad_namtext,
END OF info.
DATA: itab TYPE TABLE OF info,
data TYPE info,
jtab TYPE TABLE OF info,
data1 TYPE info,
ktab TYPE TABLE OF info,
data2 TYPE info.
TYPES:BEGIN OF ty_request,
trkorr TYPE e070-trkorr,
as4date TYPE e070-as4date,
as4user TYPE e070-as4user,
trfunction TYPE e070-trfunction,
END OF ty_request.
DATA: it_request TYPE TABLE OF ty_request,
wa_request TYPE ty_request.
TYPES: BEGIN OF prod,
trkorr TYPE trkorr,
as4user TYPE as4user,
END OF prod.
TYPES:BEGIN OF ty_e07t,
trkorr TYPE e07t-trkorr,
as4text TYPE e07t-as4text,
END OF ty_e07t.
DATA: it_text TYPE TABLE OF ty_e07t,
wa_text LIKE LINE OF it_text.
DATA: es_cofile TYPE ctslg_cofile,
system TYPE ctslg_system,
step TYPE ctslg_step,
action TYPE ctslg_action.
DATA: text(20) TYPE c VALUE 'Transport Details'.
DATA: catalog TYPE slis_fieldcat_alv, "FIELDCAT
tcatalog TYPE slis_t_fieldcat_alv, "IT FIELDCAT
event TYPE slis_alv_event, "EVENT
tevent TYPE slis_t_event, "IT EVENT
layout TYPE slis_layout_alv, "LAYOUT
pg_top TYPE slis_formname VALUE 'TOP_OF_PAGE',
pg_head TYPE slis_t_listheader,
exit1 TYPE slis_exit_by_user,
sortf TYPE slis_sortinfo_alv,
tsort TYPE slis_t_sortinfo_alv,
var1 TYPE disvariant,
var2 TYPE disvariant,
v_uname TYPE ad_namtext.
INITIALIZATION.
LOOP AT SCREEN.
IF screen-name = 'SYS1-LOW' OR screen-name = 'SYS2-LOW'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN .
IF request IS INITIAL AND date IS INITIAL AND user IS INITIAL.
MESSAGE 'Enter atleast 1 value' TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'SYS1-LOW' OR screen-name = 'SYS2-LOW'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_events USING tevent.
PERFORM text USING pg_head.
PERFORM display_alv_report.
**********************************************************************
* FORM : DATA_RETRIEVAL
**********************************************************************
FORM data_retrieval .
SELECT trkorr as4date as4user trfunction INTO CORRESPONDING FIELDS OF TABLE
it_request FROM e070
WHERE trkorr IN request
AND ( trfunction = 'K' OR trfunction = 'W' )
AND as4date IN date
AND as4user IN user.
SORT it_request BY trkorr.
LOOP AT it_request INTO wa_request.
CALL FUNCTION 'TR_READ_GLOBAL_INFO_OF_REQUEST'
EXPORTING
iv_trkorr = wa_request-trkorr
IMPORTING
es_cofile = es_cofile.
IF es_cofile-exists = 'X'.
LOOP AT es_cofile-systems INTO system WHERE systemid IN sys1 OR systemid IN sys2. " target system
LOOP AT system-steps INTO step WHERE clientid = ' '. " step of transport
CLEAR data.
data-systemid = system-systemid.
* data-clientid = step-clientid.
data-rc = step-rc.
LOOP AT step-actions INTO action. " action
data-date = action-date.
data-time = action-time.
ENDLOOP.
data-trkorr = wa_request-trkorr.
data-as4user = wa_request-as4user.
data-cdate = wa_request-as4date.
data-trfunction = wa_request-trfunction.
COLLECT data INTO itab.
ENDLOOP.
ENDLOOP.
ELSE.
CLEAR data.
data-trkorr = wa_request-trkorr.
data-as4user = wa_request-as4user.
data-cdate = wa_request-as4date.
data-trfunction = wa_request-trfunction.
APPEND data TO itab.
ENDIF.
DELETE ADJACENT DUPLICATES FROM itab COMPARING trkorr systemid .
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL
**********************************************************************
* FORM : build_fieldcatalog.
**********************************************************************
FORM build_fieldcatalog.
DATA: pos TYPE i.
DATA : name(25) TYPE c.", spac VALUE ' '.
DATA: name2(25) TYPE c.
CONCATENATE 'TR in ' sys2-low INTO name SEPARATED BY space.
CONCATENATE 'TR in ' sys1-low INTO name2 SEPARATED BY space.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'ICON'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'Status'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'TRKORR'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'Request no'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'TRFUNCTION'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'Request type'.
* catalog-no_zero = 'X'.
* catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'AS4USER'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'Request owner'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'UNAME'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'User name'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'INDICATOR2'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = name2.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'INDICATOR'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = name.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'CDATE'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'TR release date'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'DATE'.
catalog-tabname = 'ITAB'.
catalog-seltext_m = 'TR transport date'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'AS4TEXT'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'Request Description'.
catalog-no_zero = 'X'.
catalog-fix_column = 'X'.
APPEND catalog TO tcatalog.
ENDFORM. " build_fieldcatalog.
**********************************************************************
* FORM : build_events.
**********************************************************************
FORM build_events USING p_tevent.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1
IMPORTING
et_events = tevent.
READ TABLE tevent WITH KEY name = slis_ev_top_of_page INTO event.
IF sy-subrc = 0.
MOVE pg_top TO event-form.
APPEND event TO tevent.
ENDIF.
ENDFORM. "build_events.
*&---------------------------------------------------------------------*
*& Form TOP_OF_PAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM top_of_page .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = ' '
it_list_commentary = pg_head.
* I_END_OF_LIST_GRID =
* I_ALV_FORM = .
ENDFORM. "TOP-OF-PAGE
**********************************************************************
* FORM : TEXT
**********************************************************************
FORM text USING v_head TYPE slis_t_listheader.
DATA: line TYPE slis_listheader.
CLEAR line.
line-typ = 'H'.
line-info = 'Transport request log'.
APPEND line TO pg_head..
CLEAR line.
ENDFORM. "TEXT
**********************************************************************
* FORM : display_alv_report.
**********************************************************************
FORM display_alv_report.
layout-colwidth_optimize = 'X'.
layout-box_tabname = 'IT'.
layout-info_fieldname = 'LINE_COLOR'.
layout-zebra = 'X'.
layout-cell_merge = 'X'.
jtab = itab .
LOOP AT itab INTO data.
CLEAR data1.
LOOP AT jtab INTO data1 WHERE trkorr = data-trkorr AND systemid = sys2-low.
ENDLOOP.
IF sy-subrc = 0.
data-indicator = 'X'.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
ktab = itab .
LOOP AT itab INTO data.
CLEAR data2.
LOOP AT ktab INTO data2 WHERE trkorr = data-trkorr AND systemid = sys1-low.
ENDLOOP.
IF sy-subrc = 0.
data-indicator2 = 'X'.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
SORT itab BY trkorr date DESCENDING.
DELETE ADJACENT DUPLICATES FROM itab COMPARING trkorr.
SELECT * FROM e07t INTO CORRESPONDING FIELDS OF TABLE it_text
FOR ALL ENTRIES IN itab
WHERE trkorr = itab-trkorr.
LOOP AT itab INTO data.
CLEAR wa_text.
READ TABLE it_text INTO wa_text WITH KEY trkorr = data-trkorr.
IF sy-subrc = 0.
data-as4text = wa_text-as4text.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
LOOP AT itab INTO data.
IF data-indicator2 EQ 'X' AND data-indicator EQ 'X'.
data-icon = icon_green_light.
MODIFY itab FROM data INDEX sy-tabix.
ELSEIF data-indicator2 EQ 'X' AND data-indicator NE 'X'.
data-icon = icon_yellow_light.
MODIFY itab FROM data INDEX sy-tabix.
ELSE.
data-icon = icon_red_light.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
LOOP AT itab INTO data.
CLEAR v_uname.
SELECT SINGLE name_text FROM user_addrp INTO v_uname
WHERE bname = data-as4user.
IF sy-subrc = 0.
data-uname = v_uname.
MODIFY itab FROM data INDEX sy-tabix.
ENDIF.
ENDLOOP.
SORT itab BY trkorr.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = tcatalog
* it_events = tevent[]
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2 .
*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. "display_alv_report.