Go on link..

link us with ...

Monday, December 13, 2010

Big ALV Report Classical / Interactive

*&---------------------------------------------------------------------*
*& Report ZTR_DEMO_REPORT12 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

*Report : ALV Report Classical / Interactive

REPORT ZTR_DEMO_REPORT12 .

TYPE-POOLS : SLIS.

TABLES : VBAK , VBAP , KNA1 .

DATA : GD_REPID LIKE SY-REPID .

***TYPE Declaration .

TYPES : BEGIN OF ST_VBAK ,

VBELN TYPE VBAK-VBELN,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
BSTNK TYPE VBAK-BSTNK,
VTWEG TYPE VBAK-VTWEG,
SPART TYPE VBAK-SPART,
VKGRP TYPE VBAK-VKGRP,
VKBUR TYPE VBAK-VKBUR,
GSBER TYPE VBAK-GSBER,
KUNNR TYPE VBAK-KUNNR,

END OF ST_VBAK ,

BEGIN OF ST_VBAP ,

VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
ARKTX TYPE VBAP-ARKTX,
KWMENG TYPE VBAP-KWMENG,

END OF ST_VBAP,

BEGIN OF ST_FINAL ,

VBELN TYPE VBAK-VBELN,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
BSTNK TYPE VBAK-BSTNK,
VTWEG TYPE VBAK-VTWEG,
SPART TYPE VBAK-SPART,
VKGRP TYPE VBAK-VKGRP,
VKBUR TYPE VBAK-VKBUR,
GSBER TYPE VBAK-GSBER,
KUNNR TYPE VBAK-KUNNR,
NAME1 TYPE KNA1-NAME1,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
ARKTX TYPE VBAP-ARKTX,
KWMENG TYPE VBAP-KWMENG,

END OF ST_FINAL,

BEGIN OF ST_KNA1 ,

KUNNR TYPE KNA1-KUNNR,
NAME1 TYPE KNA1-NAME1,

END OF ST_KNA1.

**** Field Catlog Declaration

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.

******DATA Declaration .

***Work area declaration .

DATA : WA_VBAK TYPE ST_VBAK,
WA_VBAP TYPE ST_VBAP,
WA_KNA1 TYPE ST_KNA1,
WA_FINAL TYPE ST_FINAL.

***Internal table declaration .

DATA : IT_VBAK LIKE STANDARD TABLE OF WA_VBAK,
IT_VBAP LIKE STANDARD TABLE OF WA_VBAP,
IT_KNA1 LIKE STANDARD TABLE OF WA_KNA1,

IT_FINAL LIKE STANDARD TABLE OF WA_FINAL .

*** Selection-screen design

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE T1 .

SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.

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 .

***event : INITILIZATION .

INITIALIZATION.

T1 = 'Selection-screen design' .
T2 = 'ALV Report Interactive / Classical ' .

***Event : AT SELECTION-SCREEN ON FIELD .

AT SELECTION-SCREEN ON S_VBELN .

IF S_VBELN IS INITIAL.
MESSAGE 'Please enter a value' TYPE 'E'.
ENDIF.

***START-OF-SELECTION .

START-OF-SELECTION.

PERFORM GETDATA .

PERFORM FIELD_CATLOG .

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.

***END-OF-SELECTION .

*&---------------------------------------------------------------------*
*& Form GETDATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM GETDATA . SELECT VBELN VBTYP NETWR VKORG BSTNK VTWEG SPART VKGRP VKBUR GSBER KUNNR FROM VBAK INTO TABLE IT_VBAK WHERE VBELN IN S_VBELN . IF IT_VBAK[] IS NOT INITIAL. SELECT KUNNR NAME1 FROM KNA1 INTO TABLE IT_KNA1 FOR ALL ENTRIES IN IT_VBAK WHERE KUNNR EQ IT_VBAK-KUNNR. SELECT VBELN POSNR MATNR ARKTX KWMENG FROM VBAP INTO TABLE IT_VBAP FOR ALL ENTRIES IN IT_VBAK WHERE VBELN EQ IT_VBAK-VBELN. ENDIF. LOOP AT IT_VBAP INTO WA_VBAP. MOVE : WA_VBAP-VBELN TO WA_FINAL-VBELN, WA_VBAP-POSNR TO WA_FINAL-POSNR, WA_VBAP-MATNR TO WA_FINAL-MATNR, WA_VBAP-ARKTX TO WA_FINAL-ARKTX, WA_VBAP-KWMENG TO WA_FINAL-KWMENG. APPEND WA_FINAL TO IT_FINAL. ENDLOOP. LOOP AT IT_FINAL INTO WA_FINAL. READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_FINAL-VBELN . IF SY-SUBRC EQ 0 . MOVE : WA_VBAK-VBTYP TO WA_FINAL-VBTYP, WA_VBAK-NETWR TO WA_FINAL-NETWR, WA_VBAK-VKORG TO WA_FINAL-VKORG, WA_VBAK-BSTNK TO WA_FINAL-BSTNK, WA_VBAK-VTWEG TO WA_FINAL-VTWEG, WA_VBAK-SPART TO WA_FINAL-SPART, WA_VBAK-VKGRP TO WA_FINAL-VKGRP, WA_VBAK-VKBUR TO WA_FINAL-VKBUR, WA_VBAK-GSBER TO WA_FINAL-GSBER, WA_VBAK-KUNNR TO WA_FINAL-KUNNR. ENDIF. READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_FINAL-KUNNR . IF SY-SUBRC EQ 0 . MOVE : WA_KNA1-NAME1 TO WA_FINAL-NAME1. ENDIF. MODIFY IT_FINAL FROM WA_FINAL . ENDLOOP. ENDFORM. " GETDATA *&---------------------------------------------------------------------* *& Form C_ALV_LIST *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM C_ALV_LIST . PERFORM ALV_LIST. ENDFORM. " C_ALV_LIST *&---------------------------------------------------------------------* *& Form Field_catlog *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM FIELD_CATLOG . WA_FCAT-FIELDNAME = 'VBELN'. WA_FCAT-COL_POS = '1' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Sales Order'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VBTYP'. WA_FCAT-COL_POS = '2' . WA_FCAT-OUTPUTLEN = '1'. WA_FCAT-SELTEXT_L = 'SD document category'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'NETWR'. WA_FCAT-COL_POS = '3' . WA_FCAT-OUTPUTLEN = '15'. WA_FCAT-SELTEXT_L = 'Net Value'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VKORG'. WA_FCAT-COL_POS = '4' . WA_FCAT-OUTPUTLEN = '4'. WA_FCAT-SELTEXT_L = 'Sales Organization'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'BSTNK'. WA_FCAT-COL_POS = '5' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'purchase order number'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VTWEG'. WA_FCAT-COL_POS = '6' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Distribution Channel'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'SPART'. WA_FCAT-COL_POS = '7' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Division'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VKGRP'. WA_FCAT-COL_POS = '8' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Sales group'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VKBUR'. WA_FCAT-COL_POS = '9' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Sales office'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'GSBER'. WA_FCAT-COL_POS = '10' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Business Area'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'KUNNR'. WA_FCAT-COL_POS = '11' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'SOLD TO PARTY'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'NAME1'. WA_FCAT-COL_POS = '12' . WA_FCAT-OUTPUTLEN = '20'. WA_FCAT-SELTEXT_L = 'Customer Number'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'POSNR'. WA_FCAT-COL_POS = '13' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Item No'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'MATNR'. WA_FCAT-COL_POS = '14' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Material'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'ARKTX'. WA_FCAT-COL_POS = '15' . WA_FCAT-OUTPUTLEN = '50'. WA_FCAT-SELTEXT_L = 'Material Description'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'KWMENG'. WA_FCAT-COL_POS = '16' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Sales Order Qty'. APPEND WA_FCAT TO IT_FCAT. ENDFORM. " Field_catlog *&---------------------------------------------------------------------* *& Form alv_list *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM ALV_LIST . 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 = * 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_FINAL * 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. " alv_list

*&---------------------------------------------------------------------*
*& Form C_ALV_GRID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM C_ALV_GRID . GD_REPID = SY-REPID . 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 = * 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_FINAL * 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_VBAP. SORT IT_FINAL BY VBELN. DELETE ADJACENT DUPLICATES FROM IT_FINAL COMPARING VBELN. PERFORM FIELD_CATLOG_INTERACTIVE . PERFORM ALV_INTERACTIVE . ENDFORM. " I_ALV_LIST *&---------------------------------------------------------------------* *& Form ALV_Interactive *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM ALV_INTERACTIVE . GD_REPID = SY-REPID . 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_FINAL * 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_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_FINAL
* 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 FIELD_CATLOG_interactive
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM FIELD_CATLOG_INTERACTIVE . WA_FCAT-FIELDNAME = 'VBELN'. WA_FCAT-COL_POS = '1' . WA_FCAT-OUTPUTLEN = '10'. WA_FCAT-SELTEXT_L = 'Sales Order'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VBTYP'. WA_FCAT-COL_POS = '2' . WA_FCAT-OUTPUTLEN = '1'. WA_FCAT-SELTEXT_L = 'SD document category'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'NETWR'. WA_FCAT-COL_POS = '3' . WA_FCAT-OUTPUTLEN = '15'. WA_FCAT-SELTEXT_L = 'Net Value'. APPEND WA_FCAT TO IT_FCAT. WA_FCAT-FIELDNAME = 'VKORG'. WA_FCAT-COL_POS = '4' . WA_FCAT-OUTPUTLEN = '4'. WA_FCAT-SELTEXT_L = 'Sales Organization'. 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 INTERACTIVE_FORM *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * -->USER_COMMANtext
* -->SEL text
*---------------------------------------------------------------------*
FORM INTERACTIVE_FORM USING USER_COMMAND LIKE SY-UCOMM
SEL TYPE SLIS_SELFIELD.

DATA: CUS(10) TYPE N,
SAL(10).

IF SEL-FIELDNAME = 'VBELN'.

CUS = SEL-VALUE.

SELECT VBELN
POSNR
MATNR
ARKTX
KWMENG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN EQ CUS.

PERFORM IT_I_FCAT.

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_VBAP
* 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_VBAP
* 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.

ENDIF.

ENDFORM. "INTERACTIVE_FORM
*&---------------------------------------------------------------------*
*& Form IT_I_FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM IT_I_FCAT . WA_I_FCAT-FIELDNAME = 'POSNR'. WA_I_FCAT-COL_POS = '1' . WA_I_FCAT-OUTPUTLEN = '10'. WA_I_FCAT-SELTEXT_L = 'Item No'. APPEND WA_I_FCAT TO IT_I_FCAT. WA_I_FCAT-FIELDNAME = 'MATNR'. WA_I_FCAT-COL_POS = '2' . WA_I_FCAT-OUTPUTLEN = '10'. WA_I_FCAT-SELTEXT_L = 'Material'. APPEND WA_I_FCAT TO IT_I_FCAT. WA_I_FCAT-FIELDNAME = 'ARKTX'. WA_I_FCAT-COL_POS = '3' . WA_I_FCAT-OUTPUTLEN = '50'. WA_I_FCAT-SELTEXT_L = 'Material Description'. APPEND WA_I_FCAT TO IT_I_FCAT. WA_I_FCAT-FIELDNAME = 'KWMENG'. WA_I_FCAT-COL_POS = '4' . WA_I_FCAT-OUTPUTLEN = '10'. WA_I_FCAT-SELTEXT_L = 'Sales Order Qty'. APPEND WA_I_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_VBAP.

SORT IT_FINAL BY VBELN.
DELETE ADJACENT DUPLICATES FROM IT_FINAL COMPARING VBELN.
PERFORM FIELD_CATLOG_INTERACTIVE .
PERFORM ALV_INTERACTIVE .

ENDFORM. " I_ALV_GRID

No comments:

link us...

For Visitors

if you want to publish or Add something on ERP, SAP , SAP FUNCTIONAL, SAP ABAP then mail us along with your email-id. contain must be yours

email-id :- avinashkr_raj@yahoo.com(any email)

email-id :- avinaskr_raj.abap@blogger.com ( use only gmail)