*&---------------------------------------------------------------------*
*& Report ZPRAVEEN10 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZPRAVEEN10 .
TYPE-POOLS : SLIS.
tables : ZSTUD123 , ZSTUD_DET.
DATA : GD_REPID LIKE SY-REPID .
types : begin of st_stud,
studid type zstud123-studid,
studname type zstud123-studname,
studadd type zstud123-studadd,
studage type zstud123-studage,
end of st_stud.
types : begin of st_detail,
studid type ZSTUD_DET-studid,
course type ZSTUD_DET-course ,
coursfee type ZSTUD_DET-coursfee,
end of st_detail.
types : begin of st_JOIN,
studid type zstud123-studid,
studname type zstud123-studname,
studadd type zstud123-studadd,
studage type zstud123-studage,
course type ZSTUD_DET-course ,
coursfee type ZSTUD_DET-coursfee,
end of st_JOIN.
data : wa_stud type st_stud,
wa_detail type st_detail,
wa_join type st_join.
data : it_stud like standard table of wa_stud,
it_detail like standard table of wa_detail,
it_join like standard table of wa_join.
DATA: WA_FCAT TYPE SLIS_FIELDCAT_ALV ,
WA_I_FCAT TYPE SLIS_FIELDCAT_ALV ,
W_EVENT TYPE SLIS_ALV_EVENT,
I_EVENT TYPE SLIS_T_EVENT,
IT_FCAT LIKE STANDARD TABLE OF WA_FCAT,
IT_I_FCAT LIKE STANDARD TABLE OF WA_FCAT.
SELECTION-SCREEN : BEGIN OF BLOCK B3 WITH FRAME TITLE t3.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE T1 .
SELECT-OPTIONS: S_STUD FOR ZSTUD123-STUDID.
SELECTION-SCREEN : END OF BLOCK B1 .
SELECTION-SCREEN : BEGIN OF BLOCK B2 WITH FRAME TITLE T2 .
PARAMETERS : C_ALV_LT RADIOBUTTON GROUP GRP1,
C_ALV_GD RADIOBUTTON GROUP GRP1,
I_ALV_LT RADIOBUTTON GROUP GRP1,
I_ALV_GD RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN : END OF BLOCK B2 .
SELECTION-SCREEN : END OF BLOCK B3 .
PERFORM GETDATA.
PERFORM IT_FCAT.
IF C_ALV_LT = 'X'.
PERFORM C_ALV_LIST .
ENDIF.
IF C_ALV_GD = 'X'.
PERFORM C_ALV_GRID .
ENDIF.
IF I_ALV_LT = 'X'.
PERFORM I_ALV_LIST .
ENDIF.
IF I_ALV_GD = 'X'.
PERFORM I_ALV_GRID .
ENDIF.
*&---------------------------------------------------------------------*
*& Form GETDATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GETDATA .
select * from zstud123 into table it_stud
WHERE STUDID IN S_STUD .
select studid
course
coursfee
from zstud_det into table it_detail
for all entries in it_stud
where studid eq it_stud-studid.
loop at it_detail into wa_detail.
move : wa_detail-studid to wa_join-studid,
wa_detail-course to wa_join-course,
wa_detail-coursfee to wa_join-coursfee.
append wa_join to it_join.
endloop.
loop at it_join into wa_join.
read table it_stud into wa_stud
with key studid = wa_join-studid.
move : wa_stud-studname to wa_join-studname,
wa_stud-studadd to wa_join-studadd,
wa_stud-studage to wa_join-studage.
modify it_join from wa_join.
endloop.
ENDFORM. " GETDATA
*&---------------------------------------------------------------------*
*& Form IT_FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM IT_FCAT .
WA_FCAT-FIELDNAME = 'STUDID'.
WA_FCAT-COL_POS = '1 ' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDentID'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDNAME'.
WA_FCAT-COL_POS = '5' .
WA_FCAT-OUTPUTLEN = '8'.
WA_FCAT-SELTEXT_L = 'STUDNAME'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDADD'.
WA_FCAT-COL_POS = '3' .
WA_FCAT-OUTPUTLEN = '12'.
WA_FCAT-SELTEXT_L = 'STUDADD'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDAGE'.
WA_FCAT-COL_POS = '4' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDAGE'.
APPEND WA_FCAT TO IT_FCAT.
ENDFORM. " IT_FCAT
*&---------------------------------------------------------------------*
*& Form C_ALV_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM C_ALV_LIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* 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 =
* 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_JOIN
* 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. " C_ALV_LIST
*&---------------------------------------------------------------------*
*& Form C_ALV_GRID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM C_ALV_GRID .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* 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 =
* 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 = IT_JOIN
* 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. " C_ALV_GRID
*&---------------------------------------------------------------------*
*& Form I_ALV_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM I_ALV_LIST .
FREE : IT_FCAT,
IT_STUD.
SORT IT_JOIN BY STUDID.
DELETE ADJACENT DUPLICATES FROM IT_JOIN COMPARING STUDID.
PERFORM FIELD_CATLOG_INTERACTIVE .
PERFORM ALV_INTERACTIVE .
ENDFORM. " I_ALV_LIST
*&---------------------------------------------------------------------*
*& Form FIELD_CATLOG_INTERACTIVE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FIELD_CATLOG_INTERACTIVE .
WA_FCAT-FIELDNAME = 'STUDID'.
WA_FCAT-COL_POS = '1 ' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDentID'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDNAME'.
WA_FCAT-COL_POS = '2' .
WA_FCAT-OUTPUTLEN = '8'.
WA_FCAT-SELTEXT_L = 'STUDNAME'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDADD'.
WA_FCAT-COL_POS = '3' .
WA_FCAT-OUTPUTLEN = '12'.
WA_FCAT-SELTEXT_L = 'STUDADD'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'STUDAGE'.
WA_FCAT-COL_POS = '4' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDAGE'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'COURSE'.
WA_FCAT-COL_POS = '5' .
WA_FCAT-OUTPUTLEN = '12'.
WA_FCAT-SELTEXT_L = 'COURSE'.
APPEND WA_FCAT TO IT_FCAT.
WA_FCAT-FIELDNAME = 'COURSFEE'.
WA_FCAT-COL_POS = '6' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'COURSFEE'.
APPEND WA_FCAT TO IT_FCAT.
W_EVENT-NAME = 'USER_COMMAND'.
W_EVENT-FORM = 'INTERACTIVE_FORM'.
APPEND W_EVENT TO I_EVENT.
ENDFORM. " FIELD_CATLOG_INTERACTIVE
*&---------------------------------------------------------------------*
*& Form ALV_INTERACTIVE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALV_INTERACTIVE .
GD_REPID = SY-REPID.
IF I_ALV_LT = 'X'.
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_JOIN
* 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.
IF I_ALV_GD = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* 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
* 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 = IT_JOIN
* 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. " ALV_INTERACTIVE
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 CORRESPONDING FIELDS OF TABLE IT_STUD
WHERE STUDID EQ CUS.
PERFORM IT_I_FCAT.
ENDIF.
GD_REPID = SY-REPID.
IF I_ALV_LT = 'X'.
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 =
* 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.
ENDIF.
IF I_ALV_GD = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* 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 =
* 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 = 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.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& 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 = '12'.
WA_FCAT-SELTEXT_L = 'STUDADD'.
APPEND WA_FCAT TO IT_I_FCAT.
WA_FCAT-FIELDNAME = 'STUDAGE'.
WA_FCAT-COL_POS = '2' .
WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-SELTEXT_L = 'STUDAGE'.
APPEND WA_FCAT TO IT_I_FCAT.
ENDFORM. " IT_I_FCAT
*&---------------------------------------------------------------------*
*& Form I_ALV_GRID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM I_ALV_GRID .
FREE : IT_FCAT,
IT_STUD.
CLEAR : WA_FCAT.
SORT IT_JOIN BY STUDID.
DELETE ADJACENT DUPLICATES FROM IT_JOIN COMPARING STUDID.
PERFORM FIELD_CATLOG_INTERACTIVE .
PERFORM ALV_INTERACTIVE .
ENDFORM. " I_ALV_GRID
No comments:
Post a Comment