Skip to Content
0
Former Member
Jul 14, 2008 at 03:35 PM

regarding alv interactive

22 Views

Hi frnds,

I am working in this ALV but i m unable to get my

secondary list.

Below i m giving my code, frnds plzz help me wht changes to be done.

<code>

&----


*& Report ZTOUR_OPRTRS_GRID

*&

&----


REPORT ZTOUR_OPRTRS_GRID LINE-SIZE 150 NO STANDARD PAGE HEADING.

TYPE-POOLS : SLIS.

TABLES : ZAHOTELM,T001W.

DATA: IT_HOTEL_DATA2 TYPE STANDARD TABLE OF ZHOTEL_CHAR,

WA_HOTEL_DATA TYPE ZHOTEL_CHAR.

CONSTANTS : C_MATNR(5) VALUE 'MATNR'.

DATA : BEGIN OF IT_HOTEL_MAT OCCURS 0,

  • zzarea like zahotelm-zzarea,

ZZHOTEL_NAME LIKE ZAHOTELM-ZZHOTEL_NAME,

MATNR LIKE ZAHOTELM-MATNR,

MAKTX LIKE ZAHOTELM-MAKTX,

END OF IT_HOTEL_MAT.

DATA : BEGIN OF IT_HOTEL OCCURS 0,

ZZHOTEL_NAME LIKE ZAHOTELM-ZZHOTEL_NAME,

END OF IT_HOTEL.

DATA : BEGIN OF IT_T001W OCCURS 0,

WERKS LIKE T001W-WERKS,

NAME1 LIKE T001W-NAME1,

END OF IT_T001W.

DATA : BEGIN OF IT_T001L OCCURS 0,

WERKS LIKE T001L-WERKS,

LGORT LIKE T001L-LGORT,

LGOBE LIKE T001L-LGOBE,

END OF IT_T001L.

DATA : BEGIN OF IT_T001L1 OCCURS 0,

LGORT LIKE T001L-LGORT,

LGOBE LIKE T001L-LGOBE,

END OF IT_T001L1.

CONSTANTS : C_BATCH_STATIC_INFO TYPE C VALUE 'X',

C_WEEK_DAY_CHECKED TYPE C VALUE 'X'.

TYPES : BEGIN OF TY_MATBAT,

MATNR TYPE MCHA-MATNR,

CHARG TYPE MCHA-CHARG,

LGORT TYPE MCHB-LGORT,

END OF TY_MATBAT.

DATA: IT_MAT_BAT TYPE STANDARD TABLE OF ZMAT_BAT,

WA_MAT_BAT TYPE ZMAT_BAT,

IT_BATCH_NOS TYPE STANDARD TABLE OF ZMBATCHNO,

WA_BATCH_NOS TYPE ZMBATCHNO,

IT_MATBAT TYPE STANDARD TABLE OF TY_MATBAT,

WA_MATBAT TYPE TY_MATBAT.

DATA: WA_MATERIALS TYPE ZSTRMAT.

DATA: WA_RETURN TYPE BAPIRETURN.

DATA: IT_MAT_DATE_AVAIL TYPE STANDARD TABLE OF ZMAT_BAT.

DATA: WA_MAT_DATE_AVAIL TYPE ZMAT_BAT.

*SECONDARY LIST DISPLAY TABLE

DATA : IT_MAT_AVAIL_DISPLAY LIKE IT_MAT_DATE_AVAIL,

WA_MAT_AVAIL_DISPLAY TYPE ZMAT_BAT.

DATA: L_TODAT TYPE ZZCHECIN_V,

L_TABIX TYPE SY-TABIX.

DATA: IT_HOTEL_DATA TYPE STANDARD TABLE OF ZHOTEL_CHAR.

DATA: IT_APPLI_LEVEL TYPE STANDARD TABLE OF YAPI_APPL_CONT,

WA_APPLI_LEVEL TYPE YAPI_APPL_CONT.

DATA: IT_ROOM_AVAIL2 TYPE TABLE OF ZROOM_AVAIL,

WA_ROOM_AVAIL TYPE ZROOM_AVAIL.

DATA: V_PLANT TYPE WERKS_D,

V_STOR_LOCTN TYPE LGORT_D.

DATA: WA_TOUR_OPTR TYPE ZTOUR_OPTR.

DATA : BEGIN OF IT_MATNR OCCURS 0,

MATNR LIKE MARA-MATNR,

END OF IT_MATNR.

DATA: FLD(20) TYPE C,

VAL LIKE ZAHOTELM-MATNR,

LV_DAY(2),

LV_MON(2),

LV_YEAR(4),

LV_DATE LIKE SY-DATUM.

*Type Declarations for Field Catalog for Basic List

DATA : I_FLDCAT_HEAD TYPE SLIS_T_FIELDCAT_ALV,

WA_FLDCAT_HEAD TYPE SLIS_FIELDCAT_ALV.

*Type Declarations for Field Catalog for Secondary List

DATA : I_FLDCAT_ITEM TYPE SLIS_T_FIELDCAT_ALV,

WA_FLDCAT_ITEM TYPE SLIS_FIELDCAT_ALV.

*Type Declarations for Displaying Images on Basic Grid

DATA : I_COMMENT TYPE SLIS_T_LISTHEADER,

WA_COMMENT TYPE SLIS_LISTHEADER.

*Type Declarations for Displaying Images on Secondary Grid

DATA : I_COMMENT_SEC TYPE SLIS_T_LISTHEADER,

WA_COMMENT_SEC TYPE SLIS_LISTHEADER.

*Type Declarations for ALV Events for Basic Grid

DATA : I_EVENTS TYPE SLIS_T_EVENT,

WA_EVENT LIKE LINE OF I_EVENTS.

*Type Declarations for ALV Events for Secondary Grid

DATA : I_EVENTS_SEC TYPE SLIS_T_EVENT,

WA_EVENT_SEC LIKE LINE OF I_EVENTS.

*Type Declarations for Layout Design

DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

*Type Declarations for Linking the fields

DATA : WA_KEYINFO TYPE SLIS_KEYINFO_ALV.

DATA : V_DATA(50).

  • Selection screen

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS:

PA_WERKS LIKE T001W-WERKS DEFAULT '9600',

PA_LGORT LIKE T001L-LGORT."ZTOUR OBLIGATORY.

SELECT-OPTIONS :

PA_HOTEL FOR ZAHOTELM-ZZHOTEL_NAME NO INTERVALS OBLIGATORY.

PARAMETERS:

PA_FDATE TYPE SY-DATUM OBLIGATORY,

PA_TDATE TYPE SY-DATUM.

SELECTION-SCREEN END OF BLOCK B1.

  • Initialization

INITIALIZATION.

PERFORM GET_TOUR_OPERATORS.

PERFORM GET_HOTEL_LIST.

PERFORM GET_FLDCAT.

perform GET_EVENTS.

MOVE 'Developed by'(001) TO V_DATA.

AT SELECTION-SCREEN .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_WERKS.

PERFORM FILL_PLANT CHANGING PA_WERKS.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_LGORT.

PERFORM VALUE_HELP CHANGING PA_LGORT.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_HOTEL-LOW.

PERFORM FILL_HOTEL_NAMES CHANGING PA_HOTEL-LOW.

  • Start of selection

START-OF-SELECTION.

V_PLANT = PA_WERKS.

*get hotel name and hotel rooms based on resort area

SELECT MATNR

ZZAREA

ZZHOTEL_NAME

MAKTX

INTO TABLE IT_HOTEL_DATA2

FROM ZAHOTELM

WHERE ZZHOTEL_NAME IN PA_HOTEL.

IF SY-SUBRC = 0.

DELETE IT_HOTEL_DATA2 WHERE ZZHOTEL_NAME IS INITIAL.

SORT IT_HOTEL_DATA2 BY MATNR ZZAREA ZZHOTEL_NAME MAKTX.

DELETE ADJACENT DUPLICATES FROM IT_HOTEL_DATA2 COMPARING MATNR ZZAREA ZZHOTEL_NAME MAKTX.

IT_HOTEL_DATA[] = IT_HOTEL_DATA2[].

ENDIF.

  • Fetch the batch nos created for the

  • material-plant-stor.loc combination

  • if not it_materials[] is initial.

IF NOT IT_HOTEL_DATA[] IS INITIAL.

SELECT MATNR

CHARG

LGORT

APPENDING TABLE IT_MATBAT

FROM MCHB

FOR ALL ENTRIES IN IT_HOTEL_DATA

WHERE MATNR = IT_HOTEL_DATA-MATNR

AND WERKS = V_PLANT

AND LGORT = PA_LGORT.

SORT IT_MATBAT BY MATNR CHARG.

ENDIF.

*

  • Determine the batch nos for the date range.

  • loop at it_materials into wa_materials.

REFRESH IT_MATNR.

LOOP AT IT_HOTEL_DATA INTO WA_HOTEL_DATA.

CALL FUNCTION 'Z_BATCH_FUNCTION_521'

EXPORTING

FROMDATE = PA_FDATE

TODATE = PA_TDATE

MONDAY = C_WEEK_DAY_CHECKED

TUESDAY = C_WEEK_DAY_CHECKED

WEDNESDAY = C_WEEK_DAY_CHECKED

THURSDAY = C_WEEK_DAY_CHECKED

FRIDAY = C_WEEK_DAY_CHECKED

SATURDAY = C_WEEK_DAY_CHECKED

SUNDAY = C_WEEK_DAY_CHECKED

STATICINFO = C_BATCH_STATIC_INFO

TABLES

BATCHTAB = IT_BATCH_NOS

EXCEPTIONS

OTHERS = 1.

SORT IT_BATCH_NOS BY CHARG.

  • Pickup only those batch nos which exist in MCHB

LOOP AT IT_BATCH_NOS INTO WA_BATCH_NOS.

READ TABLE IT_MATBAT INTO WA_MATBAT

WITH KEY MATNR = WA_HOTEL_DATA-MATNR

CHARG = WA_BATCH_NOS-CHARG

BINARY SEARCH.

IF SY-SUBRC = 0.

WA_MAT_BAT-MATNR = WA_HOTEL_DATA-MATNR.

WA_MAT_BAT-WERKS = V_PLANT.

WA_MAT_BAT-LGORT = WA_MATBAT-LGORT.

WA_MAT_BAT-CHARG = WA_BATCH_NOS-CHARG.

APPEND WA_MAT_BAT TO IT_MAT_BAT.

IT_MATNR-MATNR = WA_HOTEL_DATA-MATNR.

APPEND IT_MATNR.

CLEAR IT_MATNR.

ENDIF.

ENDLOOP.

REFRESH IT_BATCH_NOS.

CLEAR : IT_BATCH_NOS,

WA_MATERIALS.

ENDLOOP.

*

  • Obtain the Material/Batch avialability figures

CALL FUNCTION 'Z_GET_MAT_BAT_AVAILABILITY'

TABLES

IT_MAT_BAT = IT_MAT_BAT

EXCEPTIONS

NO_MAT_BAT = 1

OTHERS = 2.

  • if sy-subrc = 1.

  • wa_return-type = 'E'.

  • wa_return-code = 'CHARG'.

  • wa_return-message = 'No Materials/Batches found'.

  • append wa_return to it_return.

  • clear: wa_return.

  • endif.

*

IT_MAT_DATE_AVAIL[] = IT_MAT_BAT[].

*calculation of percentage of number of rooms available

LOOP AT IT_MAT_DATE_AVAIL INTO WA_MAT_DATE_AVAIL.

IF WA_MAT_DATE_AVAIL-GR_QTY = 0.

WA_MAT_DATE_AVAIL-AVAIL_PERCENT = 0.

ELSE.

WA_MAT_DATE_AVAIL-AVAIL_PERCENT = WA_MAT_DATE_AVAIL-AV_QTY * 100 / WA_MAT_DATE_AVAIL-GR_QTY.

ENDIF.

MODIFY IT_MAT_DATE_AVAIL FROM WA_MAT_DATE_AVAIL.

CLEAR WA_MAT_DATE_AVAIL.

ENDLOOP.

SORT IT_MAT_DATE_AVAIL BY MATNR.

PERFORM GET_LAYOUT.

PERFORM GET_KEYINFO.

  • End of selection

END-OF-SELECTION.

PERFORM DISP_BASIC_LIST.

&----


*& Form GET_HOTEL_LIST

&----


  • text

----


FORM GET_HOTEL_LIST.

SELECT ZZHOTEL_NAME

MATNR

MAKTX

INTO TABLE IT_HOTEL_MAT

FROM ZAHOTELM.

IF SY-SUBRC = 0.

DELETE IT_HOTEL_MAT WHERE ZZHOTEL_NAME IS INITIAL.

SORT IT_HOTEL_MAT BY ZZHOTEL_NAME MATNR MAKTX.

DELETE ADJACENT DUPLICATES FROM IT_HOTEL_MAT COMPARING ZZHOTEL_NAME MATNR MAKTX.

ENDIF.

REFRESH IT_HOTEL.

LOOP AT IT_HOTEL_MAT.

AT NEW ZZHOTEL_NAME.

IT_HOTEL-ZZHOTEL_NAME = IT_HOTEL_MAT-ZZHOTEL_NAME.

APPEND IT_HOTEL.

CLEAR IT_HOTEL.

ENDAT.

ENDLOOP.

ENDFORM. "get_hotel_list

&----


*& Form GET_TOUR_OPERATORS

&----


  • text

----


FORM GET_TOUR_OPERATORS .

SELECT WERKS

LGORT

LGOBE

FROM T001L

INTO TABLE IT_T001L

WHERE WERKS = PA_WERKS.

IF SY-SUBRC = 0.

SORT IT_T001L BY WERKS LGORT.

DELETE ADJACENT DUPLICATES FROM IT_T001L COMPARING WERKS LGORT.

DELETE IT_T001L WHERE LGOBE IS INITIAL.

LOOP AT IT_T001L.

IT_T001L1-LGORT = IT_T001L-LGORT.

IT_T001L1-LGOBE = IT_T001L-LGOBE.

APPEND IT_T001L1.

ENDLOOP.

ENDIF.

ENDFORM. " GET_TOUR_OPERATORS

&----


*& Form FILL_HOTEL_NAMES

&----


----


  • <--P_PA_HOTEL_LOW text

----


FORM FILL_HOTEL_NAMES CHANGING P_PA_HOTEL_LOW.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'ZZHOTEL_NAME'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'PA_HOTEL-LOW'

STEPL = 2

WINDOW_TITLE = 'Hotels'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_HOTEL

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

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. " FILL_HOTEL_NAMES

&----


*& Form VALUE_HELP

&----


  • text

----


  • <--P_PA_LGORT text

----


FORM VALUE_HELP CHANGING P_PA_LGORT.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'LGORT'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'PA_LGORT'

STEPL = 2

WINDOW_TITLE = 'Storage location'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_T001L1

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

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. " VALUE_HELP

&----


*& Form FILL_PLANT

&----


  • text

----


  • <--P_PA_WERKS text

----


FORM FILL_PLANT CHANGING P_PA_WERKS.

SELECT WERKS

NAME1

FROM T001W

INTO TABLE IT_T001W.

IF SY-SUBRC = 0.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'WERKS'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'PA_WERKS'

STEPL = 2

WINDOW_TITLE = 'Plant'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = IT_T001W

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

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. " FILL_PLANT

&----


*& Form GET_FLDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_FLDCAT .

WA_FLDCAT_HEAD-FIELDNAME = 'MATNR'.

WA_FLDCAT_HEAD-COL_POS = '1'.

  • WA_FLDCAT_HEAD-JUST = 'C'.

WA_FLDCAT_HEAD-OUTPUTLEN = '18'.

  • WA_FLDCAT_HEAD-DDICTXT = 'M'.

WA_FLDCAT_HEAD-SELTEXT_L = 'Materials'.

WA_FLDCAT_HEAD-HOTSPOT = 'X'.

APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.

CLEAR WA_FLDCAT_HEAD .

WA_FLDCAT_ITEM-FIELDNAME = LV_DATE.

WA_FLDCAT_ITEM-COL_POS = '1'.

WA_FLDCAT_ITEM-JUST = 'C'.

WA_FLDCAT_ITEM-OUTPUTLEN = '8'.

APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.

WA_FLDCAT_ITEM-FIELDNAME = 'GR_QTY'(005).

WA_FLDCAT_ITEM-COL_POS = '2'.

WA_FLDCAT_ITEM-JUST = 'C'.

WA_FLDCAT_ITEM-OUTPUTLEN = '13'.

WA_FLDCAT_ITEM-DDICTXT = 'M'.

APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.

WA_FLDCAT_ITEM-FIELDNAME = 'AV_QTY'(005).

WA_FLDCAT_ITEM-COL_POS = '3'.

WA_FLDCAT_ITEM-JUST = 'C'.

WA_FLDCAT_ITEM-OUTPUTLEN = '13'.

WA_FLDCAT_ITEM-DDICTXT = 'M'.

APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.

WA_FLDCAT_ITEM-FIELDNAME = 'BOOK_QTY'(005).

WA_FLDCAT_ITEM-COL_POS = '4'.

WA_FLDCAT_ITEM-JUST = 'C'.

WA_FLDCAT_ITEM-OUTPUTLEN = '13'.

WA_FLDCAT_ITEM-DDICTXT = 'M'.

APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.

WA_FLDCAT_ITEM-FIELDNAME = 'AVAIL_PERCENT'(005).

WA_FLDCAT_ITEM-COL_POS = '5'.

WA_FLDCAT_ITEM-JUST = 'C'.

WA_FLDCAT_ITEM-OUTPUTLEN = '10'.

WA_FLDCAT_ITEM-DDICTXT = 'M'.

APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.

ENDFORM. " GET_FLDCAT

&----


*& Form DISP_BASIC_LIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISP_BASIC_LIST .

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 = WA_LAYOUT

IT_FIELDCAT = I_FLDCAT_HEAD

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = I_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

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = IT_HOTEL_DATA

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. " DISP_BASIC_LIST

&----


*& Form GET_LAYOUT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_LAYOUT .

WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH

WA_LAYOUT-ZEBRA = 'X'. "PUTTING ZEBRA COLORS

WA_LAYOUT-INFO_FIELDNAME = 'COLOR'(034). "APPLYING COLORS TO ROWS

ENDFORM. " GET_LAYOUT

&----


*& Form GET_EVENTS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_EVENTS .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = I_EVENTS

EXCEPTIONS

LIST_TYPE_WRONG = 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.

*--Calling the User Defined sub-routines for ALV Events

IF NOT I_EVENTS[] IS INITIAL.

READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.

READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'END_OF_LIST'.

WA_EVENT-FORM = 'END_OF_LIST'.

MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.

READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.

WA_EVENT-FORM = 'USER_COMMAND'.

MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.

ENDIF.

ENDFORM. " GET_EVENTS

&----


*& Form GENERATE_USERCOMMAND_HEADER

&----


  • Displaying Header-Text and Logo on Grid

----


FORM TOP_OF_PAGE.

CLEAR I_COMMENT[].

WA_COMMENT-TYP = 'H'.

WA_COMMENT-INFO = ''(032).

APPEND WA_COMMENT TO I_COMMENT.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_COMMENT

I_LOGO = 'ENJOYSAP_LOGO'.

  • I_END_OF_LIST_GRID = 'X'.

ENDFORM. " GENERATE_USERCOMMAND

&----


*& Form GENERATE_USERCOMMAND_FOOTER

&----


  • Displaying Footer-Text

----


FORM END_OF_LIST .

CLEAR I_COMMENT[].

WA_COMMENT-TYP = 'S'.

WA_COMMENT-KEY = V_DATA.

WA_COMMENT-INFO = 'Sathish Borancha'(033).

APPEND WA_COMMENT TO I_COMMENT.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_COMMENT

  • I_LOGO = ''

I_END_OF_LIST_GRID = 'X'.

ENDFORM. " GENERATE_USERCOMMAND_FOOTER

FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM

P_SELFIELD TYPE SLIS_SELFIELD.

CASE P_UCOMM.

WHEN '&IC1'. "DOUBLE CLICK Func-Code

READ TABLE IT_HOTEL_DATA INTO WA_HOTEL_DATA INDEX P_SELFIELD-TABINDEX.

REFRESH IT_MAT_AVAIL_DISPLAY.

LOOP AT IT_MAT_DATE_AVAIL INTO WA_MAT_DATE_AVAIL WHERE MATNR = WA_HOTEL_DATA-MATNR.

MODIFY IT_MAT_DATE_AVAIL FROM WA_MAT_DATE_AVAIL INDEX SY-TABIX.

IT_MAT_AVAIL_DISPLAY[] = IT_MAT_DATE_AVAIL[].

*MOVE-CORRESPONDING IT_MAT_DATE_AVAIL TO IT_MAT_AVAIL_DISPLAY .

APPEND wa_MAT_AVAIL_DISPLAY to IT_MAT_AVAIL_DISPLAY .

CLEAR IT_MAT_AVAIL_DISPLAY .

ENDLOOP.

*--Getting the ALV Events of Secondary List

PERFORM GET_EVENTS_SEC.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 'ZTOUR_OPRTRS_GRID'

  • 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 = I_FLDCAT_ITEM

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = I_EVENTS_SEC

  • 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

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = IT_MAT_AVAIL_DISPLAY

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.

ENDCASE.

ENDFORM.

&----


*& Form GET_EVENTS_SEC

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_EVENTS_SEC .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

  • EXPORTING

  • I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = I_EVENTS_SEC

EXCEPTIONS

LIST_TYPE_WRONG = 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.

**--Calling user-defined sub-routines for Secondary List

  • IF NOT I_EVENTS_SEC[] IS INITIAL.

  • READ TABLE I_EVENTS_SEC INTO WA_EVENT_SEC WITH KEY NAME = 'TOP_OF_PAGE'.

  • WA_EVENT_SEC-FORM = 'GENERATE_USERCOMMAND_H_SEC'.

  • MODIFY I_EVENTS_SEC FROM WA_EVENT_SEC INDEX SY-TABIX.

*

  • READ TABLE I_EVENTS_SEC INTO WA_EVENT_SEC WITH KEY NAME = 'END_OF_LIST'.

  • WA_EVENT_SEC-FORM = 'GENERATE_USERCOMMAND_F_SEC'.

  • MODIFY I_EVENTS_SEC FROM WA_EVENT_SEC INDEX SY-TABIX.

  • ENDIF.

ENDFORM. " GET_EVENTS_SEC

&----


*& Form GET_KEYINFO

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_KEYINFO .

*--Linking the Basic List to Secondary List

WA_KEYINFO-HEADER01 = C_MATNR.

WA_KEYINFO-ITEM01 = C_MATNR.

ENDFORM. " GET_KEYINFO

</code>

Frnds its urgent please help me.

regards,

sanjay