Skip to Content
author's profile photo Former Member
Former Member

SLIS_FILEDCAT_ALV

can Anybody explain me abt this?

SLIS_FILEDCAT_ALV

SLIS_T_FIELDCAT_ALV

SLIS_T_EVENT

SLIS_TLISTHEADER

what is the purpose of this?

Regards,

pandu.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Dec 03, 2007 at 07:27 AM

    Hi,

    slis_t_fieldcat_ alv is used to create a fielcatlogue table

    slis_fieldcat_ alv is used to create a work area .

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 07:32 AM

    hI

    SLIS is the type library for ALV grid.

    If you’ll use the ALV you have to add TYPE-POOLS : SLIS. command at the beginning of your code.

    Consider these :

    slis_t_fieldcat_alv is containing “_t_”

    It means that it is an internal table and slis_fieldcat_alv is header line of that.

    Here is a practical example for alv grid :

    Just think that you have an internal table named ‘ITAB’ to show.

    The following are programs for different types of ALV.....

    u can refer to these programs and get concept of lal types of ALV....

    *******************************************

    Alv basics

    REPORT ZALV .

    TABLES : VBAP.

    TYPE-POOLS : SLIS.

    DATA : BEGIN OF ITAB OCCURS 0,

    VBELN LIKE VBAP-VBELN,

    POSNR LIKE VBAP-POSNR,

    ERNAM LIKE VBAP-ERNAM,

    ERDAT LIKE VBAP-ERDAT.

    DATA : END OF ITAB.

    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.

    START-OF-SELECTION.

    SELECT VBELN

    POSNR

    ERNAM

    ERDAT

    FROM VBAP

    INTO CORRESPONDING FIELDS OF TABLE ITAB

    WHERE VBELN IN S_VBELN.

    PERFORM MODIFY_CAT.

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

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

    • 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.

    *END-OF-SELECTION.

    *LOOP AT ITAB.

    *WRITE : / ITAB-VBELN,

    • ITAB-POSNR,

    • ITAB-ERNAM,

    • ITAB-ERDAT.

    *ENDLOOP.

    &----


    *& Form MODIFY_CAT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM MODIFY_CAT .

    WA_FIELDCAT-TABNAME = 'ITAB'..

    WA_FIELDCAT-FIELDNAME = 'VBELN'.

    WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.

    WA_FIELDCAT-COL_POS = 1.

    WA_FIELDCAT-OUTPUTLEN = 10.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'ITAB'..

    WA_FIELDCAT-FIELDNAME = 'POSNR'.

    WA_FIELDCAT-SELTEXT_L = 'ITEM'.

    WA_FIELDCAT-COL_POS = 2.

    WA_FIELDCAT-OUTPUTLEN = 6.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'ITAB'..

    WA_FIELDCAT-FIELDNAME = 'ERNAM'.

    WA_FIELDCAT-SELTEXT_L = 'PERSON NAME'.

    WA_FIELDCAT-COL_POS = 3.

    WA_FIELDCAT-OUTPUTLEN = 12.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'ITAB'..

    WA_FIELDCAT-FIELDNAME = 'ERDAT'.

    WA_FIELDCAT-SELTEXT_L = 'DATE'.

    WA_FIELDCAT-COL_POS = 4.

    WA_FIELDCAT-OUTPUTLEN = 8.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_LAYOUT-ZEBRA = 'X'.

    *WA_LAYOUT-INFO_FIELDNAME = 'COLOR'.

    ENDFORM. " MODIFY_CAT

    ****************************************************

    BLOCK ALV

    REPORT ZALV1.

    ******************TABLE DECLARATION***********************************

    TABLES : VBAP. " tables declaration

    *****************TYPE POOLS*******************************************

    TYPE-POOLS : SLIS. " slis type pool

    *****************INTERNAL TABLE DECLARATION***************************

    DATA : BEGIN OF IT_VBAP OCCURS 0,

    " internal table for sales document item

    VBELN LIKE VBAP-VBELN, " sales document

    POSNR LIKE VBAP-POSNR, " document item

    ERNAM LIKE VBAP-ERNAM,

    " name of the person who created the object

    ERDAT LIKE VBAP-ERDAT, " date on which the record was created

    MATNR LIKE VBAP-MATNR. " material number

    DATA : END OF IT_VBAP.

    DATA : BEGIN OF IT_MARA OCCURS 0, " general material data

    MATNR LIKE MARA-MATNR, " material number

    ERNAM LIKE MARA-ERNAM,

    " name of the person who created the object

    MATKL LIKE MARA-MATKL, " material group

    MEINS LIKE MARA-MEINS, " base unit of measure

    PSTAT LIKE MARA-PSTAT. " maintainence status

    DATA : END OF IT_MARA.

    ******************VARIABLE

    DECLARATION**********************************

    DATA : REPID LIKE SY-REPID. " program name

    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    " field catalog table for vbap

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    DATA : IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,

    " field catalog table for mara

    WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.

    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

    DATA: GT_XEVENTS TYPE SLIS_T_EVENT.

    DATA: GT_YEVENTS TYPE SLIS_T_EVENT. " events table

    DATA : XS_EVENT TYPE SLIS_ALV_EVENT. " events type

    DATA : GT_PRINT TYPE SLIS_PRINT_ALV. " print table

    *******************MULTIPLE SELECT INPUT

    PARAMETERS**********************

    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.

    " multiple selection for sales document

    ******************INITIALIZATION**************************************

    ***

    INITIALIZATION.

    REPID = SY-REPID.

    *******************START OF

    SELECTION************************************

    START-OF-SELECTION.

    PERFORM POP_VBAP.

    " populating the table with document item data

    PERFORM POP_MARA.

    " populating the table with general material data

    PERFORM FIELD_CAT.

    " mapping the fields for the field catalog

    PERFORM EVENTS. " using the events

    PERFORM BLOCK_LIST.

    " displaying the data in blocked list

    &----


    *& Form field_cat

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FIELD_CAT .

    WA_FIELDCAT-FIELDNAME = 'VBELN'.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.

    WA_FIELDCAT-COL_POS = 1.

    WA_FIELDCAT-OUTPUTLEN = 10.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'POSNR'.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-SELTEXT_L = 'DOC ITEM'.

    WA_FIELDCAT-COL_POS = 2.

    WA_FIELDCAT-OUTPUTLEN = 6.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'ERNAM'.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-SELTEXT_L = 'NAME'.

    WA_FIELDCAT-COL_POS = 3.

    WA_FIELDCAT-OUTPUTLEN = 12.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'ERDAT'.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-SELTEXT_L = 'DATE'.

    WA_FIELDCAT-COL_POS = 4.

    WA_FIELDCAT-OUTPUTLEN = 8.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'MATNR'.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-SELTEXT_L = 'MAT NO'.

    WA_FIELDCAT-COL_POS = 5.

    WA_FIELDCAT-OUTPUTLEN = 18.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT1-FIELDNAME = 'MATNR'.

    WA_FIELDCAT1-TABNAME = 'IT_MARA'.

    WA_FIELDCAT1-SELTEXT_L = 'MAT NO'.

    WA_FIELDCAT1-COL_POS = 1.

    WA_FIELDCAT1-OUTPUTLEN = 18.

    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.

    CLEAR WA_FIELDCAT1.

    WA_FIELDCAT1-FIELDNAME = 'ERNAM'.

    WA_FIELDCAT1-TABNAME = 'IT_MARA'.

    WA_FIELDCAT1-SELTEXT_L = 'NAME'.

    WA_FIELDCAT1-COL_POS = 2.

    WA_FIELDCAT1-OUTPUTLEN = 12.

    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.

    CLEAR WA_FIELDCAT1.

    WA_FIELDCAT1-FIELDNAME = 'MATKL'.

    WA_FIELDCAT1-TABNAME = 'IT_MARA'.

    WA_FIELDCAT1-SELTEXT_L = 'MAT DESC'.

    WA_FIELDCAT1-COL_POS = 3.

    WA_FIELDCAT1-OUTPUTLEN = 9.

    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.

    CLEAR WA_FIELDCAT1.

    WA_FIELDCAT1-FIELDNAME = 'MEINS'.

    WA_FIELDCAT1-TABNAME = 'IT_MARA'.

    WA_FIELDCAT1-SELTEXT_L = 'UNITS'.

    WA_FIELDCAT1-COL_POS = 4.

    WA_FIELDCAT1-OUTPUTLEN = 3.

    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.

    CLEAR WA_FIELDCAT1.

    WA_FIELDCAT1-FIELDNAME = 'PSTAT'.

    WA_FIELDCAT1-TABNAME = 'IT_MARA'.

    WA_FIELDCAT1-SELTEXT_L = 'STATUS'.

    WA_FIELDCAT1-COL_POS = 5.

    WA_FIELDCAT1-OUTPUTLEN = 15.

    APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.

    CLEAR WA_FIELDCAT1.

    ENDFORM. " field_cat

    &----


    *& Form events

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM EVENTS .

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.

    XS_EVENT-FORM = 'XEND_OF_PAGE'.

    APPEND XS_EVENT TO GT_XEVENTS.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.

    XS_EVENT-FORM = 'XTOP_OF_PAGE'.

    APPEND XS_EVENT TO GT_XEVENTS.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.

    XS_EVENT-FORM = 'XTOP_OF_LIST'.

    APPEND XS_EVENT TO GT_XEVENTS.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_END_OF_LIST.

    XS_EVENT-FORM = 'XEND_OF_LIST'.

    APPEND XS_EVENT TO GT_XEVENTS.

    CLEAR XS_EVENT.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_END_OF_PAGE.

    XS_EVENT-FORM = 'YEND_OF_PAGE'.

    APPEND XS_EVENT TO GT_YEVENTS.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.

    XS_EVENT-FORM = 'YTOP_OF_PAGE'.

    APPEND XS_EVENT TO GT_YEVENTS.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_TOP_OF_LIST.

    XS_EVENT-FORM = 'YTOP_OF_LIST'.

    APPEND XS_EVENT TO GT_YEVENTS.

    CLEAR XS_EVENT.

    XS_EVENT-NAME = SLIS_EV_END_OF_LIST.

    XS_EVENT-FORM = 'YEND_OF_LIST'.

    APPEND XS_EVENT TO GT_YEVENTS.

    ENDFORM. " events

    &----


    *& Form XTOP_OF_PAGE

    &----


    • text

    ----


    FORM XTOP_OF_PAGE.

    • BREAK-POINT.

    WRITE: / 'X_TOP_OF_PAGE'.

    ENDFORM. "XTOP_OF_PAGE

    ----


    • FORM XTOP_OF_LIST *

    ----


    • ........ *

    ----


    FORM XTOP_OF_LIST.

    • BREAK-POINT.

    WRITE: / 'X_TOP_OF_LIST'.

    ENDFORM. "XTOP_OF_LIST

    ----


    • FORM XEND_OF_PAGE *

    ----


    • ........ *

    ----


    FORM XEND_OF_PAGE.

    • BREAK-POINT.

    WRITE: / 'X_END_OF_PAGE'.

    ENDFORM. "XEND_OF_PAGE

    ----


    • FORM XEND_OF_LIST *

    ----


    • ........ *

    ----


    FORM XEND_OF_LIST.

    • BREAK-POINT.

    WRITE: / 'X_END_OF_LIST'.

    ENDFORM. "XEND_OF_LIST

    *

    FORM YTOP_OF_PAGE.

    • BREAK-POINT.

    WRITE: / 'Y_TOP_OF_PAGE'.

    ENDFORM. "YTOP_OF_PAGE

    ----


    • FORM YTOP_OF_LIST *

    ----


    • ........ *

    ----


    FORM YTOP_OF_LIST.

    • BREAK-POINT.

    WRITE: / 'Y_TOP_OF_LIST'.

    ENDFORM. "YTOP_OF_LIST

    ----


    • FORM YEND_OF_PAGE *

    ----


    • ........ *

    ----


    FORM YEND_OF_PAGE.

    • BREAK-POINT.

    WRITE: / 'Y_END_OF_PAGE'.

    ENDFORM. "YEND_OF_PAGE

    ----


    • FORM YEND_OF_LIST *

    ----


    • ........ *

    ----


    FORM YEND_OF_LIST.

    • BREAK-POINT.

    WRITE: / 'Y_END_OF_LIST'.

    ENDFORM. "YEND_OF_LIST

    *

    &----


    *& Form POP_VBAP

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POP_VBAP .

    SELECT VBELN

    POSNR

    ERNAM

    ERDAT

    MATNR

    FROM VBAP

    INTO CORRESPONDING FIELDS OF TABLE IT_VBAP

    WHERE VBELN IN S_VBELN.

    ENDFORM. " POP_VBAP

    &----


    *& Form POP_MARA

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POP_MARA .

    LOOP AT IT_VBAP.

    SELECT SINGLE MATNR

    ERNAM

    MATKL

    MEINS

    PSTAT

    FROM MARA

    INTO CORRESPONDING FIELDS OF IT_MARA

    WHERE MATNR = IT_VBAP-MATNR.

    APPEND IT_MARA.

    ENDLOOP.

    ENDFORM. " POP_MARA

    &----


    *& Form BLOCK_LIST

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM BLOCK_LIST .

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

    EXPORTING

    I_CALLBACK_PROGRAM = REPID

    I_CALLBACK_PF_STATUS_SET = ' '

    I_CALLBACK_USER_COMMAND = 'user_command'.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    IS_LAYOUT = WA_LAYOUT

    IT_FIELDCAT = IT_FIELDCAT

    I_TABNAME = 'IT_VBAP'

    IT_EVENTS = GT_XEVENTS

    • IT_SORT =

    • I_TEXT = ' '

    TABLES

    T_OUTTAB = IT_VBAP

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • MAXIMUM_OF_APPENDS_REACHED = 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.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    IS_LAYOUT = WA_LAYOUT

    IT_FIELDCAT = IT_FIELDCAT1

    I_TABNAME = 'IT_MARA'

    IT_EVENTS = GT_YEVENTS

    • IT_SORT =

    • I_TEXT = ' '

    TABLES

    T_OUTTAB = IT_MARA

    • EXCEPTIONS

    • PROGRAM_ERROR = 1

    • MAXIMUM_OF_APPENDS_REACHED = 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.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    IS_PRINT = GT_PRINT

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

    • 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. " BLOCK_LIST

    ******************************************************************************

    HIERARCHY ALV

    REPORT ZALV2 NO STANDARD PAGE HEADING

    MESSAGE-ID ZMSG.

    **********************TABLES DECLARATION******************************

    TABLES : VBAK, " sales document header data

    VBAP. " sales document item data

    **********************TYPE POOL DECLARATION***************************

    TYPE-POOLS : SLIS.

    **********************TYPES DECLARATION*******************************

    *TYPES : BEGIN OF TY_VBAK,

    • VBELN TYPE VBAK-VBELN,

    • ERDAT TYPE VBAK-ERDAT,

    • ERNAM TYPE VBAK-ERNAM,

    • AUART TYPE VBAK-AUART,

    • NETWR TYPE VBAK-NETWR,

    • END OF TY_VBAK.

    *

    *TYPES : BEGIN OF TY_VBAP,

    • VBELN TYPE VBAP-VBELN,

    • POSNR TYPE VBAP-POSNR,

    • MATNR TYPE VBAP-MATNR,

    • MEINS TYPE VBAP-MEINS,

    • ZMENG TYPE VBAP-ZMENG,

    • END OF TY_VBAP.

    ***********************INTERNAL TABLES********************************

    *DATA : IT_VBAK TYPE STANDARD TABLE OF TY_VBAK,

    • IT_VBAP TYPE STANDARD TABLE OF TY_VBAP,

    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

    " field catalog internal table

    DATA : BEGIN OF IT_VBAK OCCURS 0,

    " internal table for sales document header data

    VBELN TYPE VBAK-VBELN, " sales document

    ERDAT TYPE VBAK-ERDAT,

    " date on which document was created

    ERNAM TYPE VBAK-ERNAM,

    " name of the person who created it

    AUART TYPE VBAK-AUART, " sales document type

    NETWR TYPE VBAK-NETWR,

    " net value of the sales order in document currency

    END OF IT_VBAK.

    DATA : BEGIN OF IT_VBAP OCCURS 0,

    " internal table for sales document item data

    VBELN TYPE VBAP-VBELN, " sales document

    POSNR TYPE VBAP-POSNR, " sales document item

    MATNR TYPE VBAP-MATNR, " material number

    MEINS TYPE VBAP-MEINS, " base unit of measure

    ZMENG TYPE VBAP-ZMENG, " target quantity in sales units

    END OF IT_VBAP.

    DATA : TY_FIELDCAT TYPE SLIS_FIELDCAT_ALV, " field catalog type

    TY_KEYINFO TYPE SLIS_KEYINFO_ALV. " key information type

    ***********************VARIABLE DECLARATIONS**************************

    DATA : REPID TYPE SY-REPID, " program name

    IT_HEADER TYPE SLIS_TABNAME,

    " table to store header data

    IT_ITEM TYPE SLIS_TABNAME. " table to store item data

    ***********************SELECTION PARAMETERS***************************

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

    SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN.

    " mulitple selection inputs for sales document

    SELECTION-SCREEN : END OF BLOCK B1.

    ***********************INITIALIZATION*********************************

    REPID = SY-REPID.

    " variable having the program name

    IT_HEADER = 'IT_VBAK'.

    IT_ITEM = 'IT_VBAP'.

    CLEAR TY_KEYINFO.

    TY_KEYINFO-HEADER01 = 'VBELN'.

    " comparing the keys and relating the header and item internal tables

    TY_KEYINFO-ITEM01 = 'VBELN'.

    TY_KEYINFO-HEADER02 = SPACE.

    TY_KEYINFO-ITEM02 = 'POSNR'.

    ***********************VALIDATION CHECK*******************************

    AT SELECTION-SCREEN.

    PERFORM VAL_CHK.

    " validation check for the input

    **********************PROCESSING LOGIC********************************

    START-OF-SELECTION.

    PERFORM POP_HDR.

    " populating the header data

    PERFORM POP_ITEM. " populating the item data

    PERFORM FIELD_CATALOG.

    " mapping all the fields to the field catalog

    PERFORM OUTPUT.

    " displaying ouput using the function module

    &----


    *& Form VAL_CHK

    &----


    • text VALIDATION CHECK FOR SALES DOCUMENT

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM VAL_CHK .

    SELECT VBELN

    ERDAT

    ERNAM

    AUART

    NETWR UP TO 1 ROWS

    FROM VBAK

    INTO CORRESPONDING FIELDS OF TABLE IT_VBAK

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE I000 WITH 'NO HEADER DETAILS EXIST'.

    ELSE.

    SELECT VBELN

    POSNR

    MATNR

    MEINS

    ZMENG

    FROM VBAP

    INTO CORRESPONDING FIELDS OF TABLE IT_VBAP

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE I000 WITH 'NO ITEM DETAILS EXIST'.

    ENDIF.

    ENDIF.

    CLEAR IT_VBAK.

    CLEAR IT_VBAP.

    ENDFORM. " VAL_CHK

    &----


    *& Form POP_HDR

    &----


    • text POPULATING THE HEADER DETAILS

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POP_HDR .

    SELECT VBELN

    ERDAT

    ERNAM

    AUART

    NETWR

    FROM VBAK

    INTO CORRESPONDING FIELDS OF TABLE IT_VBAK

    WHERE VBELN IN S_VBELN.

    ENDFORM. " POP_HDR

    &----


    *& Form POP_ITEM

    &----


    • text POPULATING THE ITEM DETAILS

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POP_ITEM .

    SELECT VBELN

    POSNR

    MATNR

    MEINS

    ZMENG

    FROM VBAP

    INTO CORRESPONDING FIELDS OF TABLE IT_VBAP

    WHERE VBELN IN S_VBELN.

    ENDFORM. " POP_ITEM

    &----


    *& Form FIELD_CATALOG

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FIELD_CATALOG .

    TY_FIELDCAT-TABNAME = 'IT_VBAK'.

    TY_FIELDCAT-FIELDNAME = 'VBELN'.

    TY_FIELDCAT-SELTEXT_L = 'DOC NO'.

    TY_FIELDCAT-COL_POS = 1.

    TY_FIELDCAT-OUTPUTLEN = 10.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAK'.

    TY_FIELDCAT-FIELDNAME = 'ERDAT'.

    TY_FIELDCAT-SELTEXT_L = 'DATE'.

    TY_FIELDCAT-COL_POS = 2.

    TY_FIELDCAT-OUTPUTLEN = 8.

    TY_FIELDCAT-DATATYPE = 'DATS'.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAK'.

    TY_FIELDCAT-FIELDNAME = 'ERNAM'.

    TY_FIELDCAT-SELTEXT_L = 'NAME'.

    TY_FIELDCAT-COL_POS = 3.

    TY_FIELDCAT-OUTPUTLEN = 12.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAK'.

    TY_FIELDCAT-FIELDNAME = 'AUART'.

    TY_FIELDCAT-SELTEXT_L = 'DOC TYPE'.

    TY_FIELDCAT-COL_POS = 4.

    TY_FIELDCAT-OUTPUTLEN = 4.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAP'.

    TY_FIELDCAT-FIELDNAME = 'VBELN'.

    TY_FIELDCAT-SELTEXT_L = 'DOC NO'.

    TY_FIELDCAT-OUTPUTLEN = 10.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAP'.

    TY_FIELDCAT-FIELDNAME = 'POSNR'.

    TY_FIELDCAT-SELTEXT_L = 'ITEM'.

    TY_FIELDCAT-OUTPUTLEN = 6.

    TY_FIELDCAT-DATATYPE = 'NUMC'.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAP'.

    TY_FIELDCAT-FIELDNAME = 'MATNR'.

    TY_FIELDCAT-SELTEXT_L = 'MAT NO'.

    TY_FIELDCAT-OUTPUTLEN = 18.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAP'.

    TY_FIELDCAT-FIELDNAME = 'MEINS'.

    TY_FIELDCAT-SELTEXT_L = 'UNITS'.

    TY_FIELDCAT-OUTPUTLEN = 3.

    TY_FIELDCAT-DATATYPE = 'UNIT'.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    TY_FIELDCAT-TABNAME = 'IT_VBAP'.

    TY_FIELDCAT-FIELDNAME = 'ZMENG'.

    TY_FIELDCAT-SELTEXT_L = 'QUANT'.

    TY_FIELDCAT-OUTPUTLEN = 13.

    TY_FIELDCAT-DATATYPE = 'QUAN'.

    APPEND TY_FIELDCAT TO IT_FIELDCAT.

    CLEAR TY_FIELDCAT.

    ENDFORM. " FIELD_CATALOG

    &----


    *& Form OUTPUT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM OUTPUT .

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    I_CALLBACK_PROGRAM = REPID

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • IS_LAYOUT =

    IT_FIELDCAT = IT_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 =

    • IT_EVENT_EXIT =

    I_TABNAME_HEADER = IT_HEADER

    I_TABNAME_ITEM = IT_ITEM

    • I_STRUCTURE_NAME_HEADER =

    • I_STRUCTURE_NAME_ITEM =

    IS_KEYINFO = TY_KEYINFO

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB_HEADER = IT_VBAK

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

    ENDFORM. " OUTPUT

    ******************************************************************

    INTERACTIVE ALV

    REPORT Z50651_ALV_INTERACTIVE MESSAGE-ID ZMSG_50651

    LINE-SIZE 100

    LINE-COUNT 60

    NO STANDARD PAGE HEADING.

    ******************TABLES DECLARATION*****************

    TABLES : VBAP,MARA.

    *****************TYPE POOLS**************************

    TYPE-POOLS : SLIS.

    ****************INTERNAL TABLES**********************

    DATA : BEGIN OF IT_VBAP OCCURS 0,

    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT

    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM

    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER

    END OF IT_VBAP.

    ****************TEMPORARY VARIABLES******************

    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT

    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE

    *****************FIELD CATALOG***********************

    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    ****************LAYOUT*******************************

    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

    ***************VARIANT*******************************

    DATA : G_VARIANT LIKE DISVARIANT.

    ****************SAVE*********************************

    DATA : G_SAVE(1) TYPE C.

    *****************EVENTS******************************

    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,

    G_EVENTS TYPE SLIS_T_EVENT.

    ******************PF STATUS**************************

    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.

    ******************USER COMMAND************************

    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',

    R_UCOMM LIKE SY-UCOMM.

    ****************SELECTION SCREEN************************

    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.

    ***************AT SELECTION SCREEN*********************

    AT SELECTION-SCREEN.

    PERFORM VALIDATE.

    **************START-OF-SELECTION**************************

    START-OF-SELECTION.

    PERFORM GET_DETAILS.

    PERFORM FIELDCAT.

    PERFORM LAYOUT.

    PERFORM VARIANT.

    PERFORM SAVE.

    PERFORM EVENTS.

    PERFORM ALV_DISPLAY.

    *********************FORMS*******************************************

    &----


    *& Form validate

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM VALIDATE .

    SELECT SINGLE VBELN

    FROM VBAP

    INTO V_VBELN

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE E000 WITH 'enter valid vbeln'.

    ENDIF.

    ENDFORM. " validate

    &----


    *& Form get_details

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_DETAILS .

    SELECT VBELN

    POSNR

    MATNR

    FROM VBAP

    INTO TABLE IT_VBAP

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE E000 WITH 'no details found'.

    ENDIF.

    ENDFORM. " get_details

    &----


    *& Form fieldcat

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FIELDCAT .

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-FIELDNAME = 'VBELN'.

    WA_FIELDCAT-OUTPUTLEN = 10.

    WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-FIELDNAME = 'POSNR'.

    WA_FIELDCAT-OUTPUTLEN = 6.

    WA_FIELDCAT-SELTEXT_L = 'ITEM'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-TABNAME = 'IT_VBAP'.

    WA_FIELDCAT-FIELDNAME = 'MATNR'.

    WA_FIELDCAT-OUTPUTLEN = 18.

    WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    ENDFORM. " fieldcat

    &----


    *& Form LAYOUT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM LAYOUT .

    WA_LAYOUT-ZEBRA = 'X'.

    ENDFORM. " LAYOUT

    &----


    *& Form VARIANT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM VARIANT .

    CLEAR G_VARIANT.

    G_VARIANT-REPORT = SY-REPID.

    ENDFORM. " VARIANT

    &----


    *& Form SAVE

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM SAVE .

    CLEAR G_SAVE.

    G_SAVE = 'A'.

    ENDFORM. " SAVE

    &----


    *& Form EVENTS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM EVENTS .

    CLEAR XS_EVENTS.

    XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.

    XS_EVENTS-FORM = 'TOP_OF_PAGE'.

    APPEND XS_EVENTS TO G_EVENTS.

    ENDFORM. " EVENTS

    &----


    *& Form TOP_OF_PAGE

    &----


    • text

    ----


    FORM TOP_OF_PAGE.

    WRITE :/ ' INTELLI GROUP'.

    ENDFORM. "TOP_OF_PAGE

    &----


    *& Form ALV_DISPLAY

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM ALV_DISPLAY .

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = SY-REPID

    I_CALLBACK_PF_STATUS_SET = PF_STATUS

    I_CALLBACK_USER_COMMAND = USER_COMMAND

    • I_STRUCTURE_NAME =

    IS_LAYOUT = WA_LAYOUT

    IT_FIELDCAT = IT_FIELDCAT

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    I_SAVE = G_SAVE

    IS_VARIANT = G_VARIANT

    IT_EVENTS = G_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.

    ENDFORM. " ALV_DISPLAY

    &----


    *& Form SET_PF_STATUS

    &----


    • text

    ----


    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.

    SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.

    ENDFORM. "SET_PF_STATUS

    &----


    *& Form SET_USER_COMMAND

    &----


    • text

    ----


    FORM SET_USER_COMMAND USING R_UCOMM

    RS_SELFIELD TYPE SLIS_SELFIELD.

    CASE R_UCOMM.

    WHEN 'DC'.

    READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.

    IF SY-SUBRC = 0.

    SELECT SINGLE MTART

    FROM MARA

    INTO V_MTART

    WHERE MATNR = IT_VBAP-MATNR.

    IF SY-SUBRC <> 0.

    MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.

    ELSE.

    WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.

    WRITE :/ 'MATERIAL TYPE :' , V_MTART.

    ENDIF.

    ENDIF.

    WHEN 'BACK'.

    LEAVE TO SCREEN 0.

    WHEN 'EXIT'.

    LEAVE TO SCREEN 0.

    WHEN 'CLOSE'.

    CALL TRANSACTION 'SE38'.

    ENDCASE.

    ENDFORM. "SET_USER_COMMAND

    ********************************************************************************

    ALV POPUPS

    TYPE-POOLS : SLIS.

    DATA : GT_OUTTAB TYPE VBAK OCCURS 0,

    GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,

    GS_SELFIELD TYPE SLIS_SELFIELD.

    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    DATA : ITAB TYPE TABLE OF SLIS_SELFIELD,

    WA_ITAB LIKE LINE OF ITAB.

    START-OF-SELECTION.

    PERFORM POPULATE_GT_OUTTAB.

    PERFORM GET_POPUP.

    PERFORM POPULATE_ITAB.

    PERFORM FIELDCAT.

    PERFORM DISPLAY_DETAILS.

    &----


    *& Form FIELDCAT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FIELDCAT .

    LOOP AT ITAB INTO WA_ITAB.

    WA_FIELDCAT-FIELDNAME = 'TABINDEX'.

    WA_FIELDCAT-TABNAME = 'WA_ITAB'.

    WA_FIELDCAT-COL_POS = 1.

    WA_FIELDCAT-SELTEXT_L = 'TABLE INDEX'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'SEL_TAB_FIELD'.

    WA_FIELDCAT-TABNAME = 'WA_ITAB'.

    WA_FIELDCAT-COL_POS = 2.

    WA_FIELDCAT-OUTPUTLEN = 20.

    WA_FIELDCAT-SELTEXT_L = 'FIELD NAME'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'VALUE'.

    WA_FIELDCAT-TABNAME = 'WA_ITAB'.

    WA_FIELDCAT-COL_POS = 3.

    WA_FIELDCAT-SELTEXT_L = 'FIELD VALUE'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    ENDLOOP.

    ENDFORM. " FIELDCAT

    &----


    *& Form POPULATE_GT_OUTTAB

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POPULATE_GT_OUTTAB .

    SELECT * FROM VBAK

    UP TO 10 ROWS

    INTO TABLE GT_OUTTAB.

    ENDFORM. " POPULATE_GT_OUTTAB

    &----


    *& Form GET_POPUP

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_POPUP .

    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

    EXPORTING

    I_TITLE = 'SALES ORDER'

    • I_SELECTION = 'X'

    • I_ALLOW_NO_SELECTION =

    I_ZEBRA = 'X'

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_CHECKBOX_FIELDNAME =

    • I_LINEMARK_FIELDNAME =

    • I_SCROLL_TO_SEL_LINE = 'X'

    I_TABNAME = 'SALES ORDER'

    I_STRUCTURE_NAME = 'VBAK'

    • IT_FIELDCAT =

    • IT_EXCLUDING =

    • I_CALLBACK_PROGRAM =

    • I_CALLBACK_USER_COMMAND =

    IS_PRIVATE = GS_PRIVATE

    IMPORTING

    ES_SELFIELD = GS_SELFIELD

    • E_EXIT = G_EXIT

    TABLES

    T_OUTTAB = GT_OUTTAB

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

    &----


    *& Form POPULATE_ITAB

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM POPULATE_ITAB .

    WA_ITAB-TABNAME = GS_SELFIELD-TABNAME.

    WA_ITAB-TABINDEX = GS_SELFIELD-TABINDEX.

    WA_ITAB-SEL_TAB_FIELD = GS_SELFIELD-SEL_TAB_FIELD.

    WA_ITAB-VALUE = GS_SELFIELD-VALUE.

    APPEND WA_ITAB TO ITAB.

    ENDFORM. " POPULATE_ITAB

    &----


    *& Form DISPLAY_DETAILS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM DISPLAY_DETAILS .

    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_FIELDCAT

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

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

    ************************************************************************

    Hope it will be very useful to u.....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 07:32 AM

    What is SLIS in ALV

    SLIS is the type library for ALV grid.

    If you'll use the ALV you have to add TYPE-POOLS : SLIS. command at the beginning of your code.

    Consider these :

    slis_t_fieldcat_alv is containing "_t_"

    It means that it is an internal table and slis_fieldcat_alv is header line of that.

    Here is a practical example for alv grid :

    Just think that you have an internal table named 'ITAB' to show.

    Step1 : First add these lines to your code :

    TYPE-POOLS : SLIS.

    DATA ALV_PROG_NAME LIKE SY-REPID.

    ALV_PROG_NAME = SY-REPID.

    DATA : ALV_ITAB_NAME(30),

    L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

    ALV_ITAB_NAME = 'ITAB'. "!!Write here the name of your internal table

    Step 2 : Add these two function :

    The first function is filling the fieldcat L_FIELDCAT that you described, second is showing it on the screen.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = ALV_PROG_NAME

    I_INTERNAL_TABNAME = ALV_ITAB_NAME

    • I_STRUCTURE_NAME =

    • I_CLIENT_NEVER_DISPLAY = 'X'

    I_INCLNAME = ALV_PROG_NAME

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE =

    CHANGING

    CT_FIELDCAT = L_FIELDCAT

    EXCEPTIONS

    INCONSISTENT_INTERFACE = 1

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

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = ALV_PROG_NAME

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

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

    • IT_HYPERLINK =

    • I_HTML_HEIGHT_TOP =

    • I_HTML_HEIGHT_END =

    • IT_EXCEPT_QINFO =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = ITAB[] "Write here the name of your internal table + []

    • 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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 07:33 AM

    SLIS_FILEDCAT_ALV

    SLIS_T_FIELDCAT_ALV

    These two are used to define field catalog for ALV programs.

    SLIS_T_EVENT

    This is used to handle events in ALV Lists/Grids

    SLIS_TLISTHEADER

    It is used to display header in ALV Lists.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 07:33 AM

    hi

    u can build field catalog in three ways

    <b>manually</b>

    by using <b>slis</b> type pool

    <b>automatically</b>

    by using

    <b>reuse_alv_fieldcatalog_merge</b> function module

    <b>semi automatically</b>

    by using

    lvc_fieldcatalog_merge.

    SLIS_FILEDCAT_ALV work area of the field catalog defined in type pool slis

    SLIS_T_FIELDCAT_ALV( body of the field catalog defined in type pool slis

    SLIS_T_EVENT( u can provide events with this

    SLIS_TLISTHEADER( u can provide header information by using this)

    reward if u find useful

    Regards

    Nagesh.Paruchuri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 07:36 AM

    hi,

    SLIS_FILEDCAT_ALV

    **************************

    This is assign to work area.

    WA_FIELDCAT type SLIS_FIELDCAT_ALV.

    SLIS_T_FIELDCAT_ALV

    *****************************

    This is used to assign internal table.

    ITAB_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

    SLIS_T_EVENT

    ******************

    This is used to create internal table to get the events.

    ITAB_EVENTS TYPE SLIS_T_EVENT.

    SLIS_TLISTHEADER

    *************************

    This will help to display top of page.

    ITAB_HEADER TYPE SLIS_T_LISTHEADER.

    Here one example program is there

    &----


    *& Report ZE0232_ALV_TOP1 *

    *& *

    &----


    *& *

    *& *

    &----


    report ze0232_alv_top1.

    type-pools: slis.

    tables: ekpo.

    data: repid like sy-repid.

    data: it_events type slis_t_event,

    • it_page type slis_t_listheader,

    wa_events type slis_alv_event,

    • wa_page type slis_listheader,

    it_layout type slis_layout_alv,

    fieldcatalog type slis_t_fieldcat_alv,

    wa_fieldcatalog type slis_fieldcat_alv.

    data: t_header type slis_t_listheader,

    wa_header type slis_listheader.

    *perform build_layout.

    *perform get_fieldcatalog.

    perform build_events.

    data: i_ekpo like ekpo occurs 0 with header line.

    select * from ekpo into corresponding fields of table i_ekpo.

    call function 'REUSE_ALV_GRID_DISPLAY'

    exporting

    i_callback_program = sy-repid

    i_callback_top_of_page = 'FTOP'

    i_structure_name = 'EKPO'

    is_layout = it_layout

    • it_fieldcat = fieldcatalog[]

    it_events = it_events

    tables

    t_outtab = i_ekpo.

    if sy-subrc <> 0.

    endif.

    &----


    *& Form F_TOP

    &----


    • text

    ----


    form ftop.

    wa_header-typ = 'H'.

    wa_header-info = 'HEADERDD'.

    append wa_header to t_header.

    clear wa_header.

    wa_header-typ = 'S'.

    wa_header-key = 'DATE'.

    wa_header-info = sy-datum.

    append wa_header to t_header.

    clear wa_header.

    call function 'REUSE_ALV_COMMENTARY_WRITE'

    exporting

    it_list_commentary = t_header

    I_LOGO = 'ENJOYSAP_LOGO'.

    endform. "F_TOP

    &----


    *& Form BUILD_EVENTS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form build_events .

    call function 'REUSE_ALV_EVENTS_GET'

    exporting

    i_list_type = 0

    importing

    et_events = it_events

    exceptions

    list_type_wrong = 1

    others = 2.

    if sy-subrc <> 0.

    endif.

    endform. " BUILD_EVENTS

    &----


    *& Form GET_FIELDCATALOG

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form get_fieldcatalog .

    wa_fieldcatalog-col_pos = '0'.

    wa_fieldcatalog-fieldname = 'EBELN'.

    wa_fieldcatalog-tabname = 'I_EKPO'.

    wa_fieldcatalog-seltext_m = 'PURCHASING DOCUMENT'.

    wa_fieldcatalog-emphasize = 'X'.

    append wa_fieldcatalog to fieldcatalog.

    clear wa_fieldcatalog.

    wa_fieldcatalog-col_pos = '1'.

    wa_fieldcatalog-fieldname = 'EBELP'.

    wa_fieldcatalog-tabname = 'I_EKPO'.

    wa_fieldcatalog-seltext_m = 'ITEM NUMBER'.

    append wa_fieldcatalog to fieldcatalog.

    clear wa_fieldcatalog.

    endform. " GET_FIELDCATALOG

    &----


    *& Form build_layout

    &----


    • text

    ----


    form build_layout.

    it_layout-no_input = 'X'.

    it_layout-colwidth_optimize = 'X'.

    it_layout-totals_text = 'Totals'(201).

    it_layout-info_fieldname = 'LINE_COLOR'.

    endform. " build_layout

    IF HELPFULL REWARD

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.