Skip to Content
author's profile photo Former Member
Former Member

Field that dosen't permit Copy&paste.

Hi everybody,

I need to create an input field in a screen that doesn’t and won’t permit coping from it. In other words an input field that is visible but not selectable. Another way to solve my need would be to restrict the paste of this field.

I’ve thought of creating an image from it and posting it but it’s too complicated and would consume a lot of resources. If anybody has a better idea or knows how to do this please answer.

Thanks a lot.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 20, 2005 at 07:54 PM

    Hi Jorge,

    Could you please elaborate on your requirement?

    You have an input field on the screen(by 'input', you are implying that users can enter values in it, true?). Users can easily copy the value, if not by any means and 'Print Screen' on your keyboard will do that.

    So what exactly you want to prevent? Say you are showing the passport number or some important piece of data and you want that to be display only, it is possible. But if you want that to be entered, but not copied, I don't think that is possible.

    Please add more details so that the forum can help.


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 21, 2005 at 09:27 AM

    Hi Jorge,

    To have a field that does not allow copying from it is difficult to handle. In fact almost impossible, if there is NO other activity on the screen.

    You would have to write your own event handler in ABAP objects and build a trigger mechanism that listens to the activation or déactivation of a field.

    However, in order to give you some help, there is a way to cleanup the CLIPBOARD (so any entries in it are removed, thus preventing a CTRL+V (paste) operation.

    Simply place this in the first PAI module of your screen:

    DATA: myrc TYPE i.

    CALL METHOD cl_gui_frontend_services=>clipboard_export


    rc = myrc


    CNTL_ERROR = 1

    ERROR_NO_GUI = 2

    others = 3.


    Of course you need to handle possible errors (clean up SY-SUBRC). Also keep in mind, that this does NOT prevent COPY & PASTE operation, as long as the screen has NOT passed the PAI event in your program.

    Hope this gives you a clue,



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.