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

ALV list display

Hello,

is it possible to have three different internal tables to be displayed in an ALV list?

is there any function mudule for this??

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 Jan 11, 2007 at 05:40 AM

    ekko-ebeln = ekpo-ebeln

    ekpo-bukrs = bkpf-bukrs.

    i cant find any other link sorry .

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06:57 AM

    Hi ,

    Use the Block List Append Function Module .

    REUSE_ALV_BLOCK_LIST_APPEND

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

    • Date/Author: 26.08.2006 / Alvaro Tejada Galindo. *

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

    REPORT Z_DUMMY_ALV.

    ----


    • TYPE-POOLS *

    ----


    TYPE-POOLS: SLIS.

    ----


    • TABLES *

    ----


    TABLES: SCARR, SPFLI.

    ----


    • VARIABLES *

    ----


    DATA: G_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

    G_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,

    GT_PRINT TYPE SLIS_PRINT_ALV,

    GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

    GT_EVENTS TYPE SLIS_T_EVENT,

    G_PROGRAM TYPE SY-REPID,

    TAB_NAME TYPE STRING,

    W_TABIX TYPE STRING.

    ----


    • TYPES *

    ----


    TYPES: BEGIN OF TY_SPFLI,

    MANDT TYPE SPFLI-MANDT,

    CARRID TYPE SPFLI-CARRID,

    CONNID TYPE SPFLI-CONNID,

    COUNTRYFR TYPE SPFLI-COUNTRYFR,

    CITYFROM TYPE SPFLI-CITYFROM,

    AIRPFROM TYPE SPFLI-AIRPFROM,

    COUNTRYTO TYPE SPFLI-COUNTRYTO,

    CITYTO TYPE SPFLI-CITYTO.

    TYPES: END OF TY_SPFLI.

    TYPES: BEGIN OF TY_STUFF,

    TABNAME TYPE TABNAME,

    TDREF TYPE REF TO DATA,

    END OF TY_STUFF.

    DATA T_STUFF TYPE TABLE OF TY_STUFF WITH NON-UNIQUE KEY TABNAME.

    DATA: DESCR_STRUCT_REF TYPE REF TO CL_ABAP_STRUCTDESCR,

    DATAREF TYPE REF TO DATA,

    WA_FCAT TYPE LVC_S_FCAT,

    IT_FIELDCATALOG TYPE LVC_T_FCAT.

    ----


    • FIELD-SYMBOLS *

    ----


    FIELD-SYMBOLS: <LINE> TYPE ANY,

    <FIELD> TYPE ANY,

    <COMPONENT> TYPE ABAP_COMPDESCR,

    <DYN_TABLE> TYPE STANDARD TABLE,

    <FS> TYPE ANY,

    <DYN_WA>,

    <TABLE>.

    ----


    • INTERNAL TABLES *

    ----


    DATA: T_SPFLI TYPE STANDARD TABLE OF TY_SPFLI WITH HEADER LINE,

    T_SPFLI_HEADER TYPE STANDARD TABLE OF TY_SPFLI WITH HEADER LINE,

    T_SPFLI_DETAIL TYPE STANDARD TABLE OF TY_SPFLI WITH HEADER LINE.

    ----


    • MACROS *

    ----


    DEFINE CLEAN_TABLE.

    CLEAR &1.

    REFRESH &1.

    END-OF-DEFINITION.

    ----


    • SELECTION SCREEN *

    ----


    SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-B01.

    SELECT-OPTIONS:

    S_CARRID FOR SCARR-CARRID.

    SELECTION-SCREEN END OF BLOCK B01.

    ----


    • PRINCIPAL

    ----


    START-OF-SELECTION.

    PERFORM GET_DATA.

    PERFORM GENERATE_ALV.

    PERFORM GENERATE_ALV_LIST.

    ----


    • FORM GET_DATA *

    ----


    • Retrieve data *

    ----


    FORM GET_DATA.

    SELECT MANDT CARRID CONNID COUNTRYFR CITYFROM

    AIRPFROM COUNTRYTO CITYTO

    INTO TABLE T_SPFLI

    FROM SPFLI

    WHERE CARRID IN S_CARRID.

    IF NOT T_SPFLI[] IS INITIAL.

    T_SPFLI_HEADER[] = T_SPFLI[].

    DELETE ADJACENT DUPLICATES FROM T_SPFLI_HEADER

    COMPARING CARRID.

    ENDIF.

    ENDFORM.

    &----


    *& Form GENERATE_ALV *

    &----


    • Generate the ALV *

    ----


    FORM GENERATE_ALV.

    IF NOT T_SPFLI_HEADER[] IS INITIAL.

    PERFORM CUSTOM_DATA_ALV USING G_FIELDCAT[].

    PERFORM BUILD_SORT.

    ENDIF.

    ENDFORM. "GENERATE_ALV

    &----


    *& Form CUSTOM_DATA_ALV *

    &----


    • Create ALV Catalog. *

    ----


    FORM CUSTOM_DATA_ALV USING T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

    DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

    CLEAR: T_FIELDCAT.

    REFRESH: T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'CARRID'.

    L_FIELDCAT-SELTEXT_L = 'Airline carrier ID'.

    L_FIELDCAT-COL_POS = 1.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'CONNID'.

    L_FIELDCAT-SELTEXT_L = 'Flight connection Id'.

    L_FIELDCAT-COL_POS = 2.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'COUNTRYFR'.

    L_FIELDCAT-SELTEXT_L = 'Country key'.

    L_FIELDCAT-COL_POS = 3.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'CITYFROM'.

    L_FIELDCAT-SELTEXT_L = 'City of departure'.

    L_FIELDCAT-COL_POS = 4.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'AIRPFROM'.

    L_FIELDCAT-SELTEXT_L = 'Airport of departure'.

    L_FIELDCAT-COL_POS = 5.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'COUNTRYTO'.

    L_FIELDCAT-SELTEXT_L = 'Country key'.

    L_FIELDCAT-COL_POS = 6.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    CLEAR L_FIELDCAT.

    L_FIELDCAT-TABNAME = 'T_SPFLI'.

    L_FIELDCAT-FIELDNAME = 'CITYTO'.

    L_FIELDCAT-SELTEXT_L = 'Arrival city'.

    L_FIELDCAT-COL_POS = 7.

    L_FIELDCAT-OUTPUTLEN = 15.

    APPEND L_FIELDCAT TO T_FIELDCAT.

    ENDFORM. "CUSTOM_DATA_ALV

    &----


    *& Form BUILD_SORT *

    &----


    • Build Sort table *

    ----


    FORM BUILD_SORT.

    CLEAR G_SORT.

    G_SORT-SPOS = 1.

    G_SORT-FIELDNAME = 'CARRID'.

    G_SORT-UP = 'X'.

    APPEND G_SORT.

    ENDFORM.

    ----


    • FORM GENERATE_ALV_LIST *

    ----


    • Generate ALV list *

    ----


    FORM GENERATE_ALV_LIST.

    DATA L_STUFF TYPE TY_STUFF.

    G_PROGRAM = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

    EXPORTING

    I_CALLBACK_PROGRAM = G_PROGRAM.

    LOOP AT T_SPFLI_HEADER.

    W_TABIX = SY-TABIX.

    CLEAN_TABLE T_SPFLI_DETAIL.

    LOOP AT T_SPFLI INTO T_SPFLI_DETAIL

    WHERE CARRID EQ T_SPFLI_HEADER-CARRID.

    APPEND T_SPFLI_DETAIL.

    ENDLOOP.

    CONCATENATE 'TABLE_' W_TABIX INTO

    TAB_NAME.

    PERFORM CREATE_TABLE USING 'SPFLI' TAB_NAME.

    LOOP AT T_SPFLI_DETAIL ASSIGNING <LINE>.

    ASSIGN <DYN_WA> TO <TABLE>.

    <TABLE> = <LINE>.

    APPEND <DYN_WA> TO <DYN_TABLE>.

    ENDLOOP.

    PERFORM CREATE_ALV_LIST TABLES <DYN_TABLE>.

    ENDLOOP.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

    EXPORTING

    IS_PRINT = GT_PRINT.

    ENDFORM.

    ----


    • FORM CREATE_ALV_LIST *

    ----


    • Create ALV List *

    ----


    FORM CREATE_ALV_LIST TABLES T_TABLE STRUCTURE T_SPFLI_DETAIL.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    IT_FIELDCAT = G_FIELDCAT

    IS_LAYOUT = GS_LAYOUT

    I_TABNAME = 'T_SPFLI'

    IT_EVENTS = GT_EVENTS

    TABLES

    T_OUTTAB = T_TABLE.

    ENDFORM.

    ----


    • FORM CREATE_TABLE *

    ----


    • Create dynamic table *

    ----


    FORM CREATE_TABLE USING MY_TAB TAB_NAME.

    DATA L_STUFF TYPE TY_STUFF.

    CREATE DATA DATAREF TYPE (MY_TAB).

    ASSIGN DATAREF->* TO <FS>.

    DESCR_STRUCT_REF ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <FS> ).

    CLEAN_TABLE IT_FIELDCATALOG.

    LOOP AT DESCR_STRUCT_REF->COMPONENTS ASSIGNING <COMPONENT>.

    WA_FCAT-FIELDNAME = <COMPONENT>-NAME.

    WA_FCAT-REF_TABLE = MY_TAB.

    WA_FCAT-REF_FIELD = <COMPONENT>-NAME.

    APPEND WA_FCAT TO IT_FIELDCATALOG.

    ENDLOOP.

    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

    EXPORTING

    IT_FIELDCATALOG = IT_FIELDCATALOG

    IMPORTING

    EP_TABLE = DATAREF

    EXCEPTIONS

    OTHERS = 1.

    ASSIGN DATAREF->* TO <DYN_TABLE>.

    L_STUFF-TABNAME = TAB_NAME.

    CREATE DATA L_STUFF-TDREF LIKE LINE OF <DYN_TABLE>.

    ASSIGN L_STUFF-TDREF->* TO <DYN_WA>.

    ENDFORM. "CREATE_TABLE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06:57 AM

    i think it is not possible to pass 3 internal tables in alv list.

    regards

    shiba dutta

    Message was edited by:

    SHIBA DUTTA

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 06:58 AM

    you can use block list.

    regards

    shiba dutta

    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.