Two header line in ALV display

Hi ,
I want two header lines in ALV report using reuse_alv_grid_display .
Like
Factory-Sales
Qty   Value
10     1000
How to do that please help

Hi,
   I am giving the example code for 3 header line display. This may help you.
First declare Form, 
FORM TOP-OF-PAGE .
FREE TTOP .
FREE HTOP .
CLEAR TTOP .
HTOP-TYP = 'H' .
HTOP-INFO = 'LLYODS STEEL INDUSTRIES LIMITED, WARDHA' .
APPEND HTOP TO TTOP .
CLEAR HTOP .
HTOP-TYP = 'S' .
HTOP-INFO = MAT .
APPEND HTOP TO TTOP .
CLEAR HTOP .
HTOP-TYP = 'S' .
HTOP-INFO = PONO .
APPEND HTOP TO TTOP .
CLEAR HTOP .
HTOP-TYP = 'S' .
HTOP-INFO = item .
APPEND HTOP TO TTOP .
CLEAR HTOP .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
  EXPORTING
    IT_LIST_COMMENTARY       = TTOP
  I_LOGO                   =
  I_END_OF_LIST_GRID       =
  I_ALV_FORM               =
ENDFORM.
After that declare this form in your Grid or List like below.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                = ' '
  I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = SY-REPID
  I_CALLBACK_PF_STATUS_SET          = ' '
  I_CALLBACK_USER_COMMAND           = ' '
   I_CALLBACK_TOP_OF_PAGE            = 'TOP-OF-PAGE'
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
  I_GRID_TITLE                      =
  I_GRID_SETTINGS                   =
  IS_LAYOUT                         =
   IT_FIELDCAT                       = BTAB
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
  I_DEFAULT                         = 'X'
   I_SAVE                            = 'X'
  IS_VARIANT                        =
  IT_EVENTS                         =
  IT_EVENT_EXIT                     =
  IS_PRINT                          =
  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_HYPERLINK                      =
  IT_ADD_FIELDCAT                   =
  IT_EXCEPT_QINFO                   =
  IR_SALV_FULLSCREEN_ADAPTER        =
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           =
  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.
Regards,
Himanshu

Similar Messages

  • Header Line Per ALV group of items in GRID not LIST.

    Hello Experts,
    My question may seem very basic but i am stuck with it.
    I am using ALV Grid function (REUSE_ALV_GRID_DISPLAY) to display my ALV.
    Example Case :
    I have 10 line items .
    1)     2 line items are sports.
    2)     2 line items are books.
    3)     2 line items are Mobiles.
    My ALV displays like this :
    No.    Object     Object Type
    1)       Ball          sports
    2)       Bat          sports
    3)     Maths        Books
    4)     History      Books
    5)     Nokia         Mobiles
    6)     Samsung   Mobiles
    And i want it like this :
    No.     Object
    Sports <---- I want this to act as header per line item .
    1)        Ball
    2)        Bat
    Books
    3)       Maths
    4)       History
    Mobiles
    5)       Nokia
    6)       Samsung.
    I.e i need a row stating Object Type IN ALV Grid similar to how we make use of AT NEW EVENT in LIST REPORT.
    Thanks in Advance,
    Sudeep.
    Edited by: Sudeep Yerunkar on Jul 21, 2010 11:40 AM

    Hi,
    If GRID is a 'MUST' requirement, then you can try preparing your internal table in the manner you want the output.
    Something like this:
    - Sort the output internal table.
    - Loop on the output int table.
    - Use AT NEW object type
    - Append Object Type into another internal table
    - Then read rest of the records with same object type into another internal table and appending the same.
    Not sure about the efficieny but you can try.
    BR,
    Vishal.

  • How to get two header colums using alv?

    Hi,
    experts,
    I want to display alv output with two header columns like shows below:
    Subjects
    |   English       |         Maths       |     Science     |    Social   |         Politics                   |                
    100
    56
    89
    12
    85
    25
    85
    36
    78
    100
    75
    55
    65
    74
    100
    How to acheive this by using ALV Grid dispaly. please end me any document on this .
    Thanks in advance,
    Shabeer Ahmed.

    Hi,
    Please check the link given below :
    Two column header in ALV Report
    hope it will help you.
    Thanks & Regards,
    Sarita Singh Rathour

  • 2 header lines in ALV report

    Hello All,
                Does any one have any idea how to create 2 Header lines in an ALv report
    as in 1 cummulative header and under that 2nd detailed header.
    Please help me out.
    Cheers,
    Deepthee Kasal

    Hi,
    It is not possible to have 2 detailed headers in ALV reports.
    Regards,
    Satish

  • FCC -- Need two header lines

    Hi All,
    In my file receiver communication channel, I need to have 2 header line.
    In first header line hardcoded "UTF-8" needs to be written and second line will have actual column names.
    If its just one header with actual column names, I am able to achieve. But not sure how to add one more line on Top with "UTF-8".
    Please advice.
    Thanks
    Shivi

    Hi Shivanjali,
    We also face same requirement and we done this as below:
    create a target structure as below and map the hard coded value
    and in FCC we used below:
    Regards
    GB

  • Two header line in one column of alv grid.

    Hi Experts,
    My requirement is that I have to create an ALV report with columns having two lines of
    headings. Like a main heading called Consultants under which 5 to 10 columns of departments
    and then Contractors underwhich there would be 5 to 10 departments. Right now my report has
    the depts of contractors and consultants in one line but the headings above that I am not
    able to generate.
    Will anybody please be able to provide a sample code if this is possible.
    like,,,
               Heading 1        |  Heading 2   |     Heading3       |                   line 1     
    hed4  |  hed5  |  hed6  |                     |  hed7   |  hed8    |                  line 2

    Unfortunately the current ALV framework doesn't support multiple line headers in ALV. There are some nasty hacks available. But none of them are full-proof.
    BTW there are many posts related to similar requirements.
    BR,
    Suhas

  • I need two header line in table control

    Hi all,
    I am using table control. The requirement is to have 2 headers in the table control. for example., if their is field name ' Vendor Comments', I need to display 'Vendor' in one line and 'Comments' in next line. Is it possible to have such 2 headers for 1 field?
    If have answer please reply me.
    Thanks in advance,
    Kaarthick

    You cannot do this in table control in dynpro environment. Maybe you can check the ALV to get more flexibility about header titles.

  • How to align the contents in the header of an ALV Display?

    Hello ABAP Masters,
    I am doing a program that requires to display an ALV with header.
    My problem is that the header display is not in proper alignment.
    Here is a sample display of the header , which should not be:
    Contract Number:08151983
    Line Item:23
    Sequence Number:0005
    What should I display, must look like this:
    Contract Number:     08151983
    Line Item:                23
    Sequence Number:  005
    See, the contents should be in proper alignment.
    Please help me to solve my problem.
    Thank you.

    If u r using OOPS den use the class
    CL_DD_DOCUMENT
    and the method to be used is..
    ADD_GAP
    If not using OOPS then try CONCATENATE
    Here the values of Contract number etc shud be conaatenated wid a space..
    pass dis new var for displaying
    Hope this helps..reward if it does

  • Printing more than 1 header line in ALV

    How to print more than one line from header table before printing detail lines in REUSE_ALV_HIERSEQ_LIST_DISPLAY?

    Hi
    Hierarchical sequential list output.
    The function module is
    A.  REUSE_ALV_HIERSEQ_LIST_DISPLAY
    1. Export:
        a. I_CALLBACK_PROGRAM
        b. I_CALLBACK_PF_STATUS_SET
        c. I_CALLBACK_USER_COMMAND
        d. IS_LAYOUT
    e. IT_FIELDCAT
    f.  IT_EVENTS
    g. I_TABNAME_HEADER : Name of the internal table in the program containing the output data of the highest hierarchy level.
    h. I_TABNAME_ITEM : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    i. IS_KEYINFO : This structure contains the header and item table field names which link the two tables (shared key).
    2. Tables
      a. T_OUTTAB_HEADER  : Header table with data to be output
      b. T_OUTTAB_ITEM       :  Name of the internal table in the program containing the  output data of the lowest hierarchy level.
    if it is helpful reward points,
    thanks,
    sap-abap

  • ALV Display dynamic column with multiline header

    Hi All.
    I need to create alv display with dynamic number of columns. Also, it contains two header line. Kindly help me in coding.
    The required format is this format.
    Product | Week1 | Week2 |.......| WeekN
    |--||---|--
                | Sales   | Sales   |.......| Sales
    |--| |---|--
    PRD1   | value    | Value    |.......| Value
    PRD2   | value    | Value    |.......| Value
    PRD3   | value    | Value    |.......| Value
    Thanks.
    Sadhna

    Hi Sadhana,
    You mean to say that your internal Table contains
    ABCDEF are the fields in your Internal table.
    A--BCD---E-----F
    1--12---13---a11----1
    2--11---01---b9-----0
    3--01---00---c32----0
    4--14---01---d21----0
    Now using Dynamic Internal Table it should display the output as follow :
    A--BCF---a---b-c----d
    1--12---13---111-9-32--21
    Here you want to display the the fields of D as header and E as its corresponding values...?
    Please let me knwo if you mean the same..
    Regards,
    Kittu

  • ALV Header Line

    can i add 2 header lines in ALV Reporting, if so then how give example.
    abhishek suppal

    Hi,
    Copy the following code and execute, it will work fine.
    TYPE-POOLS: slis.
    DATA: BEGIN OF i_data OCCURS 0,
            qmnum      LIKE qmel-qmnum,
            qmart      LIKE qmel-qmart,
            qmtxt      LIKE qmel-qmtxt,
            ws_row     TYPE i,
            ws_char(5) TYPE c,
            chk,
          END OF i_data.
    DATA: report_id  LIKE sy-repid.
    DATA: ws_title   TYPE lvc_title VALUE 'An ALV Report'.
    DATA: i_layout   TYPE slis_layout_alv.
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: i_events   TYPE slis_t_event.
    DATA: i_header   TYPE slis_t_listheader.
    SELECT qmnum
           qmart
           qmtxt
           INTO TABLE i_data
           FROM qmel
           WHERE qmnum <= '00030000010'.
    LOOP AT i_data.
      i_data-ws_row = sy-tabix.
      i_data-ws_char = 'AAAAA'.
      MODIFY i_data.
    ENDLOOP.
    report_id = sy-repid.
    PERFORM f1000_layout_init CHANGING i_layout.
    PERFORM f2000_fieldcat_init CHANGING i_fieldcat.
    PERFORM f3000_build_header CHANGING i_header.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                = report_id
       i_grid_title                      = ws_title
       is_layout                         = i_layout
       it_fieldcat                       = i_fieldcat
       i_save                            = 'A'
      TABLES
        t_outtab                          = i_data
    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  F1000_Layout_Init
    FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.
      CLEAR i_layout.
      i_layout-colwidth_optimize = 'X'.
      i_layout-edit = 'X'.
    ENDFORM.                    " F1000_Layout_Init
    *&      Form  f2000_fieldcat_init
    FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: line_fieldcat TYPE slis_fieldcat_alv.
      CLEAR line_fieldcat.
      line_fieldcat-fieldname = 'QMNUM'.     " The field name and the table
      line_fieldcat-tabname   = 'I_DATA'.    " name are the two minimum req.
      line_fieldcat-key       = 'X'.  " Specifies the column as a key (Blue)
      line_fieldcat-seltext_m = 'Notification No.'. " Column Header
      APPEND line_fieldcat TO i_fieldcat.
      CLEAR line_fieldcat.
      line_fieldcat-fieldname = 'QMART'.
      line_fieldcat-ref_tabname = 'I_DATA'.
      line_fieldcat-hotspot = 'X'.           " Shows the field as a hotspot.
      line_fieldcat-seltext_m = 'Notif Type'.
      APPEND line_fieldcat TO i_fieldcat.
      CLEAR line_fieldcat.
      line_fieldcat-fieldname = 'QMTXT'.
      line_fieldcat-tabname   = 'I_DATA'.
      line_fieldcat-seltext_m = 'Description'.
      APPEND line_fieldcat TO i_fieldcat.
      CLEAR line_fieldcat.
      line_fieldcat-fieldname = 'WS_ROW'.
      line_fieldcat-tabname   = 'I_DATA'.
      line_fieldcat-seltext_m = 'Row Number'.
      APPEND line_fieldcat TO i_fieldcat.
      CLEAR line_fieldcat.
      line_fieldcat-fieldname = 'WS_CHAR'.
      line_fieldcat-tabname   = 'I_DATA'.
      line_fieldcat-seltext_l = 'Test Character Field'.
      line_fieldcat-datatype  = 'CHAR'.
      line_fieldcat-outputlen = '15'.     " You can specify the width of a
      APPEND line_fieldcat TO i_fieldcat. " column.
      CLEAR line_fieldcat.
      line_fieldcat-fieldname = 'CHK'.
      line_fieldcat-tabname   = 'I_DATA'.
      line_fieldcat-seltext_l = 'Checkbox'.
      line_fieldcat-checkbox  = 'X'.      " Display this field as a checkbox
      line_fieldcat-edit      = 'X'.      " This option ensures that you can
      " edit the checkbox. Else it will
      " be protected.
      APPEND line_fieldcat TO i_fieldcat.
    ENDFORM.                    " f2000_fieldcat_init
    *&      Form  f3000_build_header
    FORM f3000_build_header USING i_header TYPE slis_t_listheader.
      DATA: gs_line TYPE slis_listheader.
      CLEAR gs_line.
      gs_line-typ  = 'H'.
      gs_line-info = 'This is line of type HEADER'.
      APPEND gs_line TO i_header.
      CLEAR gs_line.
      gs_line-typ  = 'S'.
      gs_line-key  = 'STATUS 1'.
      gs_line-info = 'This is line of type STATUS'.
      APPEND gs_line TO i_header.
      gs_line-key  = 'STATUS 2'.
      gs_line-info = 'This is also line of type STATUS'.
      APPEND gs_line TO i_header.
      CLEAR gs_line.
      gs_line-typ  = 'A'.
      gs_line-info = 'This is line of type ACTION'.
      APPEND gs_line TO i_header.
    ENDFORM.                    " f3000_build_header
    Cheers,
    Venkat

  • Header Line not Displayed in Smartform

    Hi all,
    in Smartforms , i am having one Page.
    in the main window , in Footer i am having Grand total to be displayed in the last page. i have put condition
    SFSY-PAGE = SFSY-JOBPAGES.
    the Problem is in the last page the header line is not displayed.
    in all other pages it is getting displayed.
    Can anyone help me out.
    Regards.
    Suki.

    Ok. I got the problem now. There is not simple solution for this.
    You can create a new window just only for header. Put it on the same place as the Current Header line starts.
    Move the contents from Main table header line to Header window.
    This way, the header will print on all the pages.
    Regards,
    Naimesh Patel

  • How to add two heading in fieldcatlog

    Hello Exprets,
    I have an ALV report, in which I want two dispaly two header line... I don't no how to do that.
    for example.
    Class 10
    Class 11
    Class 12
    Class-A
    Class-B
    Class-C
    Class-D
    Class-A
    Class-B
    Class-C
    Class-D
    Class-A
    Class-B
    Class-C
    Class-D
    Can anyone please guide me in this issue.
    Thanks

    Hi Chetan,
    Try this program. It works.
    REPORT ZTEST_PROGRAM.
    DATA: BEGIN OF it_data OCCURS 0,
            header1 TYPE char50,
            header2 TYPE char50,
            arbgb TYPE t100-arbgb,
            msgnr TYPE t100-msgnr,
            text TYPE t100-text,
          END OF it_data.
    *ALV Declarations
    TYPE-POOLS:slis.
    TYPES:
       ty_fieldcat          TYPE slis_fieldcat_alv,
       ty_events            TYPE slis_alv_event,
       ty_layout            TYPE slis_layout_alv.
    DATA:
       wa_fieldcat          TYPE ty_fieldcat,
       wa_events            TYPE ty_events,
       wa_layout            TYPE ty_layout.
    DATA:
       it_events            TYPE STANDARD TABLE OF ty_events,
       it_fieldcat          TYPE STANDARD TABLE OF ty_fieldcat.
    DATA:
       g_program            TYPE sy-repid.
    START-OF-SELECTION.
      SELECT * FROM t100 INTO CORRESPONDING FIELDS OF TABLE it_data
      UP TO 20 ROWS WHERE sprsl = sy-langu.
    *Fieldcatalog.
      PERFORM fieldcatalog
      USING:                            "Field Lengths
      1 1 'HEADER1' 'IT_DATA' 'HEADER1' '30',
      1 2 'HEADER2' 'IT_DATA' 'HEADER2' '73',
      2 3 'ARBGB'   'IT_DATA' 'ARBGB'   '20',
      2 4 'MSGNR'   'IT_DATA' 'MSGNR'   '10',
      2 5 'TEXT'    'IT_DATA' 'TEXT'    '73'.
      wa_layout-info_fieldname = 'COLOR'.
      g_program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = g_program
          is_layout          = wa_layout
          it_fieldcat        = it_fieldcat
          it_events          = it_events
        TABLES
          t_outtab           = it_data
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING row_pos col_pos field table f_txt outputlen.
      wa_fieldcat-row_pos   = row_pos.
      wa_fieldcat-col_pos   = col_pos.
      wa_fieldcat-fieldname = field.
      wa_fieldcat-tabname   = table.
      wa_fieldcat-seltext_l = f_txt.
      wa_fieldcat-outputlen = outputlen.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " FIELDCATALOG
    Thanks
    Venkat.O

  • ALV Display   in this Format

    Hi All ,
    I have a problem  in ALV  grid /List... I can  print the data in two  header line and item lines. But needed output in three header /line  items as shown :
    Basic
    LTA
    MED
    Educ
    Other
    VDA
    15000
    1000
    500
    6000
    600
      500000         6000      8000   
    For this  i have used hirechical list. but cann't get the output...
    Regards
    Lakhan

    fight and win the race........solved Thanks SDN

  • Query on ALV display

    Hi All,
    I have a following requirement:
    To display PO Header and line items in ALV.
    Now for header, there should be a check box corresponding to each header line in ALV which will enable user to select that particular line and release PO 
    Is it possible to achieve my requirement?
    Regards
    Shiva

    Specify the first column of ALV grid as
    <b>CHECKBOX  LVC_CHECKB- type  CHAR(1)  SPACE, 'X'</b>
    1. You will have to make the field editable. In the field catalog set the EDIT = 'X' for the check box field.
    2. Once the check box is checked, call the method CHECK_CHANGED_DATA of the grid in the PAI of the screen which will update the internal table. Now, you can just loop at the internal table with a where clause on the check box field.
    loop at itab where checkbox = 'x'.
    endloop.
    same thread...
    Re: Output Format for Amount in SAP Script PO
    Re: Checkbox in ALV

Maybe you are looking for