*&---------------------------------------------------------------------*
*& Report ZKV11 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZKV11 .
type-pools: SLIS.
tables : zstud.
DATA : GD_REPID LIKE SY-REPID.
types : begin of st_stud,
STUDID TYPE ZSTUD-STUDID,
STUDNAME TYPE ZSTUD-STUDNAME,
END OF ST_STUD.
types : begin of st_stud1,
STUDADD TYPE ZSTUD-STUDADD,
STUDAGE TYPE ZSTUD-STUDAGE,
END OF ST_STUD1.
DATA : WA_STUD TYPE ST_STUD,
WA_STUD1 TYPE ST_STUD1.
DATA : IT_STUD LIKE STANDARD TABLE OF WA_STUD,
IT_STUD1 LIKE STANDARD TABLE OF WA_STUD1.
DATA: WA_FCAT TYPE SLIS_FIELDCAT_ALV ,
IT_FCAT LIKE STANDARD TABLE OF WA_FCAT,
WA_I_FCAT TYPE SLIS_FIELDCAT_ALV ,
IT_I_FCAT LIKE STANDARD TABLE OF WA_I_FCAT,
W_EVENT TYPE SLIS_ALV_EVENT,
I_EVENT TYPE SLIS_T_EVENT.
*** Selection-screen design
SELECTION-SCREEN : BEGIN OF BLOCK B1 .
SELECT-OPTIONS: S_STUD FOR ZSTUD-STUDID.
SELECTION-SCREEN : END OF BLOCK B1 .
SELECT STUDID
STUDNAME
FROM ZSTUD INTO TABLE IT_STUD
WHERE STUDID IN S_STUD.
WA_FCAT-FIELDNAME = 'STUDID'.
WA_FCAT-COL_POS = '1' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDID'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDNAME'.
WA_FCAT-COL_POS = '2' .
WA_FCAT-OUTPUTLEN = '18'.
WA_FCAT-SELTEXT_L = 'STUDNAME'.
APPEND WA_FCAT TO IT_FCAT.
W_EVENT-NAME = 'USER_COMMAND'.
W_EVENT-FORM = 'INTERACTIVE_FORM'.
APPEND W_EVENT TO I_EVENT.
GD_REPID = SY-REPID .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GD_REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME =
* IS_LAYOUT =
IT_FIELDCAT = IT_FCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = I_EVENT
* 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
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_STUD
* 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.
*&--------------------------------------------------------------------*
*& Form INTERACTIVE_FORM
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->USER_COMMANtext
* -->SEL text
*---------------------------------------------------------------------*
FORM INTERACTIVE_FORM USING USER_COMMAND LIKE SY-UCOMM
SEL TYPE SLIS_SELFIELD.
DATA: CUS(5) TYPE C,
SAL(10).
IF SEL-FIELDNAME = 'STUDID'.
CUS = SEL-VALUE.
SELECT STUDADD
STUDAGE
FROM ZSTUD INTO TABLE IT_STUD1
WHERE STUDID EQ CUS.
PERFORM IT_I_FCAT.
GD_REPID = SY-REPID .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GD_REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME =
* IS_LAYOUT =
IT_FIELDCAT = IT_I_FCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = I_EVENT
* 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
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_STUD1
* 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.
ENDIF.
endform. "INTERACTIVE_FORM
*&---------------------------------------------------------------------*
*& Form IT_I_FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM IT_I_FCAT .
free : it_i_fcat.
clear : wa_fcat .
WA_FCAT-FIELDNAME = 'STUDADD'.
WA_FCAT-COL_POS = '1' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDADD'.
APPEND WA_FCAT TO IT_I_FCAT.
WA_FCAT-FIELDNAME = 'STUDAGE'.
WA_FCAT-COL_POS = '2' .
WA_FCAT-OUTPUTLEN = '14'.
WA_FCAT-SELTEXT_L = 'STUDAGE'.
APPEND WA_FCAT TO IT_I_FCAT.
ENDFORM. " IT_I_FCAT
No comments:
Post a Comment