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: 

cl_gui_frontend_services

Former Member
0 Kudos

how to call method cl_gui_frontend_services in sap abap

2 REPLIES 2

Former Member
0 Kudos

Hi

It is a Global CLASS which is having different methods for different purposes

see the documentation of it and use the methods of it

see

CL CL_GUI_FRONTEND_SERVICES

____________________________________________________

Short Text

Frontend Services

Functionality

The class CL_GUI_FRONTEND_SERVICES contains static methods for the following areas:

File functions

Directory functions

Registry

Environment

Write to / read from clipboard

Upload / download files

Execute programs / open documents

Query functions, such as Windows directory, Windows version, and so on

Standard dialogs (open, save, directory selection)

Example

Determine the temp directory on your PC:

DATA: TEMP_DIR TYPE STRING.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_TEMP_DIRECTORY

CHANGING

TEMP_DIR = TEMP_DIR

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2.

IF SY-SUBRC <> 0.

  • Error handling

ENDIF.

  • flush to send previous call to frontend

CALL METHOD CL_GUI_CFW=>FLUSH

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • Error handling

ENDIF.

WRITE: / 'Temporary directory is:', TEMP_DIR.

Notes

The class CL_GUI_FRONTEND_SERVICES is based on the Control Framework. See the documentation for more information, in particular on CL_GUI_CFW=>FLUSH which must be called after many CL_GUI_FRONTEND_SERVICES methods.

Migration Information

The old file transfer model was based on function modules of the function group GRAP. The old features have been replaced by the class CL_GUI_FRONTEND_SERVICES. The following list contains the old function modules (italic) and the new methods (bold) that replace them:

CLPB_EXPORT

CLIPBOARD_EXPORT

CLPB_IMPORT

CLIPBOARD_IMPORT

DOWNLOAD

GUI_DOWNLOAD, dialog replaced by FILE_SAVE_DIALOG

PROFILE_GET

No replacement, use REGISTRY_* methods instead

PROFILE_SET

No replacement, use REGISTRY_* methods instead

REGISTRY_GET

REGISTRY_GET_VALUE, REGISTRY_GET_DWORD_VALUE

REGISTRY_SET

REGISTRY_SET_VALUE, REGISTRY_SET_DWORD_VALUE

UPLOAD

GUI_UPLOAD, dialog replaced by FILE_OPEN_DIALOG

WS_DDE

Obsolete: This function is no longer supported.

SET_DOWNLOAD_AUTHORITY

Obsolete: This function is no longer supported.

WS_DOWNLOAD

GUI_DOWNLOAD

WS_DOWNLOAD_WAN

Obsolete: This function is no longer supported.

WS_EXCEL

Obsolete: This function is no longer supported.

WS_EXECUTE

EXECUTE

WS_FILENAME_GET

FILE_SAVE_DIALOG, FILE_OPEN_DIALOG

WS_FILE_ATTRIB

FILE_SET_ATTRIBUTES, FILE_GET_ATTRIBUTES

WS_FILE_COPY

FILE_COPY

WS_FILE_DELETE

FILE_DELETE

WS_MSG

Obsolete: This function is no longer supported.

WS_QUERY

CD (current directory)

DIRECTORY_GET_CURRENT

EN (read/write environment)

ENVIRONMENT_GET_VARIABLE

ENVIRONMENT_SET_VARIABLE

FL (determine file length)

FILE_GET_SIZE

FE (check if file exists)

FILE_EXIST

DE (check if directory exists)

DIRECTORY_EXIST

WS (determine Windows system)

GET_PLATFORM

OS (operating system)

GET_PLATFORM

WS_UPLDL_PATH

Obsolete: This function is no longer supported.

WS_UPLOAD

GUI_UPLOAD

WS_VOLUME_GET

Obsolete: This function is no longer supported.

Regards

ANJI

Former Member
0 Kudos

refer thsi program

DATA:FILENAME TYPE STRING,

PATHNAME TYPE STRING,

FPATH TYPE STRING.

DATA:" SSF_NAME TYPE TDSFNAME VALUE 'ZBABU_ICICI_SPEC',

  • WA_SSFCTRLOP TYPE SSFCTRLOP,

FUN_MOD_NAME TYPE RS38L_FNAM,

V_CTRLPARAMS TYPE SSFCTRLOP,

V_JOBOUTPUT TYPE SSFCRESCL,

V_TLINES LIKE TABLE OF TLINE,

IT_FILETABLE LIKE TABLE OF FILE_TABLE WITH HEADER LINE,

V_FNAME TYPE STRING,

V_RC TYPE I,

V_BIN_SIZE TYPE I.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

EXPORTING

WINDOW_TITLE = 'SAVE AS'

DEFAULT_EXTENSION = 'PDF'

DEFAULT_FILE_NAME = 'SMARTFORMS'

INITIAL_DIRECTORY = 'C:\'

CHANGING

FILENAME = FILENAME

PATH = PATHNAME

FULLPATH = FPATH

  • USER_ACTION =

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • ERROR_NO_GUI = 2

  • NOT_SUPPORTED_BY_GUI = 3

  • others = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT IT_FILETABLE.

V_FNAME = IT_FILETABLE-FILENAME.

ENDLOOP.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FPATH

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

TABLES

DATA_TAB = IT_MAT

*****************

one more program

*- Get current windows directory of user

call method cl_gui_frontend_services=>directory_get_current

CHANGING

current_directory = lv_currdir

EXCEPTIONS

directory_get_current_failed = 1

cntl_error = 2.

*- Only for 4.7 or higher :

  • error_no_gui = 3

  • not_supported_by_gui = 4

  • OTHERS = 5.

*- Open windows popup for file selection

call method cl_gui_frontend_services=>file_open_dialog

EXPORTING

initial_directory = lv_currdir

CHANGING

file_table = lv_files

rc = lv_rc.

*- Get selected file from network or pc

read table lv_files index 1 into lv_fname.

call method cl_gui_frontend_services=>gui_upload

EXPORTING

filename = lv_fname

filetype = lc_type

CHANGING

data_tab = pt_f_cont[]

EXCEPTIONS

file_open_error = 1

file_read_error = 2

bad_data_format = 8

others = 19.

Regards

vasu