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

ALV's HEAD


................DATE...................


..DAY..

....MONTH...

..YEAR..


....02...

.......12........

...2003...

....23...

.......03........

...2000...

Can do it with alv (2 heads)?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2007 at 01:01 PM

    Hi Javier,

    You can do it. See the below example.

    TYPE-POOLS:SLIS.

    DATA:X_FCAT TYPE SLIS_FIELDCAT_ALV,

    IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,

    X_LAYOUT TYPE SLIS_LAYOUT_ALV,

    X_EVENTS TYPE SLIS_ALV_EVENT,

    IT_EVENTS TYPE SLIS_T_EVENT,

    ITAB TYPE TABLE OF SFLIGHT WITH HEADER LINE.

    START-OF-SELECTION.

    SELECT CARRID CONNID PRICE FROM SFLIGHT

    INTO CORRESPONDING FIELDS OF TABLE ITAB.

    X_FCAT-COL_POS = '1'.

    X_FCAT-FIELDNAME = 'CARRID'.

    X_FCAT-TABNAME = 'SFLIGHT'.

    X_FCAT-SELTEXT_L = 'Airline Code'.

    APPEND X_FCAT TO IT_FCAT.

    CLEAR X_FCAT.

    X_FCAT-COL_POS = '1'.

    X_FCAT-FIELDNAME = 'CONNID'.

    X_FCAT-TABNAME = 'SFLIGHT'.

    X_FCAT-SELTEXT_L = 'Flight Connection No.'.

    APPEND X_FCAT TO IT_FCAT.

    CLEAR X_FCAT.

    X_FCAT-COL_POS = '1'.

    X_FCAT-FIELDNAME = 'PRICE'.

    X_FCAT-TABNAME = 'SFLIGHT'.

    X_FCAT-SELTEXT_L = 'Airfare'.

    APPEND X_FCAT TO IT_FCAT.

    CLEAR X_FCAT.

    X_LAYOUT-NO_COLHEAD = 'X'.

    X_EVENTS-NAME = 'TOP_OF_PAGE'.

    X_EVENTS-FORM = 'TOP_OF_PAGE'.

    APPEND X_EVENTS TO IT_EVENTS.

    CLEAR X_EVENTS.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = 'ZSOW_ALV8'

    IS_LAYOUT = X_LAYOUT

    IT_FIELDCAT = IT_FCAT

    IT_EVENTS = IT_EVENTS

    TABLES

    T_OUTTAB = ITAB

    .

    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 = 'ZSOW_ALV8'

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

    • I_BACKGROUND_ID = ' '

    • I_GRID_TITLE = I_GRID_TITLE

    • I_GRID_SETTINGS = I_GRID_SETTINGS

  • IS_LAYOUT = x_layout

  • IT_FIELDCAT = it_fcat

    • IT_EXCLUDING = IT_EXCLUDING

    • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

    • IT_SORT = IT_SORT

    • IT_FILTER = IT_FILTER

    • IS_SEL_HIDE = IS_SEL_HIDE

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT = IS_VARIANT

  • IT_EVENTS = IT_EVENTS

    • IT_EVENT_EXIT = IT_EVENT_EXIT

    • IS_PRINT = IS_PRINT

    • IS_REPREP_ID = IS_REPREP_ID

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_HTML_HEIGHT_TOP = 0

    • I_HTML_HEIGHT_END = 0

    • IT_ALV_GRAPHICS = IT_ALV_GRAPHICS

    • IT_HYPERLINK = IT_HYPERLINK

    • IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

    • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

    • IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

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

    FORM TOP_OF_PAGE.

    FORMAT COLOR COL_HEADING.

    WRITE: / SY-ULINE(47).

    WRITE: / SY-VLINE,(10) 'CARRID' CENTERED,

    SY-VLINE,(19) 'CONNID' CENTERED,

    SY-VLINE,(8) 'PRICE' CENTERED,SY-VLINE.

    FORMAT COLOR OFF.

    WRITE: / SY-ULINE(47).

    *write:/ sy-vline,(47) 'Display data' centered,47 sy-vline.

    WRITE: / SY-VLINE,(10) 'CARRID2' CENTERED,

    SY-VLINE,(19) 'CONNID2' CENTERED,

    SY-VLINE,(8) 'PRICE2' CENTERED,SY-VLINE.

    WRITE: / SY-VLINE,(10) 'CARRID3' CENTERED,

    SY-VLINE,(19) 'CONNID3' CENTERED,

    SY-VLINE,(8) 'PRICE3' CENTERED,SY-VLINE.

    ENDFORM.

    Regards

    Haritha.

Add a comment
10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2007 at 02:06 PM

    Hi,

    Yep...you can do this but as far as I know it will be done only in ALV list display.

    Please look at the code below which is for ALV output in multiple lines for a header.

    REPORT zpw_alv_multipleline .

    TYPE-POOLS slis .

    CONSTANTS : c_len TYPE i VALUE 20 .

    TYPES : BEGIN OF ty_t100 ,

    sprsl TYPE t100-sprsl ,

    arbgb TYPE t100-arbgb ,

    msgnr TYPE t100-msgnr ,

    text TYPE t100-text ,

    fline TYPE t100-text ,

    END OF ty_t100 .

    TYPES : BEGIN OF ty_wrd ,

    text TYPE char20 ,

    END OF ty_wrd .

    DATA : it_t100 TYPE TABLE OF ty_t100 ,

    it_sentence TYPE TABLE OF ty_wrd ,

    wa_t100 TYPE ty_t100 ,

    wa_word TYPE ty_wrd ,

    v_repid TYPE syst-repid ,

    v_tabix TYPE syst-tabix .

    DATA : it_fld TYPE slis_t_fieldcat_alv ,

    it_evt TYPE slis_t_event ,

    wa_fld TYPE slis_fieldcat_alv ,

    wa_evt TYPE slis_alv_event ,

    wa_lay TYPE slis_layout_alv .

    INITIALIZATION .

    v_repid = sy-repid .

    START-OF-SELECTION .

    • Get data

    SELECT *

    INTO TABLE it_t100

    FROM t100

    WHERE sprsl = 'EN'

    AND arbgb = '00' .

    LOOP AT it_t100 INTO wa_t100 .

    v_tabix = sy-tabix .

    CLEAR : it_sentence .

    CALL FUNCTION 'RKD_WORD_WRAP'

    EXPORTING

    textline = wa_t100-text

    outputlen = c_len

    TABLES

    out_lines = it_sentence.

    IF NOT it_sentence IS INITIAL .

    READ TABLE it_sentence INTO wa_word INDEX 1 .

    wa_t100-fline = wa_word-text .

    MODIFY it_t100 FROM wa_t100 INDEX v_tabix .

    ENDIF.

    ENDLOOP.

    • Prepare fieldcatelog

    CLEAR wa_fld .

    wa_fld-fieldname = 'SPRSL' .

    wa_fld-ref_tabname = 'T100' .

    wa_fld-ref_fieldname = 'SPRSL' .

    APPEND wa_fld TO it_fld .

    CLEAR wa_fld .

    wa_fld-fieldname = 'ARBGB' .

    wa_fld-ref_tabname = 'T100' .

    wa_fld-ref_fieldname = 'ARBGB' .

    APPEND wa_fld TO it_fld .

    CLEAR wa_fld .

    wa_fld-fieldname = 'MSGNR' .

    wa_fld-ref_tabname = 'T100' .

    wa_fld-ref_fieldname = 'MSGNR' .

    APPEND wa_fld TO it_fld .

    CLEAR wa_fld .

    wa_fld-fieldname = 'FLINE' .

    wa_fld-inttype = 'CHAR' .

    wa_fld-outputlen = 20 .

    wa_fld-intlen = 20.

    wa_fld-seltext_l = 'Text' .

    wa_fld-ddictxt = 'L' .

    APPEND wa_fld TO it_fld .

    • Get event.. we will handle BOFORE and AFTER line output

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    IMPORTING

    et_events = it_evt.

    READ TABLE it_evt INTO wa_evt

    WITH KEY name = slis_ev_after_line_output .

    wa_evt-form = slis_ev_after_line_output .

    MODIFY it_evt FROM wa_evt INDEX sy-tabix .

    READ TABLE it_evt INTO wa_evt

    WITH KEY name = slis_ev_top_of_page .

    wa_evt-form = slis_ev_top_of_page .

    MODIFY it_evt FROM wa_evt INDEX sy-tabix .

    wa_lay-no_colhead = 'X' .

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    i_callback_program = v_repid

    it_fieldcat = it_fld

    is_layout = wa_lay

    it_events = it_evt

    TABLES

    t_outtab = it_t100.

    ----


    • FORM top_of_page *

    ----


    • ........ *

    ----


    FORM top_of_page .

    ULINE AT 1(58) .

    FORMAT COLOR COL_HEADING .

    WRITE: / sy-vline ,

    02 'Header1' ,

    10 sy-vline ,

    11 'Header1' ,

    31 sy-vline ,

    32 'Header1' ,

    37 sy-vline ,

    38 'Header1' ,

    58 sy-vline .

    WRITE: / sy-vline ,

    02 'Header2' ,

    10 sy-vline ,

    11 'Header2' ,

    31 sy-vline ,

    32 'Header2' ,

    37 sy-vline ,

    38 'Header2' ,

    58 sy-vline .

    ENDFORM.

    ----


    • FORM AFTER_LINE_OUTPUT *

    ----


    FORM after_line_output USING rs_lineinfo TYPE slis_lineinfo .

    CLEAR : it_sentence ,

    wa_t100 .

    READ TABLE it_t100 INTO wa_t100 INDEX rs_lineinfo-tabindex .

    CHECK sy-subrc = 0 .

    CALL FUNCTION 'RKD_WORD_WRAP'

    EXPORTING

    textline = wa_t100-text

    outputlen = c_len

    TABLES

    out_lines = it_sentence.

    DESCRIBE TABLE it_sentence LINES v_tabix .

    CHECK v_tabix > 1 .

    LOOP AT it_sentence INTO wa_word FROM 2 .

    WRITE: / sy-vline ,

    10 sy-vline ,

    31 sy-vline ,

    37 sy-vline ,

    38 wa_word-text ,

    58 sy-vline .

    ENDLOOP.

    ENDFORM .

    Hope it will be useful.

    Thanks,

    Sandeep.

    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.