*&---------------------------------------------------------------------*
*& Report ZTRANSPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTRANSPORT NO STANDARD PAGE HEADING LINE-COUNT 30.
TABLES: tmsbufreq, tstrfcofil, e070.
TYPE-POOLS: ctslg, slis.
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 'DEV',
sys2 FOR tstrfcofil-tarsystem NO INTERVALS DEFAULT 'TST'.
SELECTION-SCREEN END OF BLOCK b1.
TYPES: BEGIN OF info,
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,
as4user TYPE tr_as4user,
emailid TYPE string,
as4text TYPE e07t-as4text,
cdate TYPE as4date,
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,
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.
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 INTO CORRESPONDING FIELDS OF TABLE
it_request FROM e070
WHERE trkorr IN request
AND trfunction = 'K'
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.
COLLECT data INTO itab.
ENDLOOP.
ENDLOOP.
ELSE.
CLEAR data.
data-trkorr = wa_request-trkorr.
data-as4user = wa_request-as4user.
data-cdate = wa_request-as4date.
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 'REQUEST IN ' sys2-low INTO name SEPARATED BY space.
CONCATENATE 'REQUEST IN ' sys1-low INTO name2 SEPARATED BY space.
pos = pos + 1.
CLEAR: catalog.
catalog-col_pos = pos.
catalog-fieldname = 'CDATE'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 'REQUEST CREATION DATE'.
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 = 'INDICATOR2'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = 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_l = name.
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_l = 'REQUEST 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 = 'AS4USER'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = '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 = 'AS4TEXT'.
catalog-tabname = 'ITAB'.
catalog-seltext_l = '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.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = tcatalog
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
it_events = tevent[]
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
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.
Monday, August 26, 2013
Tuesday, July 23, 2013
How to remove execute button from report selection screen
TABLES: smp_dyntxt, sscrfields,mara.
DATA: gt_exclude TYPE TABLE OF rsexfcode,
gtt_exclude TYPE rsexfcode.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN FUNCTION KEY 1. "Will have a function code of 'FC01'
SELECTION-SCREEN FUNCTION KEY 2. "Will have a function code of 'FC02'
SELECTION-SCREEN FUNCTION KEY 3.
SELECTION-SCREEN FUNCTION KEY 4.
SELECTION-SCREEN FUNCTION KEY 5.
SELECTION-SCREEN END OF BLOCK block1.
INITIALIZATION.
* Add displayed text string to buttons
MOVE 'VF04' TO sscrfields-functxt_01.
MOVE 'Excecute report' TO sscrfields-functxt_02.
MOVE 'Test' TO sscrfields-functxt_03.
gtt_exclude-fcode = 'ONLI'.
APPEND gtt_exclude TO gt_exclude.
AT SELECTION-SCREEN.
IF sscrfields-ucomm = 'FC01'.
CALL TRANSACTION 'VF04'.
ELSEIF sscrfields-ucomm = 'FC02'.
ELSEIF sscrfields-ucomm = 'FC03'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = '%_00'
p_program = 'RSSYSTDB'
TABLES
p_exclude = gt_exclude.
Subscribe to:
Posts (Atom)