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

ALV Grid

Is it possible to do this with ALV grid

have a line above the columns to show sub topic, something like:-

To Quay

From Quay

col1 | col2 | col3 | col4 |col5 | col6 | col7 |

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 11:07 AM

    Hi,

    Ur requirement is not possible in ALV Grid but it is possible in ALV Hierachical report....

    Here i am sending sample code for ur refference....please test it in ur system

    &----


    *& Report ZHER *

    *& *

    &----


    *& *

    *& *

    &----


    REPORT ZHER. "#EC NEEDED

    *REPORT ZALV_HIERARCHIAL.

    TYPE-POOLS:SLIS.

    TABLES: EKKO,EKPO.

    DATA : BEGIN OF IT_EKKO OCCURS 0,

    EBELN LIKE EKKO-EBELN,

    BUKRS LIKE EKKO-BUKRS,

    LIFNR LIKE EKKO-LIFNR,

    BEDAT LIKE EKKO-BEDAT,

    END OF IT_EKKO.

    DATA : BEGIN OF IT_EKPO OCCURS 0,

    SNO LIKE EKPO-EBELN,

    EBELP LIKE EKPO-EBELP,

    MENGE LIKE EKPO-MENGE,

    NETWR LIKE EKPO-NETWR,

    END OF IT_EKPO.

    DATA V_REPID LIKE SY-REPID.

    DATA IT_FIELDCAT TYPE SLIS_FIELDCAT_ALV OCCURS 0 WITH HEADER LINE.

    DATA X_KEYINFO TYPE SLIS_KEYINFO_ALV.

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

    SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.

    SELECTION-SCREEN END OF BLOCK B1.

    sy-title = ''.

    INITIALIZATION.

    V_REPID = SY-REPID.

    *S_EBELN-LOW = '4500000000'.

    *S_EBELN-SIGN = 'I'.

    *S_EBELN-OPTION = 'EQ'.

    *S_EBELN-HIGH = '6000000270'.

    *APPEND S_EBELN.

    START-OF-SELECTION.

    PERFORM GET_DATA.

    PERFORM GET_FIELD.

    PERFORM GET_KEY.

    PERFORM KEY_MODIFY.

    PERFORM DISPLAY.

    &----


    *& Form get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_DATA.

    SELECT EBELN BUKRS LIFNR BEDAT

    FROM EKKO

    INTO TABLE IT_EKKO UP TO 20 ROWS

    WHERE EBELN IN S_EBELN.

    SELECT EBELN EBELP MENGE NETWR

    FROM EKPO

    INTO TABLE IT_EKPO UP TO 20 ROWS

    WHERE EBELN IN S_EBELN.

    ENDFORM. " get_data

    &----


    *& Form get_field

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_FIELD.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = V_REPID

    I_INTERNAL_TABNAME = 'IT_EKKO'

    I_INCLNAME = V_REPID

    CHANGING

    CT_FIELDCAT = IT_FIELDCAT[].

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = V_REPID

    I_INTERNAL_TABNAME = 'IT_EKPO'

    I_INCLNAME = V_REPID

    CHANGING

    CT_FIELDCAT = IT_FIELDCAT[]

    *=

    EXCEPTIONS

    INCONSISTENT_INTERFACE = 1

    PROGRAM_ERROR = 2

    OTHERS = 3

    .

    IF SY-SUBRC <> 0.

    WRITE : 'NOT SUCCESS'.

    ENDIF.

    ENDFORM. " get_field

    &----


    *& Form get_key

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_KEY.

    X_KEYINFO-HEADER01 = 'EBELN'.

    X_KEYINFO-ITEM01 = 'SNO'.

    ENDFORM. " get_key

    &----


    *& Form DISPLAY

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM DISPLAY.

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = V_REPID

    IT_FIELDCAT = IT_FIELDCAT[]

    I_TABNAME_HEADER = 'IT_EKKO'

    I_TABNAME_ITEM = 'IT_EKPO'

    IS_KEYINFO = X_KEYINFO

    TABLES

    T_OUTTAB_HEADER = IT_EKKO

    T_OUTTAB_ITEM = IT_EKPO

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    WRITE : 'NOT SUCCESS'.

    ENDIF.

    ENDFORM. " DISPLAY

    &----


    *& Form key_modify

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM KEY_MODIFY.

    LOOP AT IT_FIELDCAT. "Avoid Repitiotion of data.

    CASE IT_FIELDCAT-FIELDNAME.

    WHEN 'SNO'.

    IF IT_FIELDCAT-TABNAME = 'IT_EKPO'.

    IT_FIELDCAT-NO_OUT = 'X'.

    IT_FIELDCAT-KEY = SPACE.

    ENDIF.

    ENDCASE.

    MODIFY IT_FIELDCAT INDEX SY-TABIX.

    ENDLOOP.

    ENDFORM. " key_modif

    reward me if it is use full answer.

    praveen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 09:45 AM

    no it's not possible.

    regards

    Sameer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 09:45 AM

    hi,

    I think this is possible through Hierarchical ALV

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 10:50 AM

    With ALV grid , you can not do this.

    But with ALV list - <b>YES.</b>

    You can refer to transaction ME28 ( Purcahse Order Release). The output will be like that only.

    Hope it helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 01:23 PM

    it cant be done the way i would have hoped - thanks for the replies

    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.