Skip to Content
avatar image
Former Member

caputring keystrokes

Hello all,

is it possible to capture key strokes in WDA or WDJ...say user presses ctrlp...the reason is...I want to design a button which mimic the user when the user click on this will trigger the ctrlp command for my WDA application....and opens up the print window...



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Feb 24, 2009 at 01:53 AM

    Thanks guys,

    I found a way around for my issue....since my application only consists of one view...which is displaying some employee info....I was able to use the exit plug and some java script to obtain my print btn whenever I am clicking on this print button it is triggering the print funcationality of the browser....and i am able to print the whatever is showing on the window...this solution i implemented only works if the application consists of only one view and data is getting populated before the view gets displayed to the user....and my case is a perfect scenario for that.... 😊 and here is what I did:

    1) created an outbound plug for my view...say, to_window

    2) than in the window...created an inbound plug, say, from_view

    3) than created an outbound plug in the window, say, exit_app....this is type exit and interface box is checked

    4)did the navigation connection...and in the window...under method tab....inside my handlefrom_view method, i fire the exit plug...created a btn on the view which is linked to firing the outbound plug...

    5) save, activated the component and created an application for it...and ran the application....copy the url of it...

    6) now i went to transaction SICF...and under sap/bc/webdynpro...found my service(the component i created)....double clicked on it...

    7) after double clicking i went for the tab called "error pages"....than i went for tab "logoff page"

    8) than selected the first radio btn option -"explicit response time" -than under the area which says "explicit response page body" i click on the create icon---

    9) this opens up the whole new page for me....gave an alias name....than i typed in my javascript for

    w i n d o w . p r i n t and w i n d o w . l o c a t i o n (type in your application url here)

    since exit plug kills our application and trigers the logoff page the print window comes up but we do not have our application open i used the w i n d o w . l o c a t i o n metho to open up my application again....this way i have now my application open and print window open at the same time....a little trick...but it works perfectly for me...

    hope this will help other people who want to print with click of a button...and have ONLY ONE VIEW...

    also we are using not know if it will work for any other browsers...

    Thanks again....

    the full code i used to print: might help someone.... 😊

    < h t m l >

    < h e a d >

    s c r i p t l a n g a u a g e = " j a v a s c r i p t " "here you put the brackets on both sides just like for the head tag----

    f u n c t i o n m y p r i n t ()

    { w i n d o w . p r i n t () ; }

    f u n c t i o n l o a d ()

    {v a r l o a d = w i n d o w . l o c a t i o n (' h t t p : / / ************************/sap/bc/webdynpro/sap/ztest_print_option?sap-language=EN ' ) ; }

    < / s c r i p t >

    < / h e a d >

    b o d y o n l o a d = "j a v a s c r i p t : m y p r i n t () , l o a d () " --here needs brackets again...i canont put the brackets, if i do whole line disappear from here...i guess because of forum....

    < / b o d y >

    < / h t m l >

    Edited by: J Are on Feb 24, 2009 1:42 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 23, 2009 at 02:46 PM

    Hi J Are,

    To Activate Function keys like CTRL+ P in webdynpro ABAP check the below link




    Add comment
    10|10000 characters needed characters exceeded

  • Feb 23, 2009 at 02:56 PM

    You can map keys to buttons as of NetWeaver 7.0 Enhancement Package 1, but that doesn't sound exactly like what you want. You want to trigger a keyboard like sequence when they press a standard button? Is it really that you want to activate the browser print function? I'm afriad that you can't do that from Web Dynpro directly.

    Add comment
    10|10000 characters needed characters exceeded