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

Single List and Blocked List

What is the difference between Single List and Blocked List. how REUSE_ALV_LIST_DISPLAY will work with single List and Blocked List.

Please Help me.

Regards

vamsi.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2007 at 12:01 PM

    Hello,

    Check this code:

    http://www.sap-img.com/abap/reuse-alv-block-list-display.htm>

    Regards,

    Beejal

    **reward if this helps

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2007 at 09:34 AM

    hi vamsi,

    to get single list u use FM's REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY and

    for blocked list u use the FM's REUSE_ALV_BLOCK_LIST_INIT,

    REUSE_ALV_BLOCK_LIST_APPEND & REUSE_ALV_BLOCK_LIST_DISPLAY

    <b>check this code for List display....</b>

    REPORT ZTEST_ALV1.

    **TABLES DECLN

    TABLES: VBRK,VBRP,T001.

    TYPE-POOLS: SLIS.

    TYPE-POOLS: ICON.

    ***DATA DECLN.

    DATA: V_VBELN LIKE VBRK-VBELN,

    V_MATNR LIKE VBRP-MATNR.

    CONSTANTS: C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'F_USER_COMMAND',

    C_PF_STATUS TYPE SLIS_FORMNAME VALUE 'F_SET_PF_STATUS'.

    **ALV RELATED TABLES.

    *--Field Catalog

    DATA: IT_FIELDCAT TYPE STANDARD TABLE OF

    SLIS_FIELDCAT_ALV WITH HEADER LINE,

    IT_FIELDCAT1 TYPE STANDARD TABLE OF

    SLIS_FIELDCAT_ALV WITH HEADER LINE ,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

    *--Layout

    WA_LAYOUT TYPE SLIS_LAYOUT_ALV,

    *--Sort

    IT_SORT TYPE SLIS_T_SORTINFO_ALV,

    WA_SORT TYPE SLIS_SORTINFO_ALV ,

    **-Structure for excluding function codes

    WA_EXTAB TYPE SLIS_EXTAB,

    **-To hold function codes to be excluded in ALV toolbar

    IT_EXTAB TYPE SLIS_T_EXTAB.

    ***INTERNAL TABLE DECLN.

    DATA: BEGIN OF IT_VBRK OCCURS 0,

    VBELN LIKE VBRK-VBELN,

    WAERK LIKE VBRK-WAERK,

    VKORG LIKE VBRK-VKORG,

    FKDAT LIKE VBRK-FKDAT,

    BUKRS LIKE VBRK-BUKRS,

    NETWR LIKE VBRK-NETWR,

    END OF IT_VBRK.

    DATA: BEGIN OF ITAB OCCURS 0,

    VBELN LIKE VBRP-VBELN,

    POSNR LIKE VBRP-POSNR,

    FKIMG LIKE VBRP-FKIMG,

    VRKME LIKE VBRP-VRKME,

    NETWR LIKE VBRP-NETWR,

    MATNR LIKE VBRP-MATNR,

    ARKTX LIKE VBRP-ARKTX,

    END OF ITAB.

    DATA: IT_VBRP LIKE ITAB OCCURS 0 WITH HEADER LINE.

    ***selection screen.

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

    SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN,

    S_FKDAT FOR VBRK-FKDAT OBLIGATORY,

    S_MATNR FOR VBRP-MATNR.

    SELECTION-SCREEN: END OF BLOCK B1.

    **INITIALIZATION.

    INITIALIZATION.

    S_FKDAT-LOW = SY-DATUM - 200.

    S_FKDAT-HIGH = SY-DATUM.

    APPEND S_FKDAT.

    ***AT SELECTION-SCREEN.

    AT SELECTION-SCREEN.

    IF NOT S_VBELN IS INITIAL.

    SELECT SINGLE VBELN FROM VBRK

    INTO V_VBELN

    WHERE VBELN IN S_VBELN.

    IF SY-SUBRC <> 0.

    MESSAGE E001(ZZ2).

    ENDIF.

    ENDIF.

    IF NOT S_MATNR IS INITIAL.

    SELECT SINGLE MATNR FROM MARA

    INTO V_MATNR

    WHERE MATNR IN S_MATNR.

    IF SY-SUBRC <> 0.

    MESSAGE E001(ZZ2).

    ENDIF.

    ENDIF.

    ***START-OF-SELECTION.

    START-OF-SELECTION.

    PERFORM GET_DATA_VBRK.

    ***END-OF-SELECTION.

    END-OF-SELECTION.

    *--Sort the Output Fields

    PERFORM SORT_FIELDS.

    *--Build Field catalog for the Output fields

    PERFORM GET_FIELD_CATALOG.

    ***MODIFY LAYOUT.

    PERFORM MODIFY_LAYOUT.

    *--Display ALV output

    PERFORM LIST_DISP TABLES IT_VBRK

    USING C_USER_COMMAND.

    &----


    *& Form GET_DATA_VBRK

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_DATA_VBRK.

    SELECT VBELN

    WAERK

    VKORG

    FKDAT

    BUKRS

    NETWR

    INTO TABLE IT_VBRK

    FROM VBRK

    WHERE VBELN IN S_VBELN

    AND FKDAT IN S_FKDAT.

    ENDFORM. " GET_DATA

    &----


    *& Form GET_FIELD_CATALOG

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_FIELD_CATALOG .

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = SY-REPID

    I_INTERNAL_TABNAME = 'IT_VBRK'

    I_INCLNAME = SY-REPID

    CHANGING

    CT_FIELDCAT = IT_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.

    ENDFORM. " GET_FIELD_CATALOG

    &----


    *& Form SORT_FIELDS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM SORT_FIELDS .

    CLEAR WA_SORT.

    WA_SORT-SPOS = '01'.

    WA_SORT-FIELDNAME = 'VBELN' .

    WA_SORT-TABNAME = 'IT_VBRK'.

    WA_SORT-UP = 'X'.

    APPEND WA_SORT TO IT_SORT.

    CLEAR WA_SORT.

    WA_SORT-SPOS = '02'.

    WA_SORT-FIELDNAME = 'POSNR' .

    WA_SORT-TABNAME = 'IT_VBRP'.

    WA_SORT-UP = 'X'.

    APPEND WA_SORT TO IT_SORT.

    ENDFORM. " SORT_FIELDS

    &----


    *& Form MODIFY_LAYOUT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM MODIFY_LAYOUT .

    WA_LAYOUT-DEFAULT_ITEM = 'X'.

    WA_LAYOUT-ZEBRA = 'X'.

    WA_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.

    WA_layout-colwidth_optimize = 'X'.

    ENDFORM. " MODIFY_LAYOUT

    &----


    *& Form LIST_DISP

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM LIST_DISP TABLES P_IT_VBRK

    USING P_USER_COMMAND TYPE SLIS_FORMNAME.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = SY-REPID

    I_CALLBACK_PF_STATUS_SET = 'POPUP'

    I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'

    IS_LAYOUT = WA_LAYOUT

    IT_FIELDCAT = IT_FIELDCAT[]

    IT_EXCLUDING = IT_EXTAB[]

    TABLES

    T_OUTTAB = IT_VBRK

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

    &----


    *& Form POPUP

    &----


    • text

    ----


    • -->P_EXTAB text

    ----


    FORM POPUP USING IT_EXTAB TYPE SLIS_T_EXTAB.

    *- Pf status

    SET PF-STATUS 'POPUP'.

    ENDFORM. " POPUP

    <b>and check this for <b>Block List</b>....</b>

    REPORT ZTEST_ALV3.

    TABLES: SFLIGHT,SPFLI.

    TYPE-POOLS: SLIS.

    DATA: BEGIN OF ITAB OCCURS 0,

    CARRID LIKE SFLIGHT-CARRID,

    CONNID LIKE SFLIGHT-CONNID,

    FLDATE LIKE SFLIGHT-FLDATE,

    PRICE LIKE SFLIGHT-PRICE,

    CURRENCY LIKE SFLIGHT-CURRENCY,

    CITYFROM LIKE SPFLI-CITYFROM,

    CITYTO LIKE SPFLI-CITYTO,

    END OF ITAB.

    DATA: V_REPID LIKE SY-REPID.

    ***FIELD CATALOG.

    DATA: ITAB_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

    WA_FLDCAT TYPE SLIS_FIELDCAT_ALV.

    ***SORTING

    DATA: ITAB_SORT TYPE SLIS_T_SORTINFO_ALV,

    WA_SORT TYPE SLIS_SORTINFO_ALV.

    ***events

    DATA: IT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,

    ***VARIANTS

    IT_VARIANT LIKE DISVARIANT OCCURS 0 WITH HEADER LINE.

        • FOR LAYOUT

        DATA: WA_LAYOUT TYPE SLIS_LAYOUT_ALV,

        IT_LAYOUT TYPE SLIS_LAYOUT_ALV OCCURS 0 WITH HEADER LINE.

        ****SELECTION-SCREEN

        SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME.

        SELECT-OPTIONS: S_CARRID FOR SFLIGHT-CARRID.

        SELECTION-SCREEN: END OF BLOCK B1.

        ****START-OF-SELECTION.

        START-OF-SELECTION.

        V_REPID = SY-REPID.

        PERFORM GET_DATA.

        ***END-OF-SELECTION.

        END-OF-SELECTION.

        PERFORM GET_FIELDCAT.

        *PERFORM GET_LAYOUT.

        PERFORM BLOCK_ALV.

        &----


        *& Form GET_DATA

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM GET_DATA .

        SELECT A~CARRID

        A~CONNID

        A~FLDATE

        A~PRICE

        A~CURRENCY

        B~CITYFROM

        B~CITYTO

        INTO TABLE ITAB

        FROM SFLIGHT AS A JOIN SPFLI AS B ON

        ACARRID = BCARRID

        WHERE A~CARRID IN S_CARRID.

        ENDFORM. " GET_DATA

        &----


        *& Form GET_FIELDCAT

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM GET_FIELDCAT .

        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

        EXPORTING

        I_PROGRAM_NAME = SY-REPID

        I_INTERNAL_TABNAME = 'ITAB'

        • I_STRUCTURE_NAME =

        • I_CLIENT_NEVER_DISPLAY = 'X'

        I_INCLNAME = SY-REPID

        • I_BYPASSING_BUFFER =

        • I_BUFFER_ACTIVE =

        CHANGING

        CT_FIELDCAT = ITAB_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.

        ENDFORM. " GET_FIELDCAT

        &----


        *& Form BLOCK_ALV

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM BLOCK_ALV .

        PERFORM BLOCK_INIT.

        PERFORM BLOCK_APPEND.

        PERFORM BLOCK_DISPLAY.

        ENDFORM. " BLOCK_ALV

        &----


        *& Form BLOCK_INIT

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM BLOCK_INIT .

        CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

        EXPORTING

        I_CALLBACK_PROGRAM = V_REPID.

        ENDFORM. " BLOCK_INIT

        &----


        *& Form BLOCK_APPEND

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM BLOCK_APPEND .

        CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

        EXPORTING

        IS_LAYOUT = WA_LAYOUT

        IT_FIELDCAT = ITAB_FIELDCAT[]

        I_TABNAME = 'ITAB'

        IT_EVENTS = IT_EVENTS[]

        • IT_SORT =

        • I_TEXT = ' '

        TABLES

        T_OUTTAB = ITAB

        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.

        ENDFORM. " BLOCK_APPEND

        &----


        *& Form GET_LAYOUT

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM GET_LAYOUT .

        WA_LAYOUT-DEFAULT_ITEM = 'X'.

        WA_LAYOUT-ZEBRA = 'X'.

        APPEND WA_LAYOUT TO IT_LAYOUT.

        ENDFORM. " GET_LAYOUT

        &----


        *& Form BLOCK_DISPLAY

        &----


        • text

        ----


        • --> p1 text

        • <-- p2 text

        ----


        FORM BLOCK_DISPLAY .

        CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_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.

        ENDFORM. " BLOCK_DISPLAY

        hope this helps,

        do reward if it helps,

        priya.

        Add a comment
        10|10000 characters needed characters exceeded

      • author's profile photo Former Member
        Former Member
        Posted on Feb 26, 2007 at 09:50 AM

        Hi Vamsi,

        single list

        Output of a simple list (single-line)

        The function module outputs an internal table with whatever structure in

        the form of a formatted single- oder multi-line list.

        blocked list:

        check the following thread

        ALV function module

        hope this helps.

        Regards,

        Kinshuk

        Add a comment
        10|10000 characters needed characters exceeded

      • author's profile photo Former Member
        Former Member
        Posted on Feb 27, 2007 at 04:40 AM

        Chk the example below :

        /people/alvaro.tejadagalindo/blog/2006/11/27/dynamic-alv-list-display

        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.