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: 

Capture weight using clipboard

Former Member
0 Kudos

Hi all,

I am making a module pool program.

In which I have to capture the gross weight, truck weight and net weight. All these weights will come from a .net application.

What I need to do is, I have to get these values from clipboard.

Does anyone know how to do it?

1 ACCEPTED SOLUTION

former_member212002
Active Contributor
0 Kudos

You can use CL_GUI_FRONTEND_SERVICES for your purpose.

Call CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT for pasting data from clipboard

whereas CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT for copying data to clipboard.

Thanks, Abhinab

6 REPLIES 6

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

If the .net is "home made" can you make it create a file ?

Regards .

Former Member
0 Kudos

Yash,

Pl. use  "CLPB_IMPORT" function module to fetch the data from the clipboard.

I am also using same FM for fetching the data from the clipboard in our company for Weigh Bridge Application.

Regards

Vivek

0 Kudos

Thanks Vivek.

Can you please share me the code for reference.

0 Kudos

Pl. have a look at the screen:

Here Capture Load button and capture tare weight are Push buttons. When a user clicks on these push buttons, the control will go to the FM.

Code:


TYPES:BEGIN OF ty_file,
        line(100) TYPE c,
       END OF ty_file.


data: t_file   TYPE STANDARD TABLE OF ty_file,

        w_file    TYPE ty_file,

         g_empty(1).          


FORM get_file USING    value(fp_var) TYPE any
               CHANGING value(fp_weh) TYPE any .             "#EC NEEDED

*Importing Weighbridge weight from Clipboard
   CALL FUNCTION 'CLPB_IMPORT'                               "#EC *
     IMPORTING
       empty      = g_empty
     TABLES
       data_tab   = t_file
     EXCEPTIONS
       clpb_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.

   IF NOT t_file IS INITIAL.
     LOOP AT t_file INTO w_file.
       fp_weh = w_file+3(13).
       fp_weh = fp_weh / 1000.
     ENDLOOP.
   ENDIF.
   REFRESH:t_file.
   CLEAR:sy-ucomm.

ENDFORM.                    " GET_FILE



This will help you.




Vivek

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

I was not aware of the existence of CLPB_IMPORT that Vivek Goyal

mention (Thanks for the lesson),

so I thought that reading from a text file will be simpler.

But I can see that CLPB_IMPORT is "obsolete" and the documentation say to use

CL_GUI_FRONTEND_SERVICES .

Regards .


former_member212002
Active Contributor
0 Kudos

You can use CL_GUI_FRONTEND_SERVICES for your purpose.

Call CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT for pasting data from clipboard

whereas CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT for copying data to clipboard.

Thanks, Abhinab