Application Development 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: 

Could anyone give me a detailed......

Former Member
0 Kudos

Hi experts,

could any give me a detailed alv report with all the main events? the internal table should contain matnr,maktx,ersda,ernam from marav.your answers wil be rewarded.

Thanks in advance,

Ramana

1 ACCEPTED SOLUTION

sourabhshah
Advisor
Advisor
0 Kudos

Hi Ramanna,

this is a sample alv report with events

BCALV_TEST_GRID_EVENTS

Regards,

Sourabh

4 REPLIES 4

sourabhshah
Advisor
Advisor
0 Kudos

Hi Ramanna,

this is a sample alv report with events

BCALV_TEST_GRID_EVENTS

Regards,

Sourabh

Former Member
0 Kudos

check this

<a href="http://www.erpgenie.com/abap/controls/alvgrid.htm">http://www.erpgenie.com/abap/controls/alvgrid.htm</a>

<a href="http://www.sap-img.com/abap/an-interactive-alv-report.htm">http://www.sap-img.com/abap/an-interactive-alv-report.htm</a>

regards

shiba dutta

Former Member
0 Kudos

Hi

Plz check the following code:

&----


*& Report ZPC_ALV_1 *

*& *

&----


*& *

*& *

&----


report zpc_alv_1 .

type-pools : slis .

****NO END-OF-SELECTION HERE AS WE DON'T USE WRITE STATMNTS IN ALV***

tables : mara , mard , makt .

data : begin of itab occurs 0 ,

matnr type mara-matnr ,

mtart type mara-mtart ,

matkl type mara-matkl ,

werks type mard-werks ,

lgort type mard-lgort ,

maktx type makt-maktx ,

end of itab .

parameters : a like mara-matnr ,b like mard-werks .

****************fieldcatalog*********************

data:anytab type slis_t_fieldcat_alv with header line.

**************pgm name**********************

data:anypgnm type sy-repid.

**************events*************************

data : events type slis_t_event.

****************start of selection ***************

start-of-selection.

perform build_itab.

perform build_fieldcat.

perform display.

perform my_events.

top-of-page.

perform top_page.

&----


*& Form BUILD_ITAB

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form build_itab.

select xmatnr xmtart xmatkl ywerks ylgort zmaktx

into corresponding fields of table itab

from ( ( mara as x inner join mard as y on xmatnr = ymatnr )

inner join makt as z on xmatnr = zmatnr ) where x~matnr = a and

y~werks

= b .

endform. " BUILD_ITAB

&----


*& Form BUILD_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form build_fieldcat.

anytab-fieldname = 'MATNR'.

anytab-seltext_m = 'Material Number'.

anytab-col_pos = 0.

anytab-outputlen = 20.

anytab-emphasize = 'X'.

append anytab to anytab .

clear anytab .

anytab-fieldname = 'MAKTX'.

anytab-seltext_m = 'Material Description'.

anytab-col_pos = 1.

anytab-outputlen = 15.

append anytab to anytab .

clear anytab .

anytab-fieldname = 'MTART'.

anytab-seltext_m = 'Material Type'.

anytab-col_pos = 2.

anytab-outputlen = 10.

append anytab to anytab.

clear anytab .

anytab-fieldname = 'MATKL'.

anytab-seltext_m = 'Material Group'.

anytab-col_pos = 3.

anytab-outputlen = 15.

append anytab to anytab .

clear anytab .

anytab-fieldname = 'WERKS'.

anytab-seltext_m = 'Plant'.

anytab-col_pos = 4.

anytab-outputlen = 10.

append anytab to anytab .

clear anytab .

anytab-fieldname = 'LGORT'.

anytab-seltext_m = 'Location'.

anytab-col_pos = 5.

anytab-outputlen = 10.

append anytab to anytab.

clear anytab .

endform. " BUILD_FIELDCAT

&----


*& Form DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display.

anypgnm = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = anypgnm " DONT PUT THIS IN ''

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

i_callback_top_of_page = 'TOP_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 = anytab[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

it_events = 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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

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

endform. " DISPLAY

&----


*& Form TOP_PAGE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form top_page.

data : t_header type slis_t_listheader,

wa_header type slis_listheader,

t_line like wa_header-info,

ld_lines type i,

ld_linesc(10) type c.

wa_header-typ = 'H'. " H is 4 big heading.

wa_header-info = 'ABC LIMITED'.

append wa_header to t_header.

clear wa_header.

*Date

wa_header-typ = 'S'. "S is 4 small stmnts.

wa_header-key = 'Date: '.

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

sy-datum+4(2) '.'

sy-datum(4) into wa_header-info. "todayz date.

append wa_header to t_header.

clear: wa_header.

wa_header-typ = 'S'.

wa_header-key = 'MATERIAL NUMBER: '.

wa_header-info = a .

append wa_header to t_header.

clear wa_header.

wa_header-typ = 'S'.

wa_header-key = 'PLANT: '.

wa_header-info = b .

append wa_header to t_header.

clear wa_header.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header .

  • I_LOGO =

  • I_END_OF_LIST_GRID =

.

endform. " TOP_PAGE

&----


*& Form MY_EVENTS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form my_events.

data: ls_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = events[]

  • EXCEPTIONS

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

It wud help u.

Regards

Pankaj