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: 

report

Former Member
0 Kudos
122

Hi guys,

i have a report displaying some fields. Some of the fields are say Purchasing Document,Vendor and material short text etc.

Now my requirement is if the user clicks on Purchasing Document it should take him to transaction ME33, if on Vendor then to transaction MK03 and if on material then to MM03. How is this possible in ALV???????

Please help me out. Its very urgent.

All useful answers will be awarded generously.

10 REPLIES 10

Former Member
0 Kudos
84

In your call to the alv add USER COMMAND

and then declare a form called USER COMMAND in which you put the code to call the transactions on the double click

form user_command using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

if r_ucomm = '&IC1'.

if rs_selfield-tabindex ne 0.

read table tb_out index rs_selfield-tabindex.

call transaction XXXX (using the information of the line you select

endif.

endif.

endform.

Former Member
0 Kudos
84

you can achieve this by hiding the required field. (hide field)

Then you can use at line-selection or at user-command to call the corresponding transaction ME23

Former Member
0 Kudos
84

check this code for .

REPORT ZMM_PO_TEXT

no standard page heading

line-size 300

message-id zmsg.

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

  • Tables *

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

TABLES : EKKO, "Purchasing Document Header

EKPO, "Purchasing Document Item

EKBE. "History per Purchasing Doc

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

  • Internal table for display *

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

DATA : begin of it_item occurs 0 ,

ebeln like ekpo-ebeln, "pur doc no

ebelp like ekpo-ebelp, "pur doc no item

matnr like ekpo-matnr, "material no

werks like ekpo-werks, "Plant

bedat like ekko-bedat, "pur doc date

banfn like eban-banfn, "Purchase requisition number

bnfpo like eban-bnfpo, "Item number of purchase requisition

charg like ekbe-charg , "Batch Number

end of it_item.

DATA it_temp like table of it_item with header line.

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

  • ALV VARIABLES AND INTERNAL TABLES

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

TYPE-POOLS: slis.

DATA:st_layout TYPE slis_layout_alv,

it_fieldcat TYPE slis_t_fieldcat_alv,

it_listheader TYPE slis_t_listheader,

it_event TYPE slis_t_event,

keyinfo TYPE slis_keyinfo_alv.

DATA:ls_selfield TYPE slis_selfield.

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

  • VARIABLES *

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

DATA:

v_repid LIKE sy-repid,

name like thead-tdname,

lines like tline occurs 0 with header line.

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

*SELECTION SCREEN DEFINITIONS

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

SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:

so_plant FOR ekpo-werks,

so_date FOR ekko-bedat OBLIGATORY,

so_matnr for ekpo-matnr,

so_ebeln for ekko-ebeln.

SELECTION-SCREEN: END OF BLOCK a1.

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

  • INITIALIZATION *

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

INITIALIZATION.

v_repid = sy-repid.

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

*START-OF-SELECTION

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

START-OF-SELECTION.

PERFORM get_data.

PERFORM display_data.

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

  • END-OF-SELECTION *

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

END-OF-SELECTION.

*START-OF-SELECTION.

*

*perform get_data.

*

*perform display_data .

AT LINE-SELECTION.

if it_item-banfn is initial.

SET PARAMETER ID 'BES' FIELD it_item-EBELN.

CALL TRANSACTION 'ME23N'.

else.

SET PARAMETER ID 'BAN' FIELD it_item-Banfn.

CALL TRANSACTION 'ME53N'.

endif.

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

  • Form get data ******************

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

FORM get_data.

if so_date-high is initial.

so_date-high = sy-datum.

endif.

select aebeln aebelp amatnr awerks

b~bedat

c~charg

into corresponding fields of table it_item

from ekpo as a inner join ekko as b

on aebeln = bebeln

inner join eket as c on aebeln = cebeln and aebelp = cebelp

where a~werks in so_plant

and a~matnr in so_matnr

and a~ebeln in so_ebeln

and b~bedat between so_date-low and so_date-high .

DELETE ADJACENT DUPLICATES FROM it_item.

SORT it_item by ebeln bedat.

endform.

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

*FORM FOR DISPLAY DATA

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

FORM display_data .

loop at it_item.

write: / it_item-ebeln hotspot.

hide it_item-ebeln.

endloop.

ENDFORM. " display_data

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

check this code for ALV

REPORT ZMM_PO_TEXT

no standard page heading

line-size 300

message-id zmsg.

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

  • Tables *

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

TABLES : EKKO, "Purchasing Document Header

EKPO, "Purchasing Document Item

EKBE. "History per Purchasing Doc

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

  • Internal table for display *

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

DATA : begin of it_item occurs 0 ,

ebeln like ekpo-ebeln, "pur doc no

ebelp like ekpo-ebelp, "pur doc no item

matnr like ekpo-matnr, "material no

werks like ekpo-werks, "Plant

bedat like ekko-bedat, "pur doc date

banfn like eban-banfn, "Purchase requisition number

bnfpo like eban-bnfpo, "Item number of purchase requisition

charg like ekbe-charg , "Batch Number

end of it_item.

DATA it_temp like table of it_item with header line.

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

  • ALV VARIABLES AND INTERNAL TABLES

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

TYPE-POOLS: slis.

DATA:st_layout TYPE slis_layout_alv,

it_fieldcat TYPE slis_t_fieldcat_alv,

it_listheader TYPE slis_t_listheader,

it_event TYPE slis_t_event,

keyinfo TYPE slis_keyinfo_alv.

DATA:ls_selfield TYPE slis_selfield.

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

  • VARIABLES *

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

DATA:

v_repid LIKE sy-repid,

name like thead-tdname,

lines like tline occurs 0 with header line.

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

*SELECTION SCREEN DEFINITIONS

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

SELECTION-SCREEN: BEGIN OF BLOCK a1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:

so_plant FOR ekpo-werks,

so_date FOR ekko-bedat OBLIGATORY,

so_matnr for ekpo-matnr,

so_ebeln for ekko-ebeln.

SELECTION-SCREEN: END OF BLOCK a1.

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

  • INITIALIZATION *

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

INITIALIZATION.

v_repid = sy-repid.

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

*START-OF-SELECTION

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

START-OF-SELECTION.

PERFORM get_data.

IF it_item[] IS NOT INITIAL.

PERFORM display_data.

ELSE.

MESSAGE i012(zmsg).

ENDIF.

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

  • END-OF-SELECTION *

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

END-OF-SELECTION.

*START-OF-SELECTION.

*

*perform get_data.

*

*perform display_data .

*******AT LINE-SELECTION.

******if it_data-banfn is initial.

******SET PARAMETER ID 'BES' FIELD it_data-EBELN.

******CALL TRANSACTION 'ME23N'.

******else.

******SET PARAMETER ID 'BAN' FIELD it_data-Banfn.

******CALL TRANSACTION 'ME53N'.

******endif.

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

  • Form get data ******************

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

FORM get_data.

if so_date-high is initial.

so_date-high = sy-datum.

endif.

select aebeln aebelp amatnr awerks

b~bedat

c~charg

into corresponding fields of table it_item

from ekpo as a inner join ekko as b

on aebeln = bebeln

inner join eket as c on aebeln = cebeln and aebelp = cebelp

where a~werks in so_plant

and a~matnr in so_matnr

and a~ebeln in so_ebeln

and b~bedat between so_date-low and so_date-high .

DELETE ADJACENT DUPLICATES FROM it_item.

SORT it_item by ebeln bedat.

loop at it_ITEM.

select single banfn bnfpo into (it_ITEM-banfn,it_ITEM-bnfpo) from eban where ebeln = it_ITEM-ebeln

and ebelp = it_ITEM-ebelp.

*select single charg into (it_ITEM-charg) from ekbe where ebeln = it_ITEM-EBELP.

if sy-subrc IS INITIAL.

CONCATENATE it_item-banfn it_item-bnfpo INTO NAME.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'B06'

LANGUAGE = sy-langu

NAME = NAME

OBJECT = 'EBAN'

TABLES

LINES = lines

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

MODIFY IT_ITEM.

else.

CONCATENATE it_item-EBELN it_item-EBELP INTO NAME.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'F10'

LANGUAGE = sy-langu

NAME = NAME

OBJECT = 'EKPO'

TABLES

LINES = lines

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

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.

IF LINES[] IS INITIAL.

DELETE IT_ITEM.

ENDIF.

CLEAR: IT_ITEM, LINES.

REFRESH : LINES.

endloop.

ENDFORM. " display_data

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

*FORM FOR DISPLAY DATA

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

FORM display_data .

PERFORM fill_layout_structure.

PERFORM fill_field_catalog_table.

PERFORM get_event USING it_event.

PERFORM fill_listheader USING it_listheader.

perFORM call_alv_function.

ENDFORM. " display_data

&----


*& Form fill_layout_structure

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_layout_structure .

st_layout-zebra = 'X'.

ENDFORM. " fill_layout_structure

&----


*& Form fill_field_catalog_table

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_field_catalog_table .

PERFORM fill_field_catalog USING :

'EBELN' 'P.O Number' 'IT_ITEM' 'X' space '10' 'X',

'EBELP' 'P.O. Item No' 'IT_ITEM' space space '10' space,

'BEDAT' 'P.O. Date' 'IT_ITEM' space space '10' space,

'WERKS' 'Plant' 'IT_ITEM' space space '10' space,

'MATNR' 'Material no' 'IT_ITEM' space space '18' space,

'BANFN' 'P.R. Number' 'IT_ITEM' space space '18' space,

'CHARG' 'Batch Number' 'IT_ITEM' space space '10' 'space' .

ENDFORM. " fill_field_catalog_table

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

*FORM FOR FILLING FIELD CATALOG

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

FORM fill_field_catalog USING f d t p S o h.

DATA: wa_fieldcat TYPE slis_fieldcat_alv.

STATICS v_pos TYPE i VALUE 1.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = v_pos.

wa_fieldcat-fieldname = f.

wa_fieldcat-seltext_m = d.

wa_fieldcat-tabname = t.

wa_fieldcat-hotspot = h.

APPEND wa_fieldcat TO it_fieldcat.

v_pos = v_pos + 1.

ENDFORM. "fill_field_catalog

&----


*& Form fill_listheader

&----


  • text

----


  • -->P_IT_LISTHEADER text

----


FORM fill_listheader USING P_IT_LISTHEADER TYPE slis_t_listheader.

DATA : wa_listheader TYPE slis_listheader.

CLEAR wa_listheader.

wa_listheader-typ = 'S'.

wa_listheader-info ='PURCHASE ORDER TEXTS '.

APPEND wa_listheader TO it_listheader.

ENDFORM. " fill_listheader

&----


*& Form get_event

&----


  • text

----


  • -->P_IT_EVENT text

----


FORM get_event USING P_IT_EVENT TYPE slis_t_event.

DATA : wa_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = it_event.

READ TABLE it_event WITH KEY name = slis_ev_top_of_page INTO wa_event.

IF SY-SUBRC = 0.

MOVE 'TOP_OF_PAGE' to wa_event-form.

APPEND wa_event to it_event.

ENDIF.

ENDFORM. " get_event

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

*FORM FOR TOP_OF_PAGE(to assign form for the top-of-page event)

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

FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_listheader.

ENDFORM. "top_of_page

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

*FORM FOR ALV FUNCTIONS

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

FORM call_alv_function.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'CALL_TCODE'

  • I_STRUCTURE_NAME =

IS_LAYOUT = st_layout

IT_FIELDCAT = it_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = it_event[]

  • 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

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = it_item

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

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

*FORM FOR ALV CALL_TCODE

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

FORM call_tcode USING r_ucomm ls_selfield LIKE ls_selfield.

CASE r_ucomm.

WHEN '&IC1'.

IF ls_selfield-fieldname = 'EBELN'.

SET PARAMETER ID 'BES' FIELD ls_selfield-value.

CALL TRANSACTION 'ME23N'.

ENDIF.

IF ls_selfield-fieldname = 'BANFN'.

SET PARAMETER ID 'BAN' FIELD ls_selfield-value.

CALL TRANSACTION 'ME53N' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM.

regards,

Prabhu

Reward if it is helpful

Former Member
0 Kudos
84

hi,

for your requirement use AT USER-COMMAND event or AT LINE-SELECTION events.

in end-of-selection event.

after write statement.

AT LINE-SELECTION.

case sy-lisel.

when 'vbeln'.

CALL TRANSACTION ME33 with initial screen 0.

when 'vendor'.

CALL TRANSACTION MK03 with initial screen 0.

when 'materail'.

CALL TRANSACTION MM03 with initial screen 0.

endcase.

if helpful reward some points.

with regards,

Suresh.A

varma_narayana
Active Contributor
0 Kudos
84

Handle the USER_COMMAND event of ALV .

i.e in The REUSE_ALV_GRID_DISPLAY function

pass the Subroutine name(Eg: F_USER_COMMAND) to the Parameter USER_COMMAND

<b>Code:</b>

Form F_user_command

using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

CASE r_ucomm

WHEN '&IC1' . " Function code of the Button

if rs_selfield-tabindex ne 0.

read table tb_out index rs_selfield-tabindex.

**incase of MaterialNo

CASE re_selfield-fieldname.

when 'MATNR'.

SET PARAMETER ID 'MAT' FIELD rs_selfield-value.

call transaction 'MM03' and skip first screen.

when 'LIFNR'.

ENDCASE.

endif.

ENDCASE.

endform.

<b>Reward if Helpful.</b>

Former Member
0 Kudos
84

Hi,

yes s it possible, There are two ways:

1) if AVL is manage and develop with O/O pragramming language you can use double click event trought methods, generate 1 event each for any transaction you want call. use the event name to start a call transaction in double click event.

2) if AVL is develop with function module i don't no if is it possible.

More semple are useing Table controll.

Simone

Former Member
0 Kudos
84

Hi

Yes, you can create such link/hotspot in ALV.

Code:

TYPE-POOLS: slis.

2) Declare callback program and callback subroutine. SAP must know which subroutine of which program must be executed when clicking on a hotspot of an ALV grid :

Code:

data : w_callback_subroutine TYPE slis_formname,

w_callback_program LIKE sy-repid.

3) Assign value to those two variables before calling ALV grid :

Code:

w_callback_program = sy-repid.

w_callback_subroutine = 'USER_COMMAND'.

(or any other subroutine name but in upper case)

4) Define subroutine handling double-click :

Code:

FORM user_command USING p_ucomm LIKE sy-ucomm

p_selfield TYPE slis_selfield.

CASE p_ucomm.

WHEN '&IC1'. " SAP standard code for double-clicking

SET PARAMETER ID 'XXX' FIELD p_selfield-value.

CALL TRANSACTION 'YYYY'.

ENDCASE.

*******************************Example******************

WHEN 'EBELN'.

IF wa_line-ebeln <> ' Req ' AND

wa_line-ebeln <> ' PO MISC '.

CHECK NOT wa_line-ebeln IS INITIAL.

SET PARAMETER ID 'BES' FIELD wa_line-ebeln.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

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

ENDFORM.

5) Call ALV grid function :

Code:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_callback_program

it_fieldcat = it_fieldcat

i_callback_user_command = w_callback_subroutine

TABLES

t_outtab = it_data

EXCEPTIONS

program_error = 1

OTHERS = 2.

N.B. : don't forget in your catalog to set field 'hotspot' to 'X' for the desired field.

Cheers

~Arun

Former Member
0 Kudos
84

Check this code and see how to user user_command to trigger different tcodes:

&----


*& Report ZTEST2

*&

&----


*&

*&

&----


REPORT ZTEST2 .

TABLES :MARA,MARD.

TYPE-POOLS :SLIS.

DATA: BEGIN OF IT_MARA OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MBRSH LIKE MARA-MBRSH,

BSTME LIKE MARA-BSTME,

END OF IT_MARA.

DATA: BEGIN OF IT_MARD OCCURS 0,

MATNR LIKE MARD-MATNR,

WERKS LIKE MARD-WERKS,

LGORT LIKE MARD-LGORT,

LABST LIKE MARD-LABST,

END OF IT_MARD.

DATA :L_REPID LIKE SY-REPID,

IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

IT_LISTHEADER TYPE SLIS_T_LISTHEADER,

WA_LISTHEADER TYPE SLIS_LISTHEADER,

IT_EVENTS TYPE SLIS_T_EVENT,

WA_EVENTS TYPE SLIS_ALV_EVENT.

SELECTION-SCREEN :BEGIN OF BLOCK SCREEN WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS :SO_MATNR FOR MARA-MATNR.

SELECTION-SCREEN END OF BLOCK SCREEN.

INITIALIZATION.

L_REPID = SY-REPID.

PERFORM CREATE_FIELDCAT.

PERFORM CREATE_EVENTS.

PERFORM POPULATE_EVENTS.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM CREATE_LISTHEADER.

PERFORM DISPLAY_LIST.

&----


*& Form CREATE_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CREATE_FIELDCAT .

WA_FIELDCAT-TABNAME = 'IT_MARA'.

WA_FIELDCAT-FIELDNAME = 'MATNR'.

WA_FIELDCAT-SELTEXT_M = 'Material NO'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_MARA'.

WA_FIELDCAT-FIELDNAME = 'MTART'.

WA_FIELDCAT-SELTEXT_M = 'Material Type'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_MARA'.

WA_FIELDCAT-FIELDNAME = 'MBRSH'.

WA_FIELDCAT-SELTEXT_M = 'Industry Sector'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_MARA'.

WA_FIELDCAT-FIELDNAME = 'BSTME'.

WA_FIELDCAT-SELTEXT_M = 'Order Units'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

ENDFORM. " CREATE_FIELDCAT

&----


*& Form CREATE_EVENTS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CREATE_EVENTS .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IT_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. " CREATE_EVENTS

&----


*& Form POPULATE_EVENTS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM POPULATE_EVENTS .

READ TABLE IT_EVENTS INTO WA_EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC = 0.

WA_EVENTS-FORM = 'TOP_OF_PAGE'.

MODIFY IT_EVENTS FROM WA_EVENTS TRANSPORTING FORM WHERE NAME =

WA_EVENTS-NAME.

ENDIF.

READ TABLE IT_EVENTS INTO WA_EVENTS WITH KEY NAME = 'USER_COMMAND'.

IF SY-SUBRC = 0.

WA_EVENTS-FORM = 'USER_COMMAND'.

MODIFY IT_EVENTS FROM WA_EVENTS TRANSPORTING FORM WHERE NAME =

WA_EVENTS-NAME.

ENDIF.

ENDFORM. " POPULATE_EVENTS

&----


*& Form GET_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_DATA .

SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE

IT_MARA WHERE MATNR IN SO_MATNR.

ENDFORM. " GET_DATA

&----


*& Form CREATE_LISTHEADER

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CREATE_LISTHEADER .

DATA : L_DATE(10).

WRITE : SY-DATUM TO L_DATE USING EDIT MASK '__/__/____'.

WA_LISTHEADER-INFO = 'Material in Inventory'.

WA_LISTHEADER-TYP = 'H'.

APPEND WA_LISTHEADER TO IT_LISTHEADER.

CLEAR WA_LISTHEADER.

WA_LISTHEADER-INFO = SY-UNAME.

WA_LISTHEADER-TYP = 'A'.

APPEND WA_LISTHEADER TO IT_LISTHEADER.

CLEAR WA_LISTHEADER.

WA_LISTHEADER-INFO = L_DATE.

WA_LISTHEADER-TYP = 'A'.

APPEND WA_LISTHEADER TO IT_LISTHEADER.

CLEAR WA_LISTHEADER.

ENDFORM. " CREATE_LISTHEADER

&----


*& Form DISPLAY_LIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_LIST .

L_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = L_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = '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 = IT_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = 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 = 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. " DISPLAY_LIST

FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEADER

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

ENDFORM. "TOP_OF_PAGE

FORM USER_COMMAND USING L_UCOMM TYPE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE L_UCOMM.

WHEN '&IC1'.

IF RS_SELFIELD-SEL_TAB_FIELD = 'IT_MARA-MATNR'.

CALL TRANSACTION 'ME33'.

ELSEIF RS_SELFIELD-SEL_TAB_FIELD = 'IT_MARA-MTART'.

CALL TRANSACTION 'MB51'.

ELSE. CALL TRANSACTION 'ME23N'.

ENDIF.

Former Member
0 Kudos
84

Hi,

FORM USER COMMAND R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD

IF RS_SELFIELD-NAME = 'VBELN'.

DELIVERY = RS_SELFIELD-VALUE.

SET PARAMETER ID 'VL' FIELD DELIVAR1.

CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.

In above code user command u have to pass in the GRID_DISPLAY function module.

Delivery declare as a variable.

if it is use full answer reward me a points.

Former Member
0 Kudos
84

Hi there

you can refer this thread too

Cheers

~Arun