*selectin text:
*P_SPRSL 语言代码
*S_NAME 程序名
***************************************************************
* report ztest_program1 *
* write by Qin Li-quan(HP) *
* Date: 2007-07-10 *
* Description : Seeking Program by name *
***************************************************************
REPORT ZTEST_PROGRAM1 LINE-SIZE 145 LINE-COUNT 65(3) MESSAGE-ID 6G.
INCLUDE <ICON>.
TABLES: TRDIRT, "Program name & description
TSTC. "Transaction Table
DATA: BEGIN OF V_TRDIRT_ITAB OCCURS 0,
NAME LIKE TRDIRT-NAME, "Program Name
TEXT LIKE TRDIRT-TEXT, "Program description
END OF V_TRDIRT_ITAB.
DATA: BEGIN OF V_TSTC_ITAB OCCURS 0, "Transaction Table
TCODE LIKE TSTC-TCODE, "Transaction Code
PGMNA LIKE TSTC-PGMNA, "Progran Name
END OF V_TSTC_ITAB.
DATA: BEGIN OF V_PRINT_AREA OCCURS 0, "Print area
NAME LIKE TRDIRT-NAME, "Program Name
TCODE LIKE TSTC-TCODE, "Transaction Code
TEXT LIKE TRDIRT-TEXT, "Program Description
END OF V_PRINT_AREA.
DATA:
V_RECORD_COUNT(10) TYPE N. "line_count
SELECTION-SCREEN BEGIN OF BLOCK TABLE_RECORD WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_NAME FOR TRDIRT-NAME. "Program name
PARAMETER: P_SPRSL LIKE TRDIRT-SPRSL. "language
SELECTION-SCREEN END OF BLOCK TABLE_RECORD.
INITIALIZATION.
PERFORM A_INI_010_INITIALIZATION. "Initialization routine
AT SELECTION-SCREEN.
PERFORM B_ASS_010_AT_SELECTION_SCREEN. "Screen
START-OF-SELECTION.
PERFORM C_SOS_010_RETRIEVE_TRDIRT. "Retrieve Program table
PERFORM C_SOS_020_RETRIEVE_TSTC. "Retrieve Transaction table
END-OF-SELECTION.
PERFORM D_EOS_010_MATCH_AND_GET_TRANS. "Get transaction code
PERFORM D_EOS_020_PRINT_PROGRAM_TABLE. "Print structure
AT LINE-SELECTION.
PERFORM E_ALS_GET_PROGRAM.
TOP-OF-PAGE.
PERFORM Z_TOP_010_TOP_OF_PAGE. "Top-of-page
*---------------------------------------------------------------------*
* FORM a_ini_010_initialization *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM A_INI_010_INITIALIZATION.
P_SPRSL = SY-LANGU. "Initialize to 1
ENDFORM. "a_ini_010_initialization.
*---------------------------------------------------------------------*
* FORM b_ass_010_at_selection_screen *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM B_ASS_010_AT_SELECTION_SCREEN.
IF S_NAME IS INITIAL. "If blank
MESSAGE E134 . "enter a value for
ENDIF.
ENDFORM. "b_ass_010_at_selection_screen
*---------------------------------------------------------------------*
* FORM c_sos_010_retrieve_trdirt *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM C_SOS_010_RETRIEVE_TRDIRT.
SELECT NAME TEXT FROM TRDIRT "Retrieve Program description
INTO TABLE V_TRDIRT_ITAB
WHERE SPRSL = P_SPRSL "Default language
AND NAME IN S_NAME. "Program name
SORT V_TRDIRT_ITAB BY NAME. "Sort by Program Name
ENDFORM. "c_sos_010_retrieve_trdirt
*---------------------------------------------------------------------*
* FORM c_sos_020_retrieve_tstc *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM C_SOS_020_RETRIEVE_TSTC.
SELECT TCODE PGMNA FROM TSTC "Retrieve trans description
INTO TABLE V_TSTC_ITAB
WHERE PGMNA IN S_NAME. "Program Name
SORT V_TSTC_ITAB BY PGMNA. "Sort by Program Name
ENDFORM. "c_sos_020_retrieve_tstc
*---------------------------------------------------------------------*
* FORM d_eos_010_match_and_get_trans *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM D_EOS_010_MATCH_AND_GET_TRANS.
DATA: I LIKE SY-TABIX.
* i2 like sy-tabix.
I = 1.
DESCRIBE TABLE V_TRDIRT_ITAB LINES V_RECORD_COUNT. "Record count
IF V_RECORD_COUNT = 0. "no input
V_TRDIRT_ITAB-NAME = TEXT-003. "Program name
WRITE V_TRDIRT_ITAB-NAME UNDER TEXT-H01. "structure not defined
EXIT. "None to print
ENDIF.
V_RECORD_COUNT = 0.
LOOP AT V_TRDIRT_ITAB. "TRDIRT
LOOP AT V_TSTC_ITAB FROM I. "TSTC
IF V_TRDIRT_ITAB-NAME < V_TSTC_ITAB-PGMNA. "Master low
V_PRINT_AREA-NAME = V_TRDIRT_ITAB-NAME.
V_PRINT_AREA-TCODE = ' '.
V_PRINT_AREA-TEXT = V_TRDIRT_ITAB-TEXT.
I = SY-TABIX.
APPEND V_PRINT_AREA.
CLEAR V_PRINT_AREA.
EXIT. "Get another TSTC
ENDIF.
IF V_TRDIRT_ITAB-NAME > V_TSTC_ITAB-PGMNA. "Transaction low
V_PRINT_AREA-TCODE = ' '.
V_PRINT_AREA-NAME = ' '.
V_PRINT_AREA-TEXT = ' '.
I = SY-TABIX + 1.
CONTINUE. "Get another tstc
ENDIF.
IF V_TRDIRT_ITAB-NAME = V_TSTC_ITAB-PGMNA. "Found
V_PRINT_AREA-TCODE = V_TSTC_ITAB-TCODE.
V_PRINT_AREA-NAME = V_TRDIRT_ITAB-NAME.
V_PRINT_AREA-TEXT = V_TRDIRT_ITAB-TEXT.
I = SY-TABIX + 1.
APPEND V_PRINT_AREA.
CLEAR V_PRINT_AREA.
EXIT. "Get another TSTC
ENDIF.
ENDLOOP. "From tstc
ENDLOOP. "From trdirt
ENDFORM. "d_eos_010_match_and_get_trans
*---------------------------------------------------------------------*
* FORM d_eos_020_print_program_table *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM D_EOS_020_PRINT_PROGRAM_TABLE.
LOOP AT V_PRINT_AREA.
V_RECORD_COUNT = V_RECORD_COUNT + 1.
WRITE: / V_RECORD_COUNT NO-ZERO,
V_PRINT_AREA-NAME(31) UNDER TEXT-H01, "Program name
V_PRINT_AREA-TCODE(20) UNDER TEXT-H03, "Transasction Code
V_PRINT_AREA-TEXT UNDER TEXT-H02. "Program Description
HIDE: V_PRINT_AREA-NAME.
HIDE: V_PRINT_AREA-TCODE.
ENDLOOP.
ENDFORM. "d_eos_020_print_program_table
*---------------------------------------------------------------------*
* FORM e_als_get_program *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM E_ALS_GET_PROGRAM.
DATA V_CURSORFIELD(50).
GET CURSOR FIELD V_CURSORFIELD.
CASE V_CURSORFIELD.
WHEN 'V_PRINT_AREA-NAME'.
SET PARAMETER ID 'RID' FIELD SY-LISEL+11(40).
CALL TRANSACTION 'SE38' AND SKIP FIRST SCREEN.
WHEN 'V_PRINT_AREA-TCODE'.
SET PARAMETER ID 'RID' FIELD SY-LISEL+53(30).
CALL TRANSACTION V_PRINT_AREA-TCODE.
ENDCASE.
ENDFORM.
*---------------------------------------------------------------------*
* FORM z_top_010_top_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM Z_TOP_010_TOP_OF_PAGE.
* skip 1.
* WRITE 3 ICON_GIS_PAN AS ICON .
* write: 6 text-004.
* WRITE /3 ICON_DEFECT AS ICON .
* WRITE 6 text-005 .
*
* skip 2.
WRITE: /008 TEXT-002, "No.
013 TEXT-H01, "Program name
054 TEXT-H03, "Transaction Code
075 TEXT-H02. "Program Description
ULINE.
ENDFORM. "z_top_010_top_of_page.