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

help on alv

REPORT z50875_alv.

TYPE-POOLS : slis.

TYPES: BEGIN OF st_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

netwr TYPE ekpo-netwr,

END OF st_ekpo.

DATA: it_ekpo TYPE STANDARD TABLE OF st_ekpo WITH HEADER LINE,

it_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv,

v_ebeln TYPE ekpo-ebeln,

wa_layout TYPE slis_layout_alv,

it_events TYPE slis_t_event, "events table

wa_events TYPE slis_alv_event,

it_headings TYPE slis_t_listheader,

wa_headings LIKE LINE OF it_headings.

SELECT-OPTIONS so_ebeln FOR v_ebeln.

START-OF-SELECTION.

SELECT ebeln ebelp matnr netwr

FROM ekpo

INTO TABLE it_ekpo

WHERE ebeln IN so_ebeln.

PERFORM fill_events_table.

PERFORM populate_feildcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_CALLBACK_TOP_OF_PAGE = 'print_heading'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME = I_STRUCTURE_NAME

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE = I_GRID_TITLE

  • I_GRID_SETTINGS = I_GRID_SETTINGS

  • IS_LAYOUT = IS_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

  • IT_EXCLUDING = IT_EXCLUDING

  • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

  • IT_SORT = IT_SORT

  • IT_FILTER = IT_FILTER

  • IS_SEL_HIDE = IS_SEL_HIDE

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT = IS_VARIANT

IT_EVENTS = IT_EVENTS[]

  • IT_EVENT_EXIT = IT_EVENT_EXIT

  • IS_PRINT = IS_PRINT

  • IS_REPREP_ID = IS_REPREP_ID

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS = IT_ALV_GRAPHICS

  • IT_HYPERLINK = IT_HYPERLINK

  • IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

  • IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

  • IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

TABLES

t_outtab = IT_EKPO

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

&----


FORM populate_feildcat .

wa_fieldcat-fieldname = 'EBELN'.

wa_fieldcat-seltext_l = 'DOCUMENT NUMBER'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-fieldname = 'EBELP'.

wa_fieldcat-seltext_l = 'ITEM DOCUMENT NUMBER'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-fieldname = 'MATNR'.

wa_fieldcat-seltext_l = 'MATERIAL'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-fieldname = 'NETWR'.

wa_fieldcat-seltext_l = 'NET VALUE'.

APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-hotspot = 'X'.

wa_fieldcat-fix_column = 'X'.

ENDFORM. " populate_feildcat

&----


*& Form fill_events_table

&----


FORM fill_events_table .

  • CLEAR wa_events.

wa_events-name = 'TOP_OF_PAGE'.

wa_events-form = 'print_heading'.

APPEND wa_events TO it_events.

ENDFORM. " fill_events_table

&----


*& Form print_heading

&----


  • text

----


FORM print_heading.

CLEAR wa_headings.

wa_headings-typ = 'S'.

wa_headings-info = 'DEMO ON ALV REPORTS'.

APPEND wa_headings TO it_headings.

CLEAR wa_headings.

wa_headings-typ = 'H'.

wa_headings-info = 'PURCHASE ORDER ITEM DETAILS'.

APPEND wa_headings TO it_headings.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_headings[].

  • i_logo = 'mysap_logo_yellow.gif'.

  • I_END_OF_LIST_GRID = I_END_OF_LIST_GRID

  • I_ALV_FORM = I_ALV_FORM.

ENDFORM. "print_heading

this is my code and top-of-page event is not triggering...i am not able to find where the error is...can anyone help me out.

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 07, 2008 at 06:08 AM

    Hi,

    FORM fill_events_table .

    CLEAR wa_events.

    wa_events-name = 'TOP_OF_PAGE'.

    wa_events-form = 'print_heading'.

    APPEND wa_events TO it_events.

    ENDFORM. " fill_events_table

    Here,Form name is small letter.Make it in capital letter PRINT_HEADING.

    L.Velu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 10:17 AM

    HI ,

    i will send u one program now u pls just copy and paste in se38 and run. and compare where did u done the mistake .ok

    TYPE-POOLS slis.

    DATA : repid LIKE sy-repid.

    *internal table of field catalog

    DATA : it_fieldcat TYPE slis_t_fieldcat_alv.

    *data: i_background_id TYPE sdydo_key.

    *i_background_id = '12345'.

    DATA: it_events TYPE slis_t_event,

    wa_events LIKE LINE OF it_events.

    *DATA: i_grid_title TYPE lvc_title.

    *WORK AREA OF FIELD CATALOG

    DATA : wa_fieldcat TYPE slis_fieldcat_alv.

    DATA : BEGIN OF it_kna1 OCCURS 0,

    kunnr TYPE kna1-kunnr,

    land1 TYPE kna1-land1,

    name1 TYPE kna1-name1,

    ort01 TYPE kna1-ort01,

    END OF it_kna1.

    • SELECTION SCREEN

    DATA : s_kunnr TYPE kna1-kunnr.

    SELECTION-SCREEN BEGIN OF BLOCK b1.

    SELECT-OPTIONS so_kunnr FOR s_kunnr.

    SELECTION-SCREEN END OF BLOCK b1.

    INITIALIZATION.

    repid = sy-repid.

    • lvc_title = heading.

    *start of selection

    START-OF-SELECTION.

    PERFORM field_cat.

    SELECT kunnr

    land1

    name1

    ort01

    INTO TABLE it_kna1

    FROM kna1

    WHERE kunnr IN so_kunnr.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    i_program_name = repid

    i_internal_tabname = 'IT_KNA1'

    i_inclname = repid

    CHANGING

    ct_fieldcat = it_fieldcat[]

    EXCEPTIONS

    inconsistent_interface = 1

    program_error = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

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

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

    ENDIF.

    *----


    ASSIGN U R FORM NAME AND FORM TO WORK AREA

    *EVENTS TO POPULATE

    wa_events-name = slis_ev_user_command.

    wa_events-form = 'USER_COMMAND'.

    APPEND wa_events TO it_events .

    CLEAR wa_events.

    *

    • wa_events-name = slis_ev_pf_status_set.

    • wa_events-form = 'PF_STATUS_SET'.

    • APPEND wa_events TO it_events .

    • CLEAR wa_events.

    wa_events-name = slis_ev_top_of_page.

    wa_events-form = 'HEADING'.

    APPEND wa_events TO it_events .

    CLEAR wa_events.

    *----


    GRID DISPLAY

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    i_callback_program = repid

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    i_callback_top_of_page = 'HEADING'

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME = I_STRUCTURE_NAME

    • i_background_id = 'I_BACKGROUND_ID'

    • i_grid_title = lvc_title

    • I_GRID_SETTINGS =

    • IS_LAYOUT = IS_LAYOUT

    it_fieldcat = it_fieldcat

    • IT_EXCLUDING = IT_EXCLUDING

    • IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

    • IT_SORT = IT_SORT

    • IT_FILTER = IT_FILTER

    • IS_SEL_HIDE = IS_SEL_HIDE

    • I_DEFAULT = 'X'

    i_save = 'A'

    • IS_VARIANT = IS_VARIANT

    it_events = it_events[]

    TABLES

    t_outtab = it_kna1

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

    &----


    *----


    TOP-OF-PAGE DECLARATION

    FORM heading.

    DATA: it_list_commentary TYPE slis_t_listheader,

    wa_list_commentary LIKE LINE OF it_list_commentary.

    • coll_top_p = 'HEADING'.

    • coll_end_l = 3%.

    wa_list_commentary-typ = 'H'.

    wa_list_commentary-info = 'THIS IS TOP-OF PAGE'.

    APPEND wa_list_commentary TO it_list_commentary.

    *----


    TO WRITE HEADING ON TOP-OF-PAGE.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = it_list_commentary

    i_logo = 'ENJOYSAP_LOGO'

    • I_END_OF_LIST_GRID = I_END_OF_LIST_GRID

    • I_ALV_FORM = I_ALV_FORM

    .

    ENDFORM. "FAREEDA

    &----


    *& Form USER_COMMAND

    &----


    *----


    USER COMMAND DECLARATION

    FORM user_command USING rf_ucomm LIKE sy-ucomm

    rs_selfield TYPE slis_selfield.

    DATA: w_message(40).

    CASE rf_ucomm.

    WHEN '&IC1'.

    CASE rs_selfield-fieldname.

    WHEN 'KUNNR'.

    CLEAR w_message.

    CONCATENATE 'The Customer' rs_selfield-value 'is selected'

    INTO w_message SEPARATED BY space.

    MESSAGE w_message TYPE 'I'.

    WHEN 'ORT01'.

    CLEAR w_message.

    CONCATENATE 'The City' rs_selfield-value 'is selected'

    INTO w_message SEPARATED BY space.

    MESSAGE w_message TYPE 'I'.

    WHEN 'LAND1'.

    CLEAR w_message.

    CONCATENATE 'The Country' rs_selfield-value 'is selected'

    INTO w_message SEPARATED BY space.

    MESSAGE w_message TYPE 'I'.

    WHEN OTHERS.

    MESSAGE 'U HAVE SELECTED WRONG FIELD'(001) TYPE 'I'.

    ENDCASE.

    ENDCASE.

    ENDFORM. "user_command

    &----


    *& Form field_cat

    &----


    FORM field_cat.

    CLEAR wa_fieldcat.

    wa_fieldcat-col_pos = '1'.

    wa_fieldcat-fieldname = 'KUNNR'.

    wa_fieldcat-ref_tabname = 'KNA1'.

    wa_fieldcat-seltext_l = 'Customer Number 1'.

    • wa_fieldcat-ref_fieldname = 'KUNNR'.

    wa_fieldcat-key = 'X'.

    APPEND wa_fieldcat TO it_fieldcat.

    wa_fieldcat-col_pos = '1'.

    wa_fieldcat-fieldname = 'LAND1'.

    wa_fieldcat-ref_tabname = 'KNA1'.

    wa_fieldcat-seltext_l = 'Country Key'.

    • wa_fieldcat-ref_fieldname = 'LAND1'.

    wa_fieldcat-key = 'X'.

    APPEND wa_fieldcat TO it_fieldcat.

    wa_fieldcat-col_pos = '1'.

    wa_fieldcat-fieldname = 'NAME1'.

    wa_fieldcat-ref_tabname = 'KNA1'.

    wa_fieldcat-seltext_l = 'Name 1'.

    • wa_fieldcat-ref_fieldname = 'NAME1'.

    wa_fieldcat-key = 'X'.

    APPEND wa_fieldcat TO it_fieldcat.

    wa_fieldcat-col_pos = '1'.

    wa_fieldcat-fieldname = 'ORT01'.

    wa_fieldcat-ref_tabname = 'KNA1'.

    wa_fieldcat-seltext_l = 'City'.

    • wa_fieldcat-ref_fieldname = 'ORT01'.

    wa_fieldcat-key = 'X'.

    APPEND wa_fieldcat TO it_fieldcat.

    ENDFORM. " field_cat

    i hope this may resolve ur requriment.ok pls reward if useful .ok dont forgot to reward points

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 10:53 AM

    hi,

    still if u have doubt in top-of-page event ,pls refer the standard program in se38 -


    > BALVST02_GRID

    reward points if usefull to u, ok dont forgot to reward

    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.