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

Similar Messages

  • 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

  • How to get header in the ALV report

    Hi
    I want to print header in the ALV report.But i am not getting that.Plz see my program it is getting error and also not printing header.If there is any error means plz give me the solution.In this program there is an error.
    REPORT  ZREPORT_ALV .
    TYPE-POOLS : slis.
    tables:vbak,vbap.
    DATA:  report_id LIKE sy-repid.
    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    data: heading        TYPE slis_t_listheader,
          wa_header      TYPE slis_listheader,
         events         TYPE slis_t_event.
    data: l_string type c.
    data: ivariant(1) type c,
          itvariant like disvariant,
          w_variant like disvariant.
    initialization.
    REPORT_ID = SY-REPID.
    PERFORM pgm. "F1000_LAYOUT_INIT. "using I_LAYOUT.
    ivariant = 'A'.
    *PERFORM init.
    itvariant = w_variant.
    select-options:so_vbeln for vbap-vbeln.
    data:itab like vbak occurs 0 with header line.
    data:itab1 like vbap occurs 0 with header line.
    start-of-selection.
    select * from vbak into table itab where vbeln in so_vbeln.
    if not itab[] is initial.
    select * from vbap into table itab1
    for all entries in itab
    where vbeln = itab-vbeln.
    endif.
    data:ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat1  TYPE slis_t_fieldcat_alv.
    ****For alv display
    IF NOT itab1[] IS INITIAL.
       DEFINE ls_fieldcat.
       add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname    = &1.
        ls_fieldcat-outputlen    = &2.
        ls_fieldcat-seltext_l    = &3.
         ls_fieldcat-emphasize  = &4.
        append ls_fieldcat to lt_fieldcat1.
        clear ls_fieldcat.
      END-OF-DEFINITION.
        ls_fieldcat 'VBELN'           '10'     'Sales Order Number'.
       ls_fieldcat 'POSNR'           '6'        'SO Item'.
        ls_fieldcat 'MATNR'           '13'      'Material No'.
    m_fieldcat1 'NETWR'           '13'        'Amount'.
    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            = ' '
      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                         =  I_LAYOUT
       IT_FIELDCAT                       =  lt_fieldcat1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =   ITVARIANT
      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                          =  itab1
    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.
    endif.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
       I_SAVE              = ivariant
      CHANGING
       CS_VARIANT          = itvariant
    EXCEPTIONS
      WRONG_INPUT         = 1
      NOT_FOUND           = 2
      PROGRAM_ERROR       = 3
      OTHERS              = 4
    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  pgm. "F1000_LAYOUT_INIT. "USING I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    CLEAR I_LAYOUT.
    i_layout-colwidth_optimize = 'X'.
    I_LAYOUT-key_hotspot = u2018Xu2019.
    I_LAYOUT-hotspot_fieldname =  MATNR.
    ENDFORM.
    *regarding logo and header,,,,
    *first store the logo in T-code OAOR, then call that in your report.....
    *data: heading        TYPE slis_t_listheader,
         wa_header      TYPE slis_listheader,
        events         TYPE slis_t_event.
    To display TOP_OF_PAGE.
    FORM top_of_page.
      DATA : text(40),txtdt(40).
      CLEAR l_string.
      l_string = 'JCB India Limited'(hd2).
      wa_header-typ  = 'H'.
      wa_header-info = l_string.
      APPEND wa_header TO heading.                              " index 1.
      CLEAR l_string.
      WRITE :'Number of records:' TO text,'dbcnt' TO text+20 LEFT-JUSTIFIED.
      wa_header-typ  = 'S'.
      wa_header-info = text.
      APPEND wa_header TO heading.
    CLEAR l_string.
    wa_header-typ  = 'S'.
    WRITE : 'Report Run Date  :' TO txtdt,sy-datum TO txtdt+20 DD/MM/YY.
    WRITE sy-datum TO dat DD/MM/YY.
    wa_header-info = txtdt.
    APPEND wa_header TO heading.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         i_logo             = 'ENJOYSAP_LOGO'
          it_list_commentary = heading.
      CLEAR heading.
    ENDFORM.                    "top_of_page
    *to execute top-of-page you have to create events.
    *for ex......
    FORM create_event USING p_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events.
      READ TABLE p_events WITH KEY name = slis_ev_top_of_page
                             INTO ls_event.
      IF sy-subrc = 0.
        MOVE formname_top_of_page TO ls_event-form.
        APPEND ls_event TO p_events.
      ENDIF.
    ENDFORM.                    " create_event

    Hi,
       Find below code for your question, you may get some idea,,
    *& Report  ZACTIONGRIDPRACTICE
    REPORT  ZACTIONGRIDPRACTICE.
    *data declarations.....
    TYPE-POOLS SLIS.
    TABLES : T529T ,PA0000.
    data : gd_repid type  sy-repid.
    DATA : LD_COLOR(10) TYPE N.
    DATA : GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV.
    Data:  is_fieldcat TYPE slis_fieldcat_alv.
    DATA : GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA : GD_DATUM TYPE DATUM.
    DATA : BEGIN OF WA_TABLE,
                    MASSN TYPE T529T-MASSN,
                    MNTXT TYPE T529T-MNTXT,
                    userg type userg,
                    TOTAL TYPE I ,
                    begda type begda,
                    endda type endda,
                    april type i,
                    SLNO TYPE I,
                      LINE_COLOR(4) TYPE C,
                    END OF WA_TABLE,
                    IT_TABLE LIKE TABLE OF WA_TABLE.
    data : april type i.
    DATA : TEMP TYPE C.
    data :    LT_PA0000 TYPE TABLE OF PA0000,
              LT_PA0000_T typE TABLE OF PA0000 with header line.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
            WA_FCAT LIKE LINE OF IT_FCAT.
    DATA : IT_EVENTS TYPE SLIS_T_EVENT,
            WA_EVENTS LIKE LINE OF IT_EVENTS.
            wa_events-form = 'HEADER'.
    WA_EVENTS-NAME = 'TOP_OF_PAGE'.
    APPEND WA_EVENTS TO IT_EVENTS.
    PERFORM HEADER.
    DATA : SLNO TYPE I.
    DATA : lv_output      TYPE  dats.
    CALL FUNCTION 'ZHR_RE_BE_CALC_START_DATE'
      EXPORTING
        id_daberi   = sy-datum
      IMPORTING
        ed_date_cor = lv_output.
    select-options...
    selection-screen BEGIN OF BLOCK B WITH FRAME TITLE TEXT-003.
    select-options : s_date for sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B.
    lv_output = sy-datum - 27.
    INITIALIZATION.
    S_DATE-LOW = lv_output.
    S_DATE-HIGH = SY-DATUM.
    S_DATE-SIGN = 'I'.
    S_DATE-OPTION = 'BT'.
    APPEND s_date.
    *AT SELECTION-SCREEN ON S_DATE.
    *SELECT MASSN INTO TABLE IT_TABLE FROM PA0000 WHERE BEGDA IN S_DATE.
    *SELECT STATEMENTS....
    start-of-selection.
      SELECT   t529t~MASSN t529t~MNTXT  INTO TABLE IT_table  FROM T529T where SPRSL EQ 'E' and t529t~massn in ('10','13','16','20','28','30','45','01','03') .
    DATUM IN S_DATE.
    PERFORM LAYOUT.
      loop at it_table into wa_table.
    LD_COLOR = 2.
      LD_COLOR = LD_COLOR + 1.
    if LD_COLOR = 8.
    LD_COLOR = 1.
    endif.
    concatenate 'C' '1' '11'  into wa_table-LINE_COLOR . "='C410'.
    modify it_table from wa_table.
    endloop.
      LOOP AT IT_TABLE INTO WA_TABLE." = 'C410'.
    select massn from pa0000 into table lt_pa0000 where begda in s_date and  massn = wa_table-massn.
    *write : / sy-dbcnt.  gt s_date-low and endda lt s_date-high
    *DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    move sy-dbcnt to wa_table-total.
    READ TABLE lt_pa0000 INTO LT_PA0000_T WITH KEY MASSN = wa_TABLE-MASSN BINARY SEARCH.
    DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    MOVE  LV_LINES to  wa_TABLE-TOTAL.
      MODIFY IT_TABLE FROM WA_TABLE.
    MOVE SY-TABIX TO WA_TABLE-SLNO.
      MODIFY IT_TABLE FROM WA_TABLE.
    REFRESH : LT_PA0000_t.
    CLEAR : LV_LINES.
      ENDLOOP.
    loop at it_table into wa_table.
    SELECT MASSN FROM PA0000 INTO TABLE lt_pa0000 where begda between '01.02.2008' and '20.02.2008'.
    MOVE SY-DBCNT TO   WA_TABLE-APRIL.
    MODIFY IT_TABLE FROM WA_TABLE.
    *endloop.
    *PERFORM STATEMENTS...
    PERFORM FCAT USING '1' 'MASSN' 'ACTIONCODE'.
    PERFORM FCAT USING '2' 'MNTXT' 'ACTION TYPE'.
    PERFORM fcat USING '3' 'TOTAL' 'TOTAL'.
    DEFINE m_fieldcat.
        is_fieldcat-fieldname = &1.
        is_fieldcat-hotspot = &2.
        is_fieldcat-seltext_m = &3.
        is_fieldcat-col_pos = &4.
        is_fieldcat-outputlen = &5.
        is_fieldcat-hotspot = &6.
        append is_fieldcat to it_fcat.
        clear is_fieldcat.
      END-OF-DEFINITION.
       m_fieldcat 'SLNO' '' Text-012 '1' '17'  ''.
      m_fieldcat 'MASSN' '' Text-010 '2' '40'  ''.
      m_fieldcat 'MNTXT'  ''  Text-009  '3' '50' ''  .
      m_fieldcat 'TOTAL'  ''  Text-011  '4' '10' 'X'.
      m_fieldcat 'april'  ''  Text-013  '5' '10' 'X'.
    *FOR DISPLAYING THE RECORDS...
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = gd_repid
      IS_LAYOUT = GD_LAYOUT
      I_CALLBACK_USER_COMMAND           = ' '
       I_GRID_TITLE                      = 'REPORT'
       IS_LAYOUT                         = gd_LAYOUT
       IT_FIELDCAT                       = IT_FCAT
       I_SAVE                            = 'X'
       IT_EVENTS                         = IT_EVENTS
      TABLES
        T_OUTTAB                          = IT_TABLE.
    **&      Form  FCAT
    *FORM FCAT  USING   FP_COL_POS
                     FP_FIELDNAME
                     FP_SELTEXT_M.
    WA_FCAT-COL_POS = FP_COL_POS.
    WA_FCAT-FIELDNAME = FP_FIELDNAME.
    wa_fcat-seltext_m = fp_seltext_m.
    APPEND WA_FCAT TO IT_FCAT.
    ENDFORM.
    *&      Form  HEADER
          text
    -->  p1        text
    <--  p2        text
    form header .
      DATA : IT_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER LIKE LINE OF it_header.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'ACTION TYPE REPORT'.
      APPEND WA_HEADER TO IT_HEADER.
      wa_header-typ  = 'S'.
      wa_header-key = Text-022.
      CONCATENATE  s_date-low+6(2) '.'
                   s_date-low+4(2) '.'
                   s_date-low(4)
                   temp
                   '.     TO      .'
                   s_date-high+6(2) '.'
                   s_date-high+4(2) '.'
                   s_date-high(4)
                   INTO wa_header-info SEPARATED BY space.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_HEADER
          I_LOGO             = 'HRRU_51050061'.
    *select single bstkd into CORRESPONDING FIELDS OF gt_vbkd
    *from vbkd where vbeln = rt_outtab-vgbel
    *and posnr = '000000'.
    *rt_outtab-bstkd = gt_vbkd-bstkd.
    ENDFORM.                    " HEADER
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
    GD_LAYOUT-NO_INPUT = ''.
    gd_layout-colwidth_optimize = ''.
    gd_layout-totals_text = 'TOTALS'(201).
    gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " LAYOUT

  • How to insert horizontal lines in alv report?

    hi,
        i have to insert horizontal lines in alv report.( RM07MLBB )
            actually my requirement is:
                               basis list = RM07MLBB.
    first secondary list = another report is called here ( RM07DOCS )
                      i want to insert horizontal lines in the first secondary list, when i execute individually RM07DOCS , i can get horizontal lines, but when i dounle click in the basic list --> in the first secondary list , i am not getting the horizontal lnes.
    functional modules used are REUSE_ALV_HIERSEQ_LIST_DISPLAY & REUSE_ALV_GRID_DISPLAY.
        here in this program,
                        is_layout = alv_layout.
    hence i tried to give     
                  alv_layout-no_hline = ' '. 
    but not effecting.
              can some one please tell me , how to insert lines in the alv report.
    thanks in advance,
    Dastagir.

    hello,
         so i cannot insert horizontal lines in the first secondary list according to my sorting condition, i.e., in a single block there should be :
           if same delivery challan number is repeating they should come in the same block,
    for the corresponding delivery challen number, if have po number, is repeating , they also should come in the same block.
                       in this way i have to seperate the blocks containing EXNUM , EBELN CONDITIONED.

  • Issue in displaying header details in ALV report

    Hi,
    I have used slis_t_listheader and REUSE_ALV_COMMENTARY_WRITE to display the header details in ALV report.I want the details to be displayed as below.
    Requester : ----------------------                                                                               Page: 1
    Program: -----------------------                                                                                Date:---------
                                                                     Title of Report
    But when I use the structure slis_t_listheader to display the header details,all the fields are coming one below the other.
    How can I get the fields as shown in the above format
    Edited by: Abaper12345 on Jun 25, 2009 7:54 AM

    Hi,
    Go through following code... its showing the data exactly the way you want....
    REPORT  TEST3.
    TYPE-POOLS:slis.
    TABLES:MARA.
    *Type Declaration
    TYPES:BEGIN OF t_mara,
          matnr TYPE mara-matnr,
          ersda TYPE mara-ersda,
          ernam TYPE mara-ernam,
          END OF t_mara.
    *Internal Table
    data:it_mara type standard table of t_mara.
    *Work Area
    data:wa_mara type t_mara.
    DATA:i_repid TYPE sy-repid .
    i_repid = sy-repid.
    *Declaration for field catalog
    DATA : fcat TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv.
    *Declaration for Layout
    data : WA_LAYOUT type SLIS_LAYOUT_ALV.
    *Initializing ColumnWidth_Optimize For Layout
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    START-OF-SELECTION
    START-OF-SELECTION.
    *Fetching data into internal tables
      PERFORM get_data.
    *Buil Fieldcatalog
      PERFORM build_fcat.
    *Display ALV Report
      PERFORM alv_display.
    *Build Fieldcat
    FORM build_fcat .
      wa_fcat-tabname = 'IT_MARA'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-inttype = 'C'.
      wa_fcat-seltext_m = 'Material Number'.
      wa_fcat-outputlen = 25.
      wa_fcat-col_pos = 1.
      APPEND wa_fcat TO fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'IT_MARA'.
      wa_fcat-fieldname = 'ERSDA'.
      wa_fcat-inttype = 'C'.
      wa_fcat-seltext_m = 'Date'.
      wa_fcat-outputlen = 25.
      wa_fcat-col_pos = 1.
      APPEND wa_fcat TO fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'IT_MARA'.
      wa_fcat-fieldname = 'ERNAM'.
      wa_fcat-inttype = 'C'.
      wa_fcat-seltext_m = 'User'.
      wa_fcat-outputlen = 25.
      wa_fcat-col_pos = 1.
      APPEND wa_fcat TO fcat.
      CLEAR wa_fcat.
      endform.
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    form GET_DATA .
    select matnr ersda ernam from mara into table it_mara.
    endform.                    " GET_DATA
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form ALV_DISPLAY .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = i_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
       I_CALLBACK_HTML_TOP_OF_PAGE       = '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                       = fcat
      TABLES
        t_outtab                          = it_mara
    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.
    endform.                    " ALV_DISPLAY
    *&      Form  html_top_of_page " I_CALLBACK_HTML_TOP_OF_PAGE  "
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
    CALL METHOD document->add_text
      EXPORTING
        text          = 'Program'
        sap_color     = document->list_group
        sap_fontstyle = document->standard
       sap_emphasis  = document->strong.
    CALL METHOD document->new_line
      EXPORTING
        repeat = 1
    CALL METHOD document->add_text
      EXPORTING
        text          = 'Requester'
        sap_color     = document->list_group
        sap_fontstyle = document->standard
       sap_emphasis  = document->strong.
    CALL METHOD document->new_line
      EXPORTING
        repeat = 1
    CALL METHOD document->add_gap
      EXPORTING
         width      = 125
    CALL METHOD document->add_text
      EXPORTING
        text          = 'This Is Test Data'
        sap_color     = document->list_group
       sap_fontsize  = document->LARGE
       sap_fontstyle = document->standard
       sap_emphasis  = document->strong.
    ENDFORM.                    "HTML_TOP_OF_PAGE
    Thanks & Regards
    Ashu SIngh

  • Need to display data on the right side in the header area of alv report.

    hi experts,
                       I want to display data in the header area of alv report on the right side  . I have already used function for events on the header side data is getting displayed on the left side .but i want data to be displayed on the right side.
    regards,
    andrews.

    Hi,
    Hope this below code helps you.
    Take care,
    Çağatay.
    * build header for alv
    FORM top_of_page_split USING r_top TYPE REF TO cl_dd_document.
    DATA: s_tab TYPE sdydo_text_table,
          c_area TYPE REF TO cl_dd_area,
          text TYPE sdydo_text_element.
    TYPES: BEGIN OF tab_text,
    text TYPE sdydo_text_element,
    END OF tab_text.
    DATA: i_text TYPE TABLE OF tab_text.
    DATA: w_text TYPE tab_text.
    CALL METHOD r_top->initialize_document.
    CALL METHOD r_top->vertical_split
    EXPORTING
    split_area = r_top
    split_width = '70%'
    IMPORTING
    right_area = c_area.
    CONCATENATE sy-datum+4(2)
    sy-datum+6(2)
    sy-datum(4)
    INTO date1.
    CONCATENATE 'DATE'  date1
    INTO w_text-text
    SEPARATED BY ':'.
    APPEND w_text TO i_text.
    CONCATENATE 'time:' sy-uzeit INTO w_text .
    APPEND w_text TO i_text.
    CONCATENATE 'uesr:' sy-uname INTO w_text .
    APPEND w_text TO i_text.
    CONCATENATE 'local date:' sy-datlo INTO w_text .
    APPEND w_text TO i_text.
    CONCATENATE 'time zone:' sy-zonlo INTO w_text .
    APPEND w_text TO i_text.
    s_tab[] = i_text[].
    CALL METHOD c_area->add_text
    EXPORTING
    text_table = s_tab
    fix_lines = 'X'
    sap_fontsize = cl_dd_document=>medium
    sap_emphasis = cl_dd_document=>strong.
    CALL METHOD r_top->add_gap
    EXPORTING
    width = 60.
    text = 'THIS IS REPORT HEADING'.
    CALL METHOD r_top->add_text
    EXPORTING
    text = text
    sap_emphasis = 'STRONG'.
    CALL METHOD r_top->new_line.
    CALL METHOD r_top->add_gap
    EXPORTING
    width = 70.
    text = 'THIS IS REPORT HEADING1'.
    CALL METHOD r_top->add_text
    EXPORTING
    text = text
    sap_emphasis = 'STRONG'.
    CALL METHOD r_top->new_line.
    CALL METHOD r_top->add_gap
    EXPORTING
    width = 80.
    text = 'THIS IS REPORT HEADING2'.
    CALL METHOD r_top->add_text
    EXPORTING
    text = text
    sap_emphasis = 'STRONG'.
    CALL METHOD r_top->new_line.
    text = 'Report Subheading1'.
    CALL METHOD r_top->add_text
    EXPORTING
    text = text
    sap_emphasis = 'NORMAL'.
    CALL METHOD r_top->new_line.
    text = 'Report Subheading2'.
    CALL METHOD r_top->add_text
    EXPORTING
    text = text
    sap_emphasis = 'NORMAL'.
    CALL METHOD r_top->new_line.
    text = 'Report Subheading3'.
    CALL METHOD r_top->add_text
    EXPORTING
    text = text
    sap_emphasis = 'NORMAL'.
    CALL METHOD r_top->new_line.
    ENDFORM. "TOP_OF_PAGE_SPLIT

  • Field description in two line in ALV report

    Hi ,
    In ALV report I  want the description for each field to be displayed in two lines . For example
    the description for field matnr is " Material No for grade A " which is displayed in one line . But i want to display it as :  Material No
                                                           for grade A
    in two lines . Is it possible . Please help me out .
    Neetesh

    Hi Neetesh,
      Its not possible to display as you like in 2 lines header for single column. But i can provide the alternative way , it won't good logically. Please try the following logic.
    Let suppose you have 10 fields F1-f10. Each field has the 2 lines header. So take 20fields in your fields catalog ie take 10 dummy fields which are equal lenght of the fields F1-f10. and for the last 10 fields(F11-F20) set the row pos as 2, set the second line header to these field(F11-F20). So you will succed to display the 2 level header for single column. But the problem here is you will get one empty row additional row for each row. Because you have taken (F11-F20) fields are dummy and don't have the data also. This solution will works only in the case of ALV List display not in Grid Display.
      But Before that tell to your customer about this problem , Because I have done the same things when my customer giving important to 2 lines header and he accepeted that also.
    If suppose you have the data in 2 lines for each column then this solution will work fine. Thats what i implemented in my ALV Report.
    Warm Regards,
    Vijay.

  • Header prob. in ALV report

    Hi All,
    Hope you all are doing fine!!!
    In the below program am trying to print the top-of-page/header in alv report,,but am unable to do it..
    Am working on 4.6c version,,,,,its working fine in ECC 6.0 but i really dont understand why its not working in 4.6c...AM JUST PASTING THE ALV PART...!!!
    Pls. do the needful
    REPORT yjack  LINE-SIZE 132
                    LINE-COUNT 65
                    NO STANDARD PAGE HEADING.
    DATA: /sie/swe_ag0_rdo TYPE /sie/swe_ag0_rdo,
          wa_tvko TYPE tvko,
          /sie/swe_ag0_raa TYPE /sie/swe_ag0_raa,
          wa_kna1 TYPE kna1,
          wa_t001 TYPE t001,
          wa_tvkot TYPE tvkot,
          /sie/swe_ag0_con TYPE /sie/swe_ag0_con,
          /sie/swe_ag0_r02 TYPE /sie/swe_ag0_r02.
    TYPES: BEGIN OF ty_itab,
             bukrs TYPE /sie/swe_ag0_rdo-bukrs,
             vkorg TYPE /sie/swe_ag0_rdo-vkorg,
             zclpr TYPE /sie/swe_ag0_rdo-zclpr,
             zcdaz TYPE /sie/swe_ag0_rdo-zcdaz,
             vbeln TYPE /sie/swe_ag0_rdo-vbeln,
             posnr TYPE /sie/swe_ag0_rdo-posnr,
             vbtyp TYPE /sie/swe_ag0_rdo-vbtyp,
             zidag TYPE /sie/swe_ag0_rdo-zidag,
             zimpp TYPE /sie/swe_ag0_rdo-zimpp,
             zimco TYPE /sie/swe_ag0_rdo-zimco,
             zimmg TYPE /sie/swe_ag0_rdo-zimmg,
             fkdat TYPE /sie/swe_ag0_rdo-fkdat,
             zstre TYPE /sie/swe_ag0_rdo-zstre,
             vtweg TYPE /sie/swe_ag0_rdo-vtweg,
             kunrg TYPE /sie/swe_ag0_rdo-kunrg,
          END OF ty_itab.
    TYPES: BEGIN OF ty_itab2,
             bukrs TYPE /sie/swe_ag0_rdo-bukrs,
             vkorg TYPE /sie/swe_ag0_rdo-vkorg,
             zcdaz TYPE /sie/swe_ag0_rdo-zcdaz,
             fkdat TYPE /sie/swe_ag0_rdo-fkdat,
             vbeln TYPE /sie/swe_ag0_rdo-vbeln,
             zimpp TYPE /sie/swe_ag0_rdo-zimpp,
             zimco(5) TYPE p DECIMALS 2,
             zimmg(5) TYPE p DECIMALS 2,
             resid(6) TYPE p DECIMALS 2,
             kunrg TYPE /sie/swe_ag0_rdo-kunrg,
             name1 TYPE kna1-name1,
          END OF ty_itab2.
    type-pools: slis.
    types: begin of ty_final,
           bukrs type char29,
           vkorg type char24,
           mese  type char17,
           gjahr type gjahr,
           agent type char45,
           vbeln type vbeln,
           fkdat type fkdat,
           zimpp type /SIE/SWE_AG0_ZIMPP,
           zimco type /SIE/SWE_AG0_ZIMCO,
           zimmg type /SIE/SWE_AG0_ZIMMG,
           resid(5) TYPE p DECIMALS 2,
           kunrg type kunrg,
           name1 type NAME1_GP,
           end of ty_final.
    data: it_final type table of ty_final,
          wa_final type ty_final,
          g_bukrs(29) type c,
          g_vkorg(24) type c.
    data: it_fieldcat type slis_t_fieldcat_alv,
          it_layout type slis_layout_alv,
          it_list_top_of_page type slis_t_listheader,
          it_events type slis_t_event,
          wa_events type slis_alv_event,
          it_headings type slis_t_listheader,
          wa_headings type slis_listheader.
    constants: c_h type c value 'H',
               c_s type c value 'S'.
    field-symbols: <fs_final> type ty_final.
    DATA: it_itab TYPE TABLE OF ty_itab,
          it_itab2 TYPE TABLE OF ty_itab2,
          wa_itab TYPE ty_itab,
          wa_itab2 TYPE ty_itab2.
    DATA: wa_app TYPE ty_itab.
    DATA: w_var TYPE c VALUE '1',
          w_com_mese(9) TYPE c,
          w_flag_st TYPE c.
    $$ Selection-screen
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK parametri WITH FRAME TITLE text-001.
    BEG MOD ESX00596 IMS:100276414 TR:SWIK9A04W7 11.04.2007
    *PARAMETERS: p_bukrs LIKE /sie/swe_ag0_rdo-bukrs OBLIGATORY.
    *PARAMETERS: p_vkorg LIKE /sie/swe_ag0_rdo-vkorg OBLIGATORY.
    PARAMETERS: p_bukrs TYPE /sie/swe_ag0_rdo-bukrs OBLIGATORY.
    PARAMETERS: p_vkorg TYPE /sie/swe_ag0_rdo-vkorg OBLIGATORY.
    SELECT-OPTIONS: s_zcdaz FOR /sie/swe_ag0_rdo-zcdaz OBLIGATORY
                            MATCHCODE OBJECT /sie/swe_ag0_zaa.
    PARAMETERS: mese(2) TYPE n OBLIGATORY,
                anno TYPE /sie/swe_ag0_rdo-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK parametri.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: c1 AS CHECKBOX.
    SELECTION-SCREEN COMMENT 8(31) text-006 FOR FIELD c1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN: END OF BLOCK b1.
    DATA: w_cd_a   TYPE /sie/swe_ag0_rdo-vtweg,
          w_cd_gen TYPE /sie/swe_ag0_rdo-vtweg,
          w_cd_di  TYPE /sie/swe_ag0_rdo-vtweg,
          w_cd_re  TYPE /sie/swe_ag0_rdo-vtweg,
          w_cd_te  TYPE /sie/swe_ag0_rdo-vtweg,
          w_cd_ca  TYPE /sie/swe_ag0_rdo-vtweg.
    INITIALIZATION.
      PERFORM selezione_hard_coding.
    $$ At selection-screen
    AT SELECTION-SCREEN.
      PERFORM controlli.
    $$ Top-of-page
    TOP-OF-PAGE.
      PERFORM top_of_page.
    $$ Start-of-selection
    START-OF-SELECTION.
      perform build_events.
      PERFORM carica_itab.
      PERFORM carica_itab2.
      PERFORM stampa.
    END-OF-SELECTION.
    IF C1 EQ 'X'.
    perform fill-fieldcatalog.
    perform display_alv.
    ENDIF.
    *&      Form  fill-fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form fill-fieldcatalog.
    data: l_fieldcat TYPE slis_fieldcat_alv.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'BUKRS'.
          l_fieldcat-col_pos       = 1.
          l_fieldcat-seltext_l     = 'Company'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'VKORG'.
          l_fieldcat-col_pos       = 2.
          l_fieldcat-seltext_l     = 'Comm. Organization'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'MESE'.
          l_fieldcat-col_pos       = 3.
          l_fieldcat-seltext_l     = 'Month'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'GJAHR'.
          l_fieldcat-col_pos       = 4.
          l_fieldcat-seltext_l     = 'Year'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'AGENT'.
          l_fieldcat-col_pos       = 5.
          l_fieldcat-seltext_l     = 'AGENT'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'VBELN'.
          l_fieldcat-col_pos       = 6.
          l_fieldcat-seltext_l     = 'Invoice'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'FKDAT'.
          l_fieldcat-col_pos       = 7.
          l_fieldcat-seltext_l     = 'Date'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'ZIMPP'.
          l_fieldcat-col_pos       = 8.
          l_fieldcat-seltext_l     = 'Taxable'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'ZIMCO'.
          l_fieldcat-col_pos       = 9.
          l_fieldcat-seltext_l     = 'Tot.Comm.'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'ZIMMG'.
          l_fieldcat-col_pos       = 10.
          l_fieldcat-seltext_l     = 'Settle'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'RESID'.
          l_fieldcat-col_pos       = 11.
          l_fieldcat-seltext_l     = 'Accruing'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'KUNRG'.
          l_fieldcat-col_pos       = 12.
          l_fieldcat-seltext_l     = 'Cust.Code'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
          l_fieldcat-tabname       = 'IT_FINAL'.
          l_fieldcat-fieldname     = 'NAME1'.
          l_fieldcat-col_pos       = 13.
          l_fieldcat-seltext_l     = 'Company Name'.
          APPEND l_fieldcat TO it_fieldcat.
          clear l_fieldcat.
    endform.                    " fill-fieldcatalog
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    form display_alv.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       I_CALLBACK_TOP_OF_PAGE            = 'PRINT_HEADING'
       IS_LAYOUT                         = it_layout
       IT_FIELDCAT                       = it_fieldcat
       IT_EVENTS                         = it_events
      TABLES
        t_outtab                          = it_final
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.                    " display_alv
    *&      Form  build_events
          text
         -->P_IT_EVENTS[]  text
    form build_events.
    clear wa_events.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = it_events.
    read table it_events into wa_events with key name = 'TOP_OF_PAGE'.
    if sy-subrc eq 0.
    wa_events-form = 'PRINT_HEADING'.
    modify it_events from wa_events transporting form
        where name = 'TOP_OF_PAGE'.
    endif.
    endform.                    " build_events
    form PRINT_HEADING.
    clear wa_headings.
    wa_headings-typ = 'H'.
    wa_headings-info = 'DEMO FOR ALV!!!'.
    append wa_headings to it_headings.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = it_headings.
    endform.
    Thanks n Regards
    Jack

    Hi friend,
    I think u have to remove below lines in your program because FM 'REUSE_ALV_GRID_DISPLAY' will call directly Form 'PRINT_HEADING'   for TOP-OF-PAGE event through table 'it_events' :
    Remove lines:
        TOP-OF-PAGE.
        PERFORM top_of_page.
    Also remove the parameter
    I_CALLBACK_TOP_OF_PAGE = 'PRINT_HEADING' in  FM 'REUSE_ALV_GRID_DISPLAY'
    Also put a breakpoint in your program in the line,
    START-OF-SELECTION.
    perform build_events.
    See whether 'form' 'name' gets populated in table 'it_events'  or not.
    See sample report and compare.
    REPORT zawi_assign3 NO STANDARD PAGE HEADING.
    TYPE-POOLS: slis.
    DATA: BEGIN OF gt_outtab OCCURS 0.
            INCLUDE STRUCTURE ekpo.
    DATA: END OF gt_outtab,
          gs_layout TYPE slis_layout_alv,
          g_exit_caused_by_caller,
          gs_exit_caused_by_user TYPE slis_exit_by_user,
          g_repid LIKE sy-repid.
    DATA:
        gt_events      TYPE slis_t_event,
        gt_list_top_of_page TYPE slis_t_listheader,
        g_status_set   TYPE slis_formname VALUE 'PF_STATUS_SET',
        g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
        g_top_of_page  TYPE slis_formname VALUE 'TOP_OF_PAGE',
        g_top_of_list  TYPE slis_formname VALUE 'TOP_OF_LIST',
        g_end_of_list  TYPE slis_formname VALUE 'END_OF_LIST'.
    DATA: gs_variant LIKE disvariant,
          g_save.
    INITIALIZATION.
      g_repid = sy-repid.
      PERFORM layout_init USING gs_layout.
      PERFORM eventtab_build USING gt_events[].
      gs_variant-report = g_repid.
      g_save           = 'X'.
    START-OF-SELECTION.
      PERFORM select_data TABLES gt_outtab.
    END-OF-SELECTION.
      PERFORM comment_build USING gt_list_top_of_page[].
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
             i_background_id    = 'ALV_BACKGROUND'
             i_buffer_active    = 'X'
             i_callback_program = g_repid
             i_structure_name   = 'ekpo'
             is_layout          = gs_layout
             i_save             = g_save
             is_variant         = gs_variant
             it_events          = gt_events[]
        IMPORTING
             e_exit_caused_by_caller = g_exit_caused_by_caller
             es_exit_caused_by_user  = gs_exit_caused_by_user
        TABLES
             t_outtab = gt_outtab
        EXCEPTIONS
             program_error = 1
             OTHERS        = 2.
      IF sy-subrc = 0.
        IF g_exit_caused_by_caller = 'X'.
        ELSE.
          IF gs_exit_caused_by_user-back = 'X'.
          ELSE.
            IF gs_exit_caused_by_user-exit = 'X'.
            ELSE.
              IF gs_exit_caused_by_user-cancel = 'X'.
              ELSE.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
      ENDIF.
    FORM select_data TABLES rt_outtab LIKE gt_outtab[].
      SELECT * FROM ekpo INTO CORRESPONDING FIELDS
                       OF TABLE rt_outtab
                       UP TO 00030 ROWS.
    ENDFORM.                    "SELECT_DATA
    FORM layout_init USING rs_layout TYPE slis_layout_alv.
      rs_layout-detail_popup      = 'X'.
      rs_layout-edit = 'X'.
    ENDFORM.                    "LAYOUT_INIT
    FORM eventtab_build USING rt_events TYPE slis_t_event.
    *"Registration of events to happen during list display
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = rt_events.
      READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE g_top_of_page TO ls_event-form.
        APPEND ls_event TO rt_events.
      ENDIF.
    ENDFORM.                    "EVENTTAB_BUILD
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'ENJOYSAP_LOGO'
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "TOP_OF_PAGE
    FORM comment_build USING lt_top_of_page TYPE
                                            slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = text-100.
      APPEND ls_line TO lt_top_of_page.
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'Program'.
      ls_line-info = sy-repid.
      APPEND ls_line TO lt_top_of_page.
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'User'.
      ls_line-info = sy-uname.
      APPEND ls_line TO lt_top_of_page.
    ENDFORM.                    "COMMENT_BUILD
    Might solve your problem.
    Thanks.
    Edited by: Sap Fan on Feb 20, 2009 9:50 AM
    Edited by: Sap Fan on Feb 20, 2009 9:52 AM
    Edited by: Sap Fan on Feb 20, 2009 9:54 AM

  • How to select multiple lines in ALV report

    hi gurus,
    I am working on an interactive ALV report where i have to select multiple lines from the basic list into an internal table, based on check box clicks. Using RS_SELFIELD i can select only 1 row. The coding has been done based on Call Function. Can u please suggest some way.
    Regards,
    Satyajit

    hi,
    try like this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    TYPES: BEGIN OF t_ekko,
      sel,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    DATA : BEGIN OF det_tab OCCURS 0,
            ebeln LIKE ekpo-ebeln,
           END OF det_tab.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM build_layout.
      gd_layout-box_fieldname     = 'SEL'.
      "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = gd_repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_STAT'
          is_layout                = gd_layout
          it_fieldcat              = fieldcatalog[]
          i_save                   = 'X'
        TABLES
          t_outtab                 = it_ekko
        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.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'EBELN'.
            READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
            SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
            CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'DET'.  "button add by me
          CLEAR det_tab.
          REFRESH det_tab.
          LOOP AT it_ekko INTO wa_ekko WHERE sel = 'X'.
            MOVE-CORRESPONDING wa_ekko TO det_tab.
            APPEND det_tab.
          ENDLOOP.
          PERFORM build_cat.
          PERFORM dis_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  set_stat
    *       text
    *      -->RT_EXTAB   text
    FORM set_stat USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.
    ENDFORM.                    "set_stat
    *&      Form  build_cat
    *       text
    FORM build_cat.
      CLEAR fieldcatalog1.
      REFRESH fieldcatalog1.
      fieldcatalog1-fieldname = 'EBELN'.
      fieldcatalog1-tabname = 'DET_TAB'.
      fieldcatalog1-seltext_m = 'Order No.'.
      fieldcatalog1-outputlen = 10.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR fieldcatalog1.
    ENDFORM.                    "build_cat
    *&      Form  dis_data
    *       text
    FORM dis_data.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_DS'
          it_fieldcat        = fieldcatalog1[]
          i_save             = 'X'
        TABLES
          t_outtab           = det_tab.
    ENDFORM.                    "dis_data
    here i have copied standard gui status of ALV into my z status ZSTAT and add one button DET......
    here u can select morethan one line using control(ctrl)
    reward if usefull...

  • How to add 2 more field to the  Header of FBL5N ALV report output

    Hi All,
    I have copied and made some modification to the standard transaction FBL5N and added some fields to the ALV report line Items but how to add fields to the header part i.e if you execute the transaction FBL5n, you will get the ALV report, in the header part customer no, company code then I need to add the 2 more fields. can any one tell me that which structure or where I need to add these fields to be appear in ALV output screen.
    Thanks in advance.
    Swapna.

    Hi Mohamed,
    If you copied Z-FM successfully, then you have to go to subroutine TOP_OF_PAGE to add your field:
    *&      Form  TOP_OF_PAGE
    FORM top_of_page.
      DATA: b_suppress   LIKE boole-boole,
            opfi_text    LIKE eptext OCCURS 10 WITH HEADER LINE,
            n_color      TYPE i.
    *  IF     NOT it_items-bukrs IS INITIAL               "737295
    *     AND NOT it_items-konto IS INITIAL               "737295
    *     AND NOT it_items-koart IS INITIAL.              "737295
      gs_items = gt_alv.
    *  ENDIF.                                             "737295
    * skip first call at top of page:
      IF NOT gd_first_top IS INITIAL.
        CLEAR gd_first_top.
        EXIT.
      ENDIF.
      IF x_grid = c_x OR x_inet = c_x.                          "1012201
        PERFORM grid_top_of_page.
        EXIT.
      ENDIF.
    *... open FI: get header text.
    * first fill some RFXPO fields for general info:
      CLEAR: s_rfxpo, wa_kna1, wa_lfa1, wa_ska1.
      s_rfxpo-bukrs = gs_items-bukrs.
      s_rfxpo-kkber = gs_items-kkber.
      s_rfxpo-koart = gs_items-koart.
      s_rfxpo-konto = gs_items-konto.
      s_rfxpo-vrbez = gs_variant-variant.
      s_rfxpo-waers = gs_items-waers.
    * update master record:
      PERFORM fill_master_rec  USING gs_items-koart
                                     gs_items-konto
                                     gs_items-bukrs. " note 698396
      CALL FUNCTION 'OPEN_FI_PERFORM_00001640_E'
        EXPORTING
          i_rfxpo             = s_rfxpo
          i_kna1              = wa_kna1
          i_lfa1              = wa_lfa1
          i_ska1              = wa_ska1
        IMPORTING
          e_suppress_standard = b_suppress
        TABLES
          t_lines             = opfi_text.
    *... display open FI text:
      IF x_konto_sort = 'X'.
        LOOP AT opfi_text.
          CASE opfi_text-color.
            WHEN 1.
              FORMAT COLOR 1.
            WHEN 2.
              FORMAT COLOR 2.
            WHEN 3.
              FORMAT COLOR 3.
            WHEN 4.
              FORMAT COLOR 4.
            WHEN 5.
              FORMAT COLOR 5.
            WHEN 6.
              FORMAT COLOR 6.
            WHEN 7.
              FORMAT COLOR 7.
          ENDCASE.
          WRITE: / opfi_text-text.
        ENDLOOP.
        FORMAT RESET.
      ENDIF.
    *... display other header text:
      IF b_suppress NE 'X'.
        PERFORM display_custom_header.
        PERFORM display_ccard_lines.
      ENDIF.
    " Put your field somewhere...
    ENDFORM.                               " TOP_OF_PAGE
    Good luck,
    Thanks,

  • How to add field to the header for FBL5N ALV report

    Hi,
       I need to add fields to the customer line item display ALV report(FBL5N) header part.Right now there are four fields in the header like customer, company code, name and city, after that I need to add first name last name and phone no. Can any one tell me where exactly I need to add and populate there fields to be appear in ALV output list.
    Thanks in Advance
    Swapna

    Yes I have tried, I have place a break point in that perform but it does not stop. I think that is not the correct place to added and populate fields. That routine is for populate selection screen ranges single and multiple values and parameters only.
    Thanks
    Swapna

  • Reserve lines in alv report

    hi experts , how we reserve 15 lines from the top of the page in alv reports.
    regards
    subhasis

    If by reserve you mean should not move on scrolling then make them KEY from fieldcatalog.
    But I think maximum of 10-12 can be handled by that.
    Regards,
    Amit
    Reward all helpful replies.

  • Output several lines in ALV report

    Hi all,
    My requirement is to output multiple lines (i.e. text lines) in a grid of an ALV report, so that user could later download it to an MS Excel sheet.
    Is there any solution to it?
    Many Thanks!
    e.g., target output is like this and all the text lines in Col B should belongs to 1 single record...
    Col A | Col B          |
    ===============
    rec1  | text line 1   |
    text line 2
    text line 3
    ===============
    rec2 |  text line 1  ||
    text line 2
    text line 3

    Thanks!
    Yes, I populated it, but each text line occupies one row ID, how can make it?
    can I display it as a table in a grid ?
    Thanks!

  • Logic needed to print blank line in alv report

    hi experts,
    can anyone please tell me the logic for this
    i want to logic one is
    1) in alv report contains
    a set of data contains 100 (5 datas)
    and a set of data contain 200(5 datas)
    i want to have one coloum containing serial no
    ex for 100 i want to move no '5' to one coloumn ,but it should display only ones not for all 5 records.
    same for 200 also i want to move 7 to this ,it should b displayed ones
    i used for at new command alos its not working
    2)suppose for particular date, 200 related records is not there
    it should conatin blank line,displaying 'NIL'.
    SO THE OPT FROMAT MUST BE
    MATNR            DOCNO
    100                  1000
    100                  1000
    100                    "
    100                     "
    100                    "
    200                   2000
    200                      "
    200                     "
    200                    "
    200                    "
    SUPPOSE 200 RECORD IS NOT THERE THE OPT SHLD B
    100           1000
    100            1000
    200           NIL

    Arun,
    1)
    If you are using the  function module REUSE_ALV_GRID_DISPLAY, then use the internal table it_sort with a row for the column where you want the suppression of repeated values.
    2)
    If you are using the  function module REUSE_ALV_GRID_DISPLAY, then simply ensure that your internal table t_outtab has the rows that you need containing 'NIL'.
    John

  • Pb with header line in my report

    hi,
    I have a problem with the alignment of the header line of my table in my report
    Indeed the header line is centered on the first page but not on the second one.
    I attach the code and a pdf which shows the problem.
    If someone can help me,please.
    Best regards
    Attachments:
    test pb array.vi ‏20 KB
    Document.pdf ‏24 KB

    Hi,
    Your VIs doesn't work on my computer. Is it really running on yours? Did you try with a word report and if so, do you have the same phenomena?
    Regards
    Manuel R
    AE dans une autre vie

Maybe you are looking for

  • More than one VAT code on one line item?

    Hello, Running ECS SRM 5.0. Is it absolutely impossible to set more than one VAT code on one order line in a SC or PO? Can this be acomplished by using a user exit or anything? This demand comes from a public sector company which pays different VAT d

  • Report to monitor PO output failures

    Dear All, Is there any standard report available in SAP which will display all the PO output failures for a specific period. Example: Output type: NEU Date range: DD.MM.YYYY ~ DD.MM.YYYY The report should display all the PO numbers of the PO's whose

  • Gradient Map uses

    I'm trying to compile a list of uses for the Gradient Map in Photoshop (for my own use and yours). Can you add to the list (please)? If you have a link to an example or a tutorial that would be great as well! Toning images using gradients (e.g. sepia

  • Not getting stereo audio out of earphones with iPod touch

    I own an iPod touch 2nd generation which I have had since January 2008. For some time, I have had issues with the audio when using earphones with my iPod, where the audio comes out one side but not both. Occasionally, if I bend the earphone part that

  • How do I get my reply forward etc buttons back on my iPad air?

    I cannot send or reply to mail from my new iPad air.  I get the mail, I just can't do anything about it....