(Idiotic) Program to get information from Transport Requests

I needed to create a program to keep control of my transport requests… Here it comes ūüôā

*———————————————————————*
* Header:
*¬†——-
* Program Name: Z__TRANR00_TRANSPORT_REQUESTS
* Description : Transport Request list for control
* Frequency   : Adhoc
* Processing  : Online
*¬†Request¬†ID¬†¬†:¬†—
*¬†Trans.¬†No.¬†¬†:¬†—
*¬†Funct.¬†Spec¬†:¬†—
*———————————————————————*
REPORT  z__tranr00_transport_requests.

TYPE-POOLS: icon.
TYPES: BEGIN OF ty_line,
trstatus    TYPE icon_d,
r_cr        TYPE e070a-reference,
trkorr      TYPE e070-trkorr,
trfunction  TYPE e070-trfunction,
r_devreq    TYPE e070a-reference,
as4text     TYPE e07t-as4text,
as4user     TYPE e070-as4user,
as4date     TYPE e070-as4date,
END OF ty_line.

DATA: l_tabix TYPE sy-tabix.
DATA: w_line  TYPE ty_line,
t_table TYPE TABLE OF ty_line.

DATA: s_type TYPE RANGE OF ty_line-trfunction,
w_type LIKE LINE OF s_type.

SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME.
SELECT-OPTIONS: s_crea FOR w_line-as4user,
s_date FOR w_line-as4date.
PARAMETERS:¬†p_custo¬†AS¬†CHECKBOX¬†DEFAULT¬†‘X’,
p_workb¬†AS¬†CHECKBOX¬†DEFAULT¬†‘X’.
SELECTION-SCREEN END OF BLOCK bl1.

AT SELECTION-SCREEN.
IF p_custo IS INITIAL AND p_workb IS INITIAL.
p_custo¬†=¬†‘X’.
p_workb¬†=¬†‘X’.
ENDIF.

w_type-sign¬†=¬†‘I’.
w_type-option¬†=¬†‘EQ’.
IF¬†p_custo¬†=¬†‘X’.
w_type-low¬†=¬†‘W’.¬†“CUSTO
APPEND w_type TO s_type.
ENDIF.
IF¬†p_workb¬†=¬†‘X’.
w_type-low¬†=¬†‘K’.¬†“WORKBENCH
APPEND w_type TO s_type.
ENDIF.

START-OF-SELECTION.
SELECT e~trstatus e~trkorr e~trfunction e~as4user e~as4date t~as4text
INTO CORRESPONDING FIELDS OF TABLE t_table
FROM e070 AS e INNER JOIN e07t AS t
ON e~trkorr = t~trkorr
WHERE¬†e~trkorr¬†LIKE¬†‘DECK%’
AND e~trfunction IN s_type
AND e~as4user IN s_crea
AND e~as4date IN s_date
AND¬†t~langu¬†=¬†‘E’.
IF sy-subrc = 0.
LOOP AT t_table INTO w_line.
l_tabix = sy-tabix.
*     (W)orkbench / (C)ustomizing
CASE w_line-trfunction.
WHEN¬†‘K’.
w_line-trfunction¬†=¬†‘W’.
WHEN¬†‘W’.
w_line-trfunction¬†=¬†‘C’.
ENDCASE.
*     CHANGE_REQUEST & DEVREQ
SELECT SINGLE reference
INTO w_line-r_cr
FROM e070a
WHERE trkorr = w_line-trkorr
AND¬†attribute¬†=¬†‘Z_CR_NUMBER’.
SELECT SINGLE reference
INTO w_line-r_devreq
FROM e070a
WHERE trkorr = w_line-trkorr
AND¬†attribute¬†=¬†‘Z_DEV_REQUEST’.

*     RELEASED?
IF¬†w_line-trstatus¬†=¬†‘D’.¬†“Modifiable
SELECT SINGLE cre_user cre_date
INTO (w_line-as4user, w_line-as4date)
FROM e070create
WHERE trkorr = w_line-trkorr.
w_line-trstatus = icon_red_light.
ELSE.
*       YES
w_line-trstatus = icon_yellow_light.
ENDIF.
MODIFY t_table FROM w_line INDEX l_tabix.
ENDLOOP.
ENDIF.

END-OF-SELECTION.
DESCRIBE TABLE t_table.
IF sy-tfill = 0.
WRITE:¬†/¬†‘No¬†data¬†found.’.
ELSE.
SORT t_table BY trstatus DESCENDING as4date DESCENDING.
CALL¬†FUNCTION¬†‘ISU_REUSE_ALV_SIMPLE_STRIPED’
EXPORTING
im_repid         = sy-repid
CHANGING
cht_display_data = t_table
EXCEPTIONS
general_fault    = 1
OTHERS           = 2.
IF sy-subrc <> 0.
WRITE:¬†/¬†‘Error¬†creating¬†grid.’.
ENDIF.
ENDIF.

(fucking WordPress, that doesn’t paste indentations ūüė¶ )

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s