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

ALV grid with 2 labels on the output

Hi,

I am trying ALV Grid with two labels using Function modules.

in the output, it should appear like...

Header1 | Header2 | Header3 | Header4 |


T21

T22

T31

T32


First line is for Header lable and second line is for item lable under corresponding Header labels.

Pls. can any suggest me a solution for this..

Thanks

PRa

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Aug 14, 2008 at 12:34 PM

    Using the Gird Functions it is not possible, you can get the with the help of ALV list function.

    If you use this aproach you will loose some Functionalities, Your Report Output will Distorted.

    cehck this image..

    http://img100.imageshack.us/img100/3846/output6ef.th.gif

    REPORT ZTEST_ALV message-id zz .
     
    TYPE-POOLS: SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    L_LAYOUT type slis_layout_alv,
    x_events type slis_alv_event,
    it_events type SLIS_T_EVENT.
     
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    MALE type i,
    female type i,
    END OF ITAB.
     
    SELECT VBELN
    POSNR
    FROM VBAP
    UP TO 20 ROWS
    INTO TABLE ITAB.
     
     
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
     
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-SELTEXT_L = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'MALE'.
    X_FIELDCAT-SELTEXT_L = 'MALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'FEMALE'.
    X_FIELDCAT-SELTEXT_L = 'FEMALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    x_events-NAME = SLIS_EV_TOP_OF_PAGE.
    x_events-FORM = 'TOP_OF_PAGE'.
    APPEND x_events TO iT_EVENTS.
    CLEAR x_events .
     
    L_LAYOUT-NO_COLHEAD = 'X'.
     
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = L_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    it_events = it_events
    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.
     
    FORM TOP_OF_PAGE.
     
    *-To display the headers for main list
    FORMAT COLOR COL_HEADING.
    WRITE: / SY-ULINE(103).
    WRITE: / SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (19) 'SEX'(015) centered,
    sy-vline.
     
    WRITE: / SY-VLINE,
    (8) 'VBELN'(013) ,
    SY-VLINE,
    (8) 'POSNR'(014) ,
    SY-VLINE,
    (8) 'MALE'(016) ,
    sy-vline,
    (8) 'FMALE'(017) ,
    sy-vline.
     
    FORMAT COLOR OFF.
     
    ENDFORM.

    Add a comment
    10|10000 characters needed characters exceeded

    • >Thanks for your reply. with this ALV list display, can I get the >totals and subtotals?

      >For this functionality only, I am looking for ALV.

      Sort/totals functionality will work. but you will loose the Output especially when use the option Change Layout your output will be distorted. Since we are fixing the Header using the top of page.

      >Is it not possible using ALV OOPS???

      No it is not possible to get the similar look using OO ALV.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 14, 2008 at 12:29 PM

    I think it is not possible in Grid. Using row_pos in field catalog you can achieve it in list display.

    Regards,

    Shano

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 14, 2008 at 12:43 PM

    I am totaly agree with vijay & shano

    But this can be done by using Classical Report

    Thanks

    Ganesh

    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.