Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV Header

Former Member
0 Likes
721

Hello Experts,

How to display ALV header as shown below:

-


Company Name:

Run date: Effective date

Contributions: EE % Dep %

-


Regards,

Saurabh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
695

Hi,

Use like the below call top of page form in FM

and in subroutine append the intab

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = l_repid
     i_callback_user_command           = 'USER_COMMAND'
     *i_callback_top_of_page            = 'TOP_OF_PAGE'*
     i_callback_pf_status_set          = 'SET_STAT'
     i_grid_title                      = l_string
     is_layout                         = wa_layout1
     it_fieldcat                       = i_field_cat1
     i_save                            = c_x
    TABLES
     t_outtab                          = i_log.
*&---------------------------------------------------------------------*
*&      Form  Top_of_page
*&---------------------------------------------------------------------*
*       Top of page
*----------------------------------------------------------------------*
FORM top_of_page.
*First Line Header
REFRESH i_header.
CLEAR wa_header.
wa_header-typ = c_h.
wa_header-info = 'Contracts Mass Maintenance - Upload Log'(011).
APPEND wa_header TO i_header.
CLEAR wa_header.
*Second line header
wa_header-typ = c_s.
wa_header-key = 'DATE:'(012).
CONCATENATE sy-datum+6(2) c_s1 sy-datum+4(2) c_s1 sy-datum(4) INTO
wa_header-info.
APPEND wa_header TO i_header.
CLEAR wa_header.
Endform.

Regards,

Nandha

6 REPLIES 6
Read only

rainer_hbenthal
Active Contributor
0 Likes
695

Use FM REUSE_ALV_COMMENTARY_WRITE

Read only

Former Member
0 Likes
696

Hi,

Use like the below call top of page form in FM

and in subroutine append the intab

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = l_repid
     i_callback_user_command           = 'USER_COMMAND'
     *i_callback_top_of_page            = 'TOP_OF_PAGE'*
     i_callback_pf_status_set          = 'SET_STAT'
     i_grid_title                      = l_string
     is_layout                         = wa_layout1
     it_fieldcat                       = i_field_cat1
     i_save                            = c_x
    TABLES
     t_outtab                          = i_log.
*&---------------------------------------------------------------------*
*&      Form  Top_of_page
*&---------------------------------------------------------------------*
*       Top of page
*----------------------------------------------------------------------*
FORM top_of_page.
*First Line Header
REFRESH i_header.
CLEAR wa_header.
wa_header-typ = c_h.
wa_header-info = 'Contracts Mass Maintenance - Upload Log'(011).
APPEND wa_header TO i_header.
CLEAR wa_header.
*Second line header
wa_header-typ = c_s.
wa_header-key = 'DATE:'(012).
CONCATENATE sy-datum+6(2) c_s1 sy-datum+4(2) c_s1 sy-datum(4) INTO
wa_header-info.
APPEND wa_header TO i_header.
CLEAR wa_header.
Endform.

Regards,

Nandha

Read only

Former Member
0 Likes
695

HI,

Try like this.

v_date = s_bldat-low+6(2).

v_month = s_bldat-low+4(2).

v_year = s_bldat-low+0(4).

v_date1 = s_bldat-high+6(2).

v_month1 = s_bldat-high+4(2).

v_year1 = s_bldat-high+0(4).

DATA : v_date5 LIKE v_date3.

CONCATENATE v_date1 v_month1 v_year1 INTO v_date3 SEPARATED BY '.'.

IF p_bukrs = '3000'.

v_bukrs_txt = 'CMI FPE Ltd'.

ELSEIF p_bukrs = '4000'.

v_bukrs_txt = 'NT Strips and Automation Pvt Ltd'.

ENDIF.

fheader-typ = 'H'. ('H' for header,'S' for sub headers)

fheader-info = v_bukrs_txt. " here v_butxt_txt changed to v_butxt on 27.09.2008

APPEND fheader.

CLEAR fheader.

fheader-typ = 'H'.

CONCATENATE v_date v_month v_year INTO v_date5 SEPARATED BY '.'.

CONCATENATE 'Sales Register From' v_date5 'To' v_date3 INTO fheader-info SEPARATED BY space.

  • concatenate fheader-key 'TO' v_date3 into fheader-info separated by space.

APPEND fheader.

CLEAR fheader.

CLEAR v_date5.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = fheader[]

  • I_LOGO =

  • I_END_OF_LIST_GRID =

.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = fevents[]

EXCEPTIONS

list_type_wrong = 1

OTHERS = 2.

READ TABLE fevents WITH KEY name = 'TOP_OF_PAGE'.

IF sy-subrc = 0.

fevents-form = 'TOP_OF_PAGE'.

MODIFY fevents INDEX sy-tabix.

CLEAR fevents.

ENDIF.

Read only

Former Member
0 Likes
695

Hi,

Also you can try like this...


REPORT  ypm_historycard_rep.
 
 
TYPE-POOLS : slis.
DATA : it_cbm TYPE STANDARD TABLE OF mara.
DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
       wa_fcat TYPE slis_fieldcat_alv,
       it_fcat TYPE slis_t_fieldcat_alv.
 
START-OF-SELECTION.
  SELECT  *
  FROM  mara
  INTO CORRESPONDING FIELDS OF TABLE  it_cbm
  where matnr = 'D80K7'.
  .
 
END-OF-SELECTION.
 
  it_layout-zebra = 'X'.
  it_layout-colwidth_optimize = 'X'.
  it_layout-f2code = '&ETA'.
  APPEND it_layout.
 
 
  DEFINE macro4fcat.
    wa_fcat-col_pos = &1.
    wa_fcat-fieldname = &2.
    wa_fcat-tabname = &3.
    wa_fcat-seltext_l = &4.
    append wa_fcat to it_fcat.
    clear wa_fcat.
  END-OF-DEFINITION.
 
  macro4fcat    '1'  'MATNR'         'IT_CBM'   'MATERIAL NO'    .
 
 
 
 
  DESCRIBE TABLE it_cbm.
  IF sy-ucomm = '&F03'.
    MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
  ENDIF.
 
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
  i_callback_program                = sy-repid
 i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'
  is_layout                         = it_layout
  it_fieldcat                       = it_fcat
   i_save                            = 'A'
  TABLES
  t_outtab                          = it_cbm
  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  html_top_of_page
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->TOP        text
*----------------------------------------------------------------------*
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
 
  DATA: l_text(255) TYPE c.
  DATA: text1(255)  TYPE c.
  DATA: t_header TYPE REF TO cl_dd_table_element ,
        wa_header TYPE REF TO cl_dd_table_area.
 
  CALL METHOD top->add_gap
    EXPORTING
      width = 10.
 
 
  CALL METHOD top->add_text
  EXPORTING
    text          = 'hello'
    sap_style     = 'HEADING'
 
.
CALL METHOD top->add_gap
    EXPORTING
      width = 20.
 
 
  CALL METHOD top->add_text
  EXPORTING
    text          = 'HOW ARE YOU'
    sap_style     = 'HEADING'.
 
    CALL METHOD TOP->new_line
*      EXPORTING
*        repeat =
        .
    CALL METHOD top->add_gap
    EXPORTING
      width = 50.
 
 
  CALL METHOD top->add_text
  EXPORTING
    text          = '____________________________________________________________'
    sap_style     = 'HEADING'.
 
    CALL METHOD TOP->new_line
*      EXPORTING
*        repeat =
        .
    CALL METHOD top->add_gap
    EXPORTING
      width = 90.
 
 
  CALL METHOD top->add_text
  EXPORTING
    text          = 'YOU CAN TRY LIKE THIS'
    sap_style     = 'HEADING'.
 
 
ENDFORM.                    "html_top_of_page

Regards

Debarshi

Read only

Former Member
0 Likes
695

hi saurabh,

check this link

saptechnical.com/Tutorials/ALV/TopofPage/Solution.htm

in place of "'* use "--"

hope it works

Thanks

Sachin

Read only

Former Member
0 Likes
695

Hello,

All ALV related issues are discussed in the Following blogs.

How to create ALV HEADER

ALV Report HEADER

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/addHeadertoALVreport

Hope they will be helpful to you.

All the best

Priyanka