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: 

jump to transaction me21n from output screen.

Former Member
0 Kudos

hi,

I am displaying PO ,item no from ekpo table.On the output screen where data is displayed , when i click on PO no i need to go to transaction me21n.Can anyone plz help me and tell me the mechanism.

10 REPLIES 10

Former Member
0 Kudos

hi,

just tell me r u using classical or alv?

and u want to skip first screen of ME21n?

Former Member
0 Kudos

i using classical...when i click on PO no i need to go directly to me21n screen for that PO no.

0 Kudos

try using the following statements in your code after you set the necessary hotspot :

AT LINE-SELECTION.

SET PARAMETER ID 'BES' FIELD <field-name>.

CALL TRANSACTION 'ME21N'.

plz reward if useful.

Former Member
0 Kudos

CHECK R_UCOMM = '&IC1'. "User Double Clicked on Some field

CHECK NOT RS_SELFIELD-VALUE IS INITIAL.

CASE RS_SELFIELD-FIELDNAME.

WHEN 'EBELN'.

READ TABLE IT_FINAL INDEX RS_SELFIELD-TABINDEX.

IF SY-SUBRC EQ 0.

SET PARAMETER ID 'BES' FIELD IT_FINAL-EBELN.

CALL TRANSACTION 'ME21N' AND SKIP FIRST SCREEN.

ENDIF. " IF SY-SUBRC EQ 0

ENDCASE. " ENDCASE

Here IT_FINAL is your internal table

Former Member
0 Kudos

Hi Amar,

If your basic list is from a z program, then it is easy.

Just use call transaction statement.

Regards,

Ravi

Former Member
0 Kudos

you can go to ME23N where it will display the particular PO.

Check this alv report.

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,

so_ekorg for ekko-ekorg,

so_ekgrp for ekko-ekgrp.

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

and b~ekorg in so_ekorg

and b~ekgrp in so_ekgrp .

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.

For classical

use HIDE statement, AT LINE SELECTION event and CALL TRANSACTION Statement.

regards,

Prabhu

Reward if it is helpful.

Former Member
0 Kudos

HI

see this program u can understand easily

do for ur program

REPORT Z_TEST_ALV_INTERACTIVE NO STANDARD PAGE HEADING

LINE-SIZE 80

LINE-COUNT 62(3).

TYPE-POOLS: SLIS.

TABLES: VBAK, VBAP.

DATA: BEGIN OF T_VBAK OCCURS 0,

VBELN LIKE VBAK-VBELN,

VKORG LIKE VBAK-VKORG,

END OF T_VBAK.

DATA: BEGIN OF T_VBAP OCCURS 0,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

END OF T_VBAP.

CONSTANTS:

C_GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

C_GC_FORMNAME_UCOMM TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',

C_H TYPE SLIS_LISTHEADER VALUE 'H',

C_S TYPE SLIS_LISTHEADER VALUE 'S',

C_X(1) TYPE C VALUE 'X',

C_Y(1) TYPE C VALUE 'X',

C_DESC(4) TYPE C VALUE 'DESC',

C_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

DATA: V_REPID LIKE SY-REPID.

  • T_GT_SORT =>Table to Pass Sort Data to ALV display

DATA: T_GT_SORT TYPE SLIS_T_SORTINFO_ALV,

  • T_FIELDCAT =>Table to Pass The FieldS to ALV Display

T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,

  • T_EVENT =>Table to store Data of Event

T_EVENT TYPE SLIS_T_EVENT,

  • T_GT_LIST_TOP_OF_PAGE =>Table to store The Values of Top-Of-Page

  • Parameter for ALV Display

T_GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

DATA: WS_LS_LINE TYPE SLIS_LISTHEADER, " Structure for header part

WS_S_LAYOUT TYPE SLIS_LAYOUT_ALV,

WS_LS_EVENT TYPE SLIS_ALV_EVENT,

WA_BALANCE LIKE KPARALLEL_VAL, " Tot val in CO area curr

WA_BALANCE_PREV LIKE KPARALLEL_VAL, " Totl val in CO area curr

WS_GS_SORT TYPE SLIS_SORTINFO_ALV.

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

SELECT-OPTIONS: S_VKORG FOR VBAK-VKORG ."obligatory.

SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION.

V_REPID = SY-REPID.

START-OF-SELECTION.

PERFORM GET_VBAK_DATA.

PERFORM GET_VBAP_DATA.

END-OF-SELECTION.

  • PERFORM TO BUILD CATALOG FOR ALV DISPLAY

PERFORM BUILD_ALV_CATALOG.

  • PERFORM TO HANDLE THE EVENT OF ALV DISPLAY

PERFORM POPULATE_EVENT.

  • PERFORM comment_build

PERFORM COMMENT_BUILD USING T_GT_LIST_TOP_OF_PAGE[].

  • PERFORM TO CALL ALV GRID FOR DATA DISPLAY

PERFORM DISPLAY_DATA.

&----


*& Form get_vbak_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VBAK_DATA .

SELECT VBELN VKORG INTO TABLE T_VBAK FROM VBAK

WHERE VKORG IN S_VKORG.

IF SY-SUBRC <> 0.

MESSAGE I398(00) WITH 'No Data Exists in VBAK'(002).

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " get_vbak_data

&----


*& Form get_vbap_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VBAP_DATA .

SELECT VBELN POSNR MATNR INTO TABLE T_VBAP FROM VBAP

FOR ALL ENTRIES IN T_VBAK

WHERE VBELN = T_VBAK-VBELN.

IF SY-SUBRC <> 0.

MESSAGE I398(00) WITH 'No Data Exists in VBAP'(003).

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " get_vbap_data

&----


*& Form display_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_REPORT .

LOOP AT T_VBAP.

WRITE:/1 '|',2(10) T_VBAP-VBELN COLOR 4 HOTSPOT ON,

12 '|', 13(5) T_VBAP-POSNR,

18 '|',19(18) T_VBAP-MATNR, 37 '|'.

HIDE: T_VBAP.

ULINE AT /1(37).

ENDLOOP.

ENDFORM. " display_report

&----


*& Form BUILD_ALV_CATALOG

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BUILD_ALV_CATALOG .

PERFORM POPULATE_CATALOGUE USING:

'01' 'VBELN' 'T_VBAP' 'Order #' ' ' 'X' ' ' ' ',

'02' 'POSNR' 'T_VBAP' 'Line #' ' ' ' ' ' ' ' ',

'03' 'MATNR' 'T_VBAP' 'Material Code' ' ' ' ' ' ' ' '.

ENDFORM. " BUILD_ALV_CATALOG

&----


*& Form populate_catalogue

&----


  • text

----


  • -->P_0209 text

  • -->P_0210 text

  • -->P_0211 text

  • -->P_0212 text

  • -->P_0213 text

  • -->P_0214 text

  • -->P_0215 text

  • -->P_0216 text

----


FORM POPULATE_CATALOGUE USING P_POSITION TYPE SYCUCOL

P_FNAME TYPE FIELDNAME

P_TABNAME TYPE TABNAME

P_TITLE TYPE REPTEXT

P_DISPLAY TYPE C

P_HOTSPOT TYPE C

P_SUM TYPE C

P_KEY TYPE C.

DATA:STRUCT_CAT TYPE SLIS_FIELDCAT_ALV.

STRUCT_CAT-COL_POS = P_POSITION.

STRUCT_CAT-FIELDNAME = P_FNAME.

STRUCT_CAT-TABNAME = P_TABNAME.

STRUCT_CAT-REPTEXT_DDIC = P_TITLE.

STRUCT_CAT-NO_OUT = P_DISPLAY.

STRUCT_CAT-HOTSPOT = P_HOTSPOT.

STRUCT_CAT-DO_SUM = P_SUM.

STRUCT_CAT-KEY = P_KEY.

APPEND STRUCT_CAT TO T_FIELDCAT.

CLEAR STRUCT_CAT.

ENDFORM. " populate_catalogue

&----


*& Form POPULATE_EVENT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM POPULATE_EVENT .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = T_EVENT "event handling

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.

ELSE.

READ TABLE T_EVENT WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO

WS_LS_EVENT.

IF SY-SUBRC = 0.

MOVE C_GC_FORMNAME_TOP_OF_PAGE TO WS_LS_EVENT-FORM.

MODIFY T_EVENT FROM WS_LS_EVENT INDEX SY-TABIX TRANSPORTING FORM.

ENDIF.

  • READ TABLE T_EVENT WITH KEY NAME = SLIS_EV_USER_COMMAND INTO

  • WS_LS_EVENT.

  • IF SY-SUBRC = 0.

  • MOVE C_GC_FORMNAME_UCOMM TO WS_LS_EVENT-FORM.

  • MODIFY T_EVENT FROM WS_LS_EVENT INDEX SY-TABIX TRANSPORTING FORM.

  • ENDIF.

ENDIF.

ENDFORM. " POPULATE_EVENT

&----


*& Form COMMENT_BUILD

&----


  • text

----


  • -->P_T_GT_LIST_TOP_OF_PAGE[] text

----


FORM COMMENT_BUILD USING P_T_GT_LIST_TOP_OF_PAGE TYPE

SLIS_T_LISTHEADER.

CLEAR WS_LS_LINE.

WS_LS_LINE-TYP = C_H.

CONCATENATE SY-TITLE

'FOR'

'CAPGEMINI'

INTO WS_LS_LINE-INFO

SEPARATED BY SPACE.

APPEND WS_LS_LINE TO P_T_GT_LIST_TOP_OF_PAGE.

CLEAR WS_LS_LINE.

WS_LS_LINE-TYP = C_S.

WS_LS_LINE-KEY = 'Sales Order Report'.

WRITE SY-REPID TO WS_LS_LINE-INFO.

APPEND WS_LS_LINE TO P_T_GT_LIST_TOP_OF_PAGE.

CLEAR WS_LS_LINE.

WS_LS_LINE-TYP = C_S.

WS_LS_LINE-KEY = 'Date:'.

WRITE SY-DATUM TO WS_LS_LINE-INFO.

APPEND WS_LS_LINE TO P_T_GT_LIST_TOP_OF_PAGE.

CLEAR WS_LS_LINE.

WS_LS_LINE-TYP = C_S.

WS_LS_LINE-KEY = 'Time:'.

WRITE SY-UZEIT TO WS_LS_LINE-INFO.

APPEND WS_LS_LINE TO P_T_GT_LIST_TOP_OF_PAGE.

CLEAR WS_LS_LINE.

WS_LS_LINE-TYP = C_S.

WS_LS_LINE-KEY = 'User:'.

WS_LS_LINE-INFO = SY-UNAME.

APPEND WS_LS_LINE TO P_T_GT_LIST_TOP_OF_PAGE.

CLEAR WS_LS_LINE.

WS_LS_LINE-TYP = C_S.

WS_LS_LINE-KEY = 'System Detail:'.

CONCATENATE SY-SYSID '-' SY-MANDT INTO WS_LS_LINE-INFO

SEPARATED BY SPACE.

APPEND WS_LS_LINE TO P_T_GT_LIST_TOP_OF_PAGE.

ENDFORM. " COMMENT_BUILD

&----


*& Form DISPLAY_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_DATA .

CLEAR WS_GS_SORT.

WS_GS_SORT-FIELDNAME = 'ORDER'.

WS_GS_SORT-SPOS = 1.

WS_GS_SORT-UP = C_X.

WS_GS_SORT-SUBTOT = C_X.

APPEND WS_GS_SORT TO T_GT_SORT.

CLEAR WS_GS_SORT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID " current main program

I_CALLBACK_USER_COMMAND = C_USER_COMMAND

IS_LAYOUT = WS_S_LAYOUT

IT_FIELDCAT = T_FIELDCAT

  • IT_SORT = T_GT_SORT[]

I_DEFAULT = C_X

I_SAVE = ' '

IT_EVENTS = T_EVENT[]

TABLES

T_OUTTAB = T_VBAP

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_DATA

----


  • FORM c_USER_COMMAND *

----


  • Form to respond to the user command at ALV display screen *

----


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

IF RS_SELFIELD-SEL_TAB_FIELD = 'T_VBAP-VBELN'.

SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDIF.

ENDFORM.

----


  • FORM TOP_OF_PAGE *

----


  • Top of page heading *

----


FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = T_GT_LIST_TOP_OF_PAGE.

*I_LOGO =

*I_END_OF_LIST_GRID = .

ENDFORM.

jaideeps
Advisor
Advisor
0 Kudos

hi amardeep,

for single click use HOTSPOTS....

1)

WHEN 'TCODE'.

SET PARAMETER ID 'BES' FIELD ITAB-EBELN.

CALL TRANSACTION 'ME21N' AND SKIP FIRST SCREEN.

endcase.

2) you can also use Get Cursor Field name Value value.

for getting the value from the cursor position..

thanks

jaideep

*reward points if useful..

paruchuri_nagesh
Active Contributor
0 Kudos

hi

here is example prg

REPORT ZPRG6 .

tables: kna1, vbak, vbap.

select-options: s_kunnr for kna1-kunnr.

data: begin of itab occurs 0,

kunnr like kna1-kunnr,

name like kna1-name1,

end of itab.

data: begin of jtab occurs 0,

vbeln like vbak-vbeln,

netwr like vbak-netwr,

end of jtab.

data: begin of ktab occurs 0,

posnr like vbap-posnr,

matnr like vbap-matnr,

end of ktab.

data: v_fnam(10), v_fval(10).

start-of-selection.

select kunnr name1 from kna1 into table itab where kunnr in s_kunnr.

loop at itab.

write:/ itab-kunnr hotspot, itab-name.

hide itab-kunnr.

endloop.

at line-selection.

case sy-lsind.

when 1.

select vbeln netwr from vbak into table jtab where kunnr = itab-kunnr.

loop at jtab.

write:/ jtab-vbeln hotspot, jtab-netwr.

hide jtab-vbeln.

endloop.

when 2.

select posnr matnr from vbap into table ktab where vbeln = jtab-vbeln.

loop at ktab.

write:/ ktab-posnr, ktab-matnr hotspot.

endloop.

when 3.

get cursor field v_fnam value v_fval.

set parameter id 'MAT' field v_fval.

call transaction 'MM02'.

endcase.

top-of-page.

write:/ 'Custom Deatils Report'.

top-of-page during line-selection.

case sy-lsind.

when 1.

write:/ 'Sales Details Report'.

when 2.

write:/ 'Item Details Report'.

reward for useful points

regards

Nagesh.Paruchuri

Former Member
0 Kudos

DONE