Sunteți pe pagina 1din 3

REPORT ZREPORT_INTERACTIVE10.

tables : zstd_details.
TABLES : zstd_remarks.

***************************************************data declaration

DATA : it_zstd_details TYPE STANDARD TABLE OF zstd_details,


wa_zstd_details TYPE zstd_details,
it_zstd_remarks TYPE STANDARD TABLE OF zstd_remarks,
wa_zstd_remarks TYPE zstd_remarks,
it_fcat type slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
wa_layout type slis_layout_alv.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.


SELECT-OPTIONS : std_id for zstd_details-std_id.
SELECTION-SCREEN end of BLOCK b1.

***********************************************************start of selection
SELECT * from zstd_details into TABLE it_zstd_details
WHERE std_id in std_id.

*********************************************************fieldcatalog designing
wa_fcat-COL_POS = '1'.
wa_fcat-FIELDNAME = 'std_id'.
wa_fcat-SELTEXT_L = 'student id'.
wa_fcat-HOTSPOT = 'X'.
wa_fcat-NO_ZERO = 'X'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '2'.
wa_fcat-FIELDNAME = 'std_class'.
wa_fcat-SELTEXT_L = 'student class'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '3'.
wa_fcat-FIELDNAME = 'std_sec'.
wa_fcat-SELTEXT_L = 'student section'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '4'.
wa_fcat-FIELDNAME = 'std_name'.
wa_fcat-SELTEXT_L = 'student name'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '5'.
wa_fcat-FIELDNAME = 'std_adress'.
wa_fcat-SELTEXT_L = 'student adress'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '6'.
wa_fcat-FIELDNAME = 'std_caste'.
wa_fcat-SELTEXT_L = 'student caste'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '7'.
wa_fcat-FIELDNAME = 'std_city'.
wa_fcat-SELTEXT_L = 'student city'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '8'.
wa_fcat-FIELDNAME = 'std_country'.
wa_fcat-SELTEXT_L = 'student country'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_fcat-COL_POS = '9'.
wa_fcat-FIELDNAME = 'std_pin_code'.
wa_fcat-SELTEXT_L = 'student pin code'.
APPEND wa_fcat to it_fcat.
CLEAR wa_fcat.

wa_layout-ZEBRA = 'X'.
wa_layout-COLWIDTH_OPTIMIZE = 'X'.

*****************************************************display the data


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fcat
TABLES
T_OUTTAB = it_zstd_details
.
IF SY-SUBRC <> 0.
MESSAGE 'alv output not possible' type 'E'.
ENDIF.

form USER_COMMAND using r_ucomm TYPE sy-ucomm


r_selfield TYPE slis_selfield.

CASE r_ucomm.

when '&IC1'.

** BREAK-POINT.

READ TABLE it_zstd_details INTO wa_zstd_details INDEX r_selfield-tabindex.


if sy-subrc = 0.

SHIFT wa_zstd_details-std_id LEFT DELETING LEADING '0'.

SELECT * FROM zstd_remarks


INTO TABLE it_zstd_remarks
WHERE std_id = wa_zstd_details-std_id.

REFRESH it_fcat.
CLEAR wa_fcat.
wa_fcat-COL_POS = '1'.
wa_fcat-FIELDNAME = 'STD_ID'.
wa_fcat-SELTEXT_L ='student id'.
APPEND wa_fcat to it_fcat.

CLEAR wa_fcat.
wa_fcat-COL_POS = '2'.
wa_fcat-FIELDNAME = 'STD_TOTAL_MARKS'.
wa_fcat-SELTEXT_L ='student total marks'.
APPEND wa_fcat to it_fcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING

IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fcat

TABLES
T_OUTTAB = it_zstd_remarks.

endif.
endcase.

endform.