‎2007 Apr 13 11:30 AM
Hi!
can I create my own function keys besides the predefined ones in the Menu Painter and use them?
will you give a little guide how to do it if it's possible?
Thanks!
‎2007 Apr 13 11:33 AM
yes u can add ur own functionality to existing functionkeys..
like sample code given below...
TABLES : MARA, MARC, MARD.
DATA : ITAB LIKE MARA OCCURS 0 WITH HEADER LINE,
JTAB LIKE MARC OCCURS 0 WITH HEADER LINE,
KTAB LIKE MARD OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS MATNR FOR MARA-MATNR.
INITIALIZATION.
MATNR-LOW = '1'.
MATNR-HIGH = '100'.
MATNR-SIGN = 'I'.
MATNR-OPTION = 'BT'.
APPEND MATNR.
START-OF-SELECTION.
WRITE:/ 'WELCOME PROCEED WITH UR FUNCTION KEYS ON UR KEYBOARD' INVERSE
COLOR 6.
AT PF04.
SELECT * FROM MARA INTO TABLE ITAB WHERE MATNR IN MATNR.
WRITE :/10 'MATERIAL NUMBER', 40 'NAME'.
LOOP AT ITAB.
WRITE : /10 ITAB-MATNR, 40 ITAB-ERNAM.
HIDE ITAB-MATNR.
ENDLOOP.
AT PF05.
SELECT * FROM MARC INTO TABLE JTAB WHERE MATNR =
ITAB-MATNR.
WRITE : /10 'MATERIAL NUMBER',30 'PLANT', 40 'MAINTENANCE STATUS'.
LOOP AT JTAB.
WRITE : /20 JTAB-MATNR, 30 JTAB-WERKS, 40 JTAB-PSTAT.
HIDE ITAB-MATNR.
*HIDE JTAB-WERKS.
ENDLOOP.
AT PF06.
SELECT * FROM MARD INTO TABLE KTAB WHERE MATNR = JTAB-MATNR AND
WERKS = JTAB-WERKS.
WRITE : /10 'STORAGE LOCATION', 30 'VALUATED STOCK'.
LOOP AT KTAB.
WRITE :/10 KTAB-LGORT, 30 KTAB-LABST.
ENDLOOP.
AT PF07.
DO 10 TIMES.
WRITE 😕 'SYMBIOSIS'.
ENDDO.
AT PF08.
WRITE 😕 'ENTERED THE SCREEN'.
AT PF09.
WRITE 😕 'U PRESSED ENTER'.
END-OF-PAGE.
WRITE : / 'SYSTEM DATE :', SY-DATUM, 35 'PAGE NUMBER : ', SY-PAGNO.
ULINE.
hope u got cleared
‎2007 Apr 13 11:33 AM
yes u can add ur own functionality to existing functionkeys..
like sample code given below...
TABLES : MARA, MARC, MARD.
DATA : ITAB LIKE MARA OCCURS 0 WITH HEADER LINE,
JTAB LIKE MARC OCCURS 0 WITH HEADER LINE,
KTAB LIKE MARD OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS MATNR FOR MARA-MATNR.
INITIALIZATION.
MATNR-LOW = '1'.
MATNR-HIGH = '100'.
MATNR-SIGN = 'I'.
MATNR-OPTION = 'BT'.
APPEND MATNR.
START-OF-SELECTION.
WRITE:/ 'WELCOME PROCEED WITH UR FUNCTION KEYS ON UR KEYBOARD' INVERSE
COLOR 6.
AT PF04.
SELECT * FROM MARA INTO TABLE ITAB WHERE MATNR IN MATNR.
WRITE :/10 'MATERIAL NUMBER', 40 'NAME'.
LOOP AT ITAB.
WRITE : /10 ITAB-MATNR, 40 ITAB-ERNAM.
HIDE ITAB-MATNR.
ENDLOOP.
AT PF05.
SELECT * FROM MARC INTO TABLE JTAB WHERE MATNR =
ITAB-MATNR.
WRITE : /10 'MATERIAL NUMBER',30 'PLANT', 40 'MAINTENANCE STATUS'.
LOOP AT JTAB.
WRITE : /20 JTAB-MATNR, 30 JTAB-WERKS, 40 JTAB-PSTAT.
HIDE ITAB-MATNR.
*HIDE JTAB-WERKS.
ENDLOOP.
AT PF06.
SELECT * FROM MARD INTO TABLE KTAB WHERE MATNR = JTAB-MATNR AND
WERKS = JTAB-WERKS.
WRITE : /10 'STORAGE LOCATION', 30 'VALUATED STOCK'.
LOOP AT KTAB.
WRITE :/10 KTAB-LGORT, 30 KTAB-LABST.
ENDLOOP.
AT PF07.
DO 10 TIMES.
WRITE 😕 'SYMBIOSIS'.
ENDDO.
AT PF08.
WRITE 😕 'ENTERED THE SCREEN'.
AT PF09.
WRITE 😕 'U PRESSED ENTER'.
END-OF-PAGE.
WRITE : / 'SYSTEM DATE :', SY-DATUM, 35 'PAGE NUMBER : ', SY-PAGNO.
ULINE.
hope u got cleared
‎2007 Apr 13 11:34 AM
Hi,
From Menu -> System -> Status take the Program and STATUS of the screen.
Go to Se41 enter the program and Status and copy them to you own program and Status.
So now the old menu is completely copied to your program,
Now you can edit the menu and add you own menu items and use.
reward if useful
regards,
ANJI
‎2007 Apr 13 11:37 AM
Hi,
Try the following code n let me know if it works fine.
"----
Tables *
"----
tables:
sflight, " Flight master
sbook. " Single flight booking
"----
Field string to hold flight master data *
"----
data:
begin of fs_sflight,
carrid type sflight-carrid, " Carrier Id
connid type sflight-connid, " Connection Id
seatsmax type sflight-seatsmax, " Maximum seats
seatsocc type sflight-seatsocc, " Occupied seats
end of fs_sflight.
"----
Internal table to hold flight schedule data *
"----
data:
t_sflight like
standard table
of fs_sflight.
"----
Field string to hold flight booking master data *
"----
data:
begin of fs_sbook,
carrid type sbook-carrid, " Carrier Id
connid type sbook-connid, " Connection Id
fldate type sbook-fldate, " Departure date
bookid type sbook-bookid, " Booking number
loccuram type sbook-loccuram, " Price of booking
order_date type sbook-order_date, " Posting date
end of fs_sbook.
"----
Internal table to hold single flight booking *
"----
data:
t_sbook like standard table
of fs_sbook.
"----
START-OF-SELECTION EVENT *
"----
start-of-selection.
perform selection.
"----
END-OF-SELECTION EVENT *
"----
end-of-selection.
loop at t_sflight into fs_sflight.
write:/ fs_sflight-carrid,
15 fs_sflight-connid,
30 fs_sflight-seatsmax,
45 fs_sflight-seatsocc.
hide: fs_sflight-carrid.
endloop. " LOOP AT T_SFLIGHT...
at pf13.
if sy-curow le 3.
message 'invalid line selection'(001) type 'I'.
else.
perform select_data.
perform display_data.
endif.
at pf14.
if sy-curow le 3.
message 'invalid line selection'(001) type 'I'.
else.
perform select_data.
sort t_sbook by bookid.
perform display_data.
endif.
at pf16.
if sy-curow le 3.
message 'invalid line selection'(001) type 'I'.
else.
perform select_data.
sort t_sbook by loccuram.
perform display_data.
endif.
----
FORM SELECTION *
----
This subroutine retrieves necessary data from flight master table *
----
There are no interface parameters to be passed to this subroutine. *
----
form selection.
select carrid " Carrier Id
connid " Connection Id
seatsmax " Maximum seats
seatsocc " Seats occupied
from sflight
into table t_sflight.
if sy-subrc ne 0.
message 'No records found'(002) type 'S'.
endif. " IF SY-SUBRC...
endform. " SELECTION
----
FORM SELECT_DATA *
----
This subroutine retrieves necessary data from flight booking table *
----
There are no interface parameters to be passed to this subroutine. *
----
form select_data.
select carrid " Carrier Id
connid " Connection Id
fldate " Flight date
bookid " Booking number
loccuram " Price of booking
order_date " Booking Date
from sbook
into table t_sbook
where carrid eq fs_sflight-carrid.
if sy-subrc ne 0.
message 'No records found'(002) type 'S'.
endif. " IF SY-SUBRC...
endform. " SELECT_DATA
----
FORM DISPLAY_DATA *
----
This subroutine displays data from flight booking table *
----
There are no interface parameters to be passed to this subroutine. *
----
form display_data.
loop at t_sbook into fs_sbook.
write: / fs_sbook-carrid,
15 fs_sbook-connid,
30 fs_sbook-fldate,
45 fs_sbook-bookid,
60 fs_sbook-loccuram currency sbook-loccurkey,
75 fs_sbook-order_date.
endloop. " LOOP AT T_SBOOK...
endform. " DISPLAY_DATA
reward if helpful.
regards,
kiran kumar k
‎2007 Apr 13 6:15 PM
Thank you guys for your answers but I meant not exactly that you wrote.
I mean: in Menu painter there is a set of function keys such as shiftF1, ctrlF1 etc. to which I can assign my functionality.
if I wish to create my own combination, for example ctrlshiftZ, but this combination is not defined among ones supplied by SAP.
can I declare it anywhere for subsequent using and if can, how?
Thanks!
‎2007 Apr 13 7:06 PM