Powered By

Free XML Skins for Blogger

Powered by Blogger

Thursday, February 12, 2009

using alv grid real time implementation

REPORT ZALV .

type-pools : slis.
tables : spfli,SFLIGHT.

data : begin of itab occurs 0,
carrid like spfli-carrid,
connid like spfli-connid,
end of itab.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.

data : g_fieldcat type slis_t_fieldcat_alv,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
g_repid like sy-repid,
GT_EVENTS TYPE SLIS_T_EVENT,
g_layout type slis_layout_alv,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV,
G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME.


data : itab1 like sflight occurs 0 with header line.

g_repid = sy-repid.


select carrid connid into corresponding fields of table itab from
spfli.

G_TABNAME_HEADER = 'ITAB'.
G_TABNAME_ITEM = 'ITAB1'.

CLEAR GS_KEYINFO.
GS_KEYINFO-HEADER01 = 'CARRID'.
GS_KEYINFO-ITEM01 = 'CARRID'.


LOOP AT ITAB.
SELECT * FROM SFLIGHT WHERE CARRID = ITAB-CARRID.
MOVE-CORRESPONDING SFLIGHT TO ITAB1.
APPEND ITAB1.
CLEAR ITAB1.
ENDSELECT.
IF SY-SUBRC EQ 0.
EXIT.
ENDIF.
ENDLOOP.

PERFORM E03_EVENTTAB_BUILD USING GT_EVENTS[].

perform pc_fld using :
1 1 'CARRID' 'CARRIER' 10 ' H' 'ITAB',
1 2 'CONNID' 'CONNECTIONID' 04 ' H' 'ITAB',
2 1 'FLDATE' 'FLIGHT DET' 10 ' H' 'ITAB1',
2 2 'PRICE' 'PRICING DET' 20 ' H' 'ITAB1'.

GS_LAYOUT-F2CODE = '&ETA'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = g_repid
* I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'ABCDEF'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = G_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
* IT_EVENT_EXIT =
*I_TABNAME_HEADER = G_TABNAME_HEADER
*I_TABNAME_ITEM = G_TABNAME_ITEM
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
*IS_KEYINFO = GS_KEYINFO
* IS_PRINT =
* IS_REPREP_ID =
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB
*T_OUTTAB_ITEM = ITAB1
* 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 ABCDEF using r_ucomm like sy-ucomm rs_selfield type
slis_selfield.
* -----------------------------------------------------------*
case r_ucomm.
when '&IC1'.
read table itab index rs_selfield-tabindex.
if sy-subrc eq 0.
write : / 'sdfdsf'.
endif.
CLEAR r_ucomm.
endcase.

endform.


*&---------------------------------------------------------------------*
*& Form pc_fld
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_1 text
* -->P_1 text
* -->P_0057 text
* -->P_0058 text
* -->P_10 text
* -->P_0060 text
* -->P_0061 text
*----------------------------------------------------------------------*

FORM pc_fld USING L P F D O R T.

DATA : T_FLD TYPE SLIS_FIELDCAT_ALV.

CLEAR T_FLD.

MOVE : L TO T_FLD-ROW_POS.
MOVE : P TO T_FLD-COL_POS.
MOVE : F TO T_FLD-FIELDNAME.
MOVE D TO : T_FLD-SELTEXT_L,
T_FLD-SELTEXT_M,
T_FLD-SELTEXT_S.
MOVE 'L' TO T_FLD-DDICTXT.
MOVE O TO T_FLD-OUTPUTLEN.
MOVE T TO T_FLD-TABNAME.
MOVE ' ' TO T_FLD-DO_SUM.

APPEND T_FLD TO G_FIELDCAT.

ENDFORM. " pc_fld
*---------------------------------------------------------------------*
* FORM E03_EVENTTAB_BUILD *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E03_LT_EVENTS *
*---------------------------------------------------------------------*
FORM E03_EVENTTAB_BUILD USING E03_LT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = E03_LT_EVENTS.
READ TABLE E03_LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO E03_LT_EVENTS.
ENDIF.
ENDFORM.

No comments:

Archives