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

top of page - urgent

hi

i have one report that displays data in alv format using cl_gui_alv_grid.i want to add some text as top-of-page in the report go how can i do it using cl_gui_alv_grid.

thnx

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 08:24 AM

    Hi neha,

    Use the following code in for top-of-page.

    DATA: it_list_top_of_page TYPE slis_t_listheader,

    it_events TYPE slis_t_event,

    gs_layout TYPE slis_layout_alv,

    lwa_line TYPE slis_listheader.

    CONSTANTS: gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

    FORM eventtab_build USING lit_events TYPE slis_t_event.

    DATA: lit_alv_event TYPE slis_alv_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = lit_events.

    READ TABLE lit_events WITH KEY name = slis_ev_top_of_page

    INTO lit_alv_event.

    IF sy-subrc = 0.

    MOVE gc_formname_top_of_page TO lit_alv_event-form.

    APPEND lit_alv_event TO lit_events.

    ENDIF.

    ENDFORM.

    FORM list_header USING lt_top_of_page TYPE slis_t_listheader.

    lwa_line-typ = 'S'.

    lwa_line-key = text-105.

    CONCATENATE sy-datum+6(2) '.'

    sy-datum+4(2) '.'

    sy-datum(4) INTO lwa_line-info.

    APPEND lwa_line TO lt_top_of_page.

    CLEAR lwa_line.

    lwa_line-typ = 'S'.

    lwa_line-key = text-107.

    lwa_line-info = sy-uname.

    APPEND lwa_line TO lt_top_of_page.

    CLEAR lwa_line.

    IF gt_merge_01 IS INITIAL.

    ld_linesc = 0.

    ENDIF.

    lwa_line-typ = 'S'.

    lwa_line-key = text-108.

    lwa_line-info = ld_linesc.

    APPEND lwa_line TO lt_top_of_page.

    ENDFORM.

    FORM top_of_page.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_list_top_of_page

    i_logo = '<logo name>'.

    ENDFORM.

    PLZ REWARD POINTS.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 11, 2007 at 08:29 AM

    Hi,

    My be you can try proving the LAYOUT strucutre to the alv grid. LAYOUT has the option of giving a title to the ALV GRID.

    See structure LVC_S_LAYO.

    pass this structure to SET_TABLE_FOR_FIRST_DISPLAY method.

    Regards

    Sesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 09:13 AM

    Hi Neha,

    Have a look at report DD_ADD_PICTURE. Hope this helps u.

    Also have a look at CL_DD_DOCUMENT class. you will have a lot of where used list for this one. So u can trace from there. There are methods like ADD_PICTURE and ADD_ICON whichever serves your purpose.

    a demo program is shown below:

    • Build report title

    PERFORM build_report_title USING gd_report_title gd_logo.

    DATA: gd_logo TYPE sdydo_value,

    &----


    *& Form BUILD_REPORT_TITLE

    &----


    • Build table for ALVtree header

    ----


    • <-> p1 Header details

    • <-> p2 Logo value

    ----


    FORM build_report_title CHANGING

    pt_report_title TYPE slis_t_listheader

    pa_logo TYPE sdydo_value.

    DATA: ls_line TYPE slis_listheader,

    ld_date(10) TYPE c.

    • List Heading Line(TYPE H)

    CLEAR ls_line.

    ls_line-typ = 'H'.

    • ls_line-key "Not Used For This Type(H)

    ls_line-info = 'User Message Service'.

    APPEND ls_line TO pt_report_title.

    • Users name (Status Line- TYPE S)

    ls_line-typ = 'S'.

    ls_line-key = 'Name '.

    ls_line-info = gd_myname.

    APPEND ls_line TO pt_report_title.

    • Status Line(TYPE S)

    ld_date(2) = sy-datum+6(2).

    ld_date+2(1) = '/'.

    ld_date3(2) = sy-datum4(2).

    ld_date+5(1) = '/'.

    ld_date+6(4) = sy-datum(4).

    ls_line-typ = 'S'.

    ls_line-key = 'Date'.

    ls_line-info = ld_date.

    APPEND ls_line TO pt_report_title.

    • Action Line(TYPE A)

  • CLEAR ls_line.

  • ls_line-typ = 'A'.

  • CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space

  • .

    • APPEND ls_line TO pt_report_title.

    ENDFORM. "build_report_title

    CALL METHOD gd_userlist->set_table_for_first_display

    EXPORTING

    is_hierarchy_header = gd_hierarchy_header

    it_list_commentary = gd_report_title

    i_logo = gd_logo

    • i_background_id = 'ALV_BACKGROUND'

    i_save = 'A'

    is_variant = gd_variant

    CHANGING

    it_outtab = it_emptytab "Must be empty

    it_fieldcatalog = gd_fieldcat.

    ******************************************************

    Insert image onto SAP screen

    This is very simple to do, first create a dialog program with one screen (any number i.e. 0100) and create a custom control called 'CUST_CONTROL'. Now use the below sections of code to create a top include and a PBO module/process. And then finally create a transaction code for it. This version does not work for version 4.6 so click here for alternative code.

    CONSTANTS: CNTL_TRUE TYPE I VALUE 1,

    CNTL_FALSE type i value 0.

    data:

    h_picture type ref to cl_gui_picture,

    h_pic_container type ref to cl_gui_custom_container.

    • h_tree type ref to cl_gui_list_tree,

    • h_docking type ref to cl_gui_docking_container,

    • h_application type ref to lcl_application.

    data: graphic_url(255),

    graphic_refresh(1),

    g_result like cntl_true.

    data: begin of graphic_table occurs 0,

    line(255) type x,

    end of graphic_table.

    data: graphic_size type i.

    ----


    ***INCLUDE ZDISPLAYIMAGEPBO .

    ----


    &----


    *& Module STATUS_0100 OUTPUT

    &----


    • text

    ----


    module STATUS_0100 output.

    data: l_graphic_xstr type xstring,

    l_graphic_conv type i,

    l_graphic_offs type i.

    CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

    EXPORTING

    p_object = 'GRAPHICS'

    p_name = 'ENJOY' "IMAGE NAME - Image name from SE78

    p_id = 'BMAP'

    p_btype = 'BMON'

    RECEIVING

    p_bmp = l_graphic_xstr

    EXCEPTIONS

    not_found = 1

    OTHERS = 2.

    • IF sy-subrc = 1.

    • MESSAGE e287 WITH g_stxbitmaps-tdname.

    • ELSEIF sy-subrc <> 0.

    • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    • EXIT.

    • ENDIF.

    graphic_size = XSTRLEN( l_graphic_xstr ).

    CHECK graphic_size > 0.

    l_graphic_conv = graphic_size.

    l_graphic_offs = 0.

    WHILE l_graphic_conv > 255.

    graphic_table-line = l_graphic_xstr+l_graphic_offs(255).

    APPEND graphic_table.

    l_graphic_offs = l_graphic_offs + 255.

    l_graphic_conv = l_graphic_conv - 255.

    ENDWHILE.

    graphic_table-line = l_graphic_xstr+l_graphic_offs(L_GRAPHIC_CONV).

    APPEND graphic_table.

    CALL FUNCTION 'DP_CREATE_URL'

    EXPORTING

    type = 'image' "#EC NOTEXT

    subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'

    size = graphic_size

    lifetime = cndp_lifetime_transaction "'T'

    TABLES

    data = graphic_table

    CHANGING

    url = graphic_url

    EXCEPTIONS

    • dp_invalid_parameter = 1

    • dp_error_put_table = 2

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

    EXIT.

    ENDIF.

    create object h_pic_container

    exporting container_name = 'CUST_CONTROL'.

    create object h_picture exporting parent = h_pic_container.

    call method h_picture->load_picture_from_url

    exporting url = graphic_url

    importing result = g_result.

    endmodule. " STATUS_0100 OUTPUT

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.