Skip to end of metadata
Go to start of metadata

Replacement of Obsolete Function Modules for ECC 6.0

Below are some of the frequently used Function Modules-

These function modules have become obsolete now as per ECC 6.0. So this WIKI helps you with the replacement FM's and their specific cases.

RODIR (Released Objects Directory): Table, to see the function modules which are obsolete(X means obsolete).

1.  Obsolete Function Module: WS_UPLOAD       Replacement FM: GUI_UPLOAD. 

 Note:

  •  If the FM 'WS_UPLOAD' has file type as ASC, then we can use same file type ASC for GUI_UPLOAD also.
  • But if the FM 'WS_UPLOAD' has file type as DAT, we can not use DAT for 'GUI_UPLOAD' as it will give short dump.
  • In this case we need use file type as ASC and HAS_FIELD_SEPARATOR = 'X'.
  • If the file name or file type of ws_upload have variables or constants
  • Instead of hard coding, then don't use hard code values for gui_upload.
  • The data type of file name always should be of character type for gui_upload.The file type should be of Type Character and length 10.
  • Always uncomment the exceptions for gui_upload.
  •  And also uncomment the code inside IF SY-SUBRC <> 0. and ENDIF after gui_upload if the customer has not handled any exception in 46c version.

If there is any code inside IF SY-SUBRC <> 0 and ENDIF for ws_upload in 46c version, Please use the same code in ECC also after gui_upload.

Example:

Example for File type ASC:* CALL FUNCTION 'WS_UPLOAD'

* EXPORTING

* FILENAME = P_FILE

* FILETYPE = 'ASC'

** IMPORTING

** FILELENGTH =

* TABLES

* DATA_TAB = P_I_DATA

* EXCEPTIONS

* CONVERSION_ERROR = 1

* FILE_OPEN_ERROR = 2

* FILE_READ_ERROR = 3

* INVALID_TABLE_WIDTH = 4

* INVALID_TYPE = 5

* NO_BATCH = 6

* UNKNOWN_ERROR = 7

* GUI_REFUSE_FILETRANSFER = 8

* CUSTOMER_ERROR = 9

* OTHERS = 10.

Replacement FM:

DATA L_P_FILE TYPE STRING.

L_P_FILE = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = L_P_FILE

FILETYPE = 'ASC'

TABLES

DATA_TAB = P_I_DATA

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.
IF SY-SUBRC NE 0.
MESSAGE E033 WITH P_FILE ' could not be opened'(E03).

ENDIF.Example for file type DAT: * CALL FUNCTION 'WS_UPLOAD'
* EXPORTING

* FILENAME = P_FILE

* FILETYPE = 'DAT'

** IMPORTING

** FILELENGTH =

* TABLES

* DATA_TAB = P_I_DATA

* EXCEPTIONS

* CONVERSION_ERROR = 1

* FILE_OPEN_ERROR = 2

* FILE_READ_ERROR = 3

* INVALID_TABLE_WIDTH = 4

* INVALID_TYPE = 5

* NO_BATCH = 6

* UNKNOWN_ERROR = 7

* GUI_REFUSE_FILETRANSFER = 8

* CUSTOMER_ERROR = 9

* OTHERS = 10.

Replacement FM:

DATA L_P_FILE TYPE STRING.

L_P_FILE = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = L_P_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = P_I_DATA

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

2) Obsolete FM : WS_DOWNLOAD    Replacement FM: GUI_DOWNLOAD.

Note:

1. If the FM 'WS_DOWNLOAD' has file type as ASC, then we can use same file Type ASC for GUI_DOWNLOAD also.

2. If the FM 'WS_DOWNLOAD' has file type as DAT, we can use DAT for

'GUI_DOWNLOAD'

3. If the file name or file type of ws_upload have variables or constants

Instead of hard coding,then don't use hard code values for gui_download.

Declare variables and assign the ws_download variables to new variables

and use These in the new FM.4. The data type of file name always should be of character type for gui_upload

The file type should be of Type Character and length 10.

5. The data type of file name always should be of character type for gui_ download.

6. Always uncomment the exceptions for gui_download.

7. And also uncomment the code inside IF SY-SUBRC <> 0. and ENDIF after

Gui_upload if the customer has not handled any exception in 46c version.

If there is any code inside IF SY-SUBRC <> 0 and ENDIF for ws_ download in

46c version, Please use the same code in ECC also after gui_download.

Example:* CALL FUNCTION 'WS_DOWNLOAD'

* EXPORTING

* FILENAME = P_FILENM

* FILETYPE = 'DAT' " split into records

* TABLES

* DATA_TAB = L_ITAB

* FIELDNAMES = T_HEAD

* EXCEPTIONS

* FILE_OPEN_ERROR = 01

* FILE_WRITE_ERROR = 02

* INVALID_FILESIZE = 03

* INVALID_TABLE_WIDTH = 04

* INVALID_TYPE = 05

* NO_BATCH = 06

* UNKNOWN_ERROR = 07.

Replacement FM for above FM:

DATA L_P_FILE TYPE STRING.

L_P_FILE = P_FILENM.CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING

FILENAME = L_P_FILE

FILETYPE = 'DAT'

TABLES

DATA_TAB = L_ITAB

FIELDNAMES = T_HEAD

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22. 

3. Obsolete FM:  DOWNLOAD

Replacement Method and FM*:* CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG and GUI_DOWNLOAD.

Example:*CALL FUNCTION 'DOWNLOAD'

* EXPORTING

* FILENAME = SPACE

* FILETYPE = 'DAT'

* TABLES

* DATA_TAB = T_DOWNL

* EXCEPTIONS

* INVALID_FILESIZE = 1

* INVALID_TABLE_WIDTH = 2

* INVALID_TYPE = 3

* NO_BATCH = 4

* UNKNOWN_ERROR = 5

* OTHERS = 6.

*End of deletion CH01-

Replacement Method for above code: DATA: l_filename TYPE string,

l_filen TYPE string,

l_path TYPE string,

l_fullpath TYPE string,

l_usr_act TYPE I.

l_filename = SPACE.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

EXPORTING

DEFAULT_FILE_NAME = l_filename

CHANGING

FILENAME = l_filen

PATH = l_path

FULLPATH = l_fullpath

USER_ACTION = l_usr_act

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

NOT_SUPPORTED_BY_GUI = 3

others = 4.

IF sy-subrc = 0

AND l_usr_act <>

CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = l_fullpath

FILETYPE = 'DAT'

TABLES

DATA_TAB = T_DOWNL

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22. 

4. Obsolete FM: UPLOAD    Replacement Method and FM : GUI_UPLOAD

* CALL FUNCTION 'UPLOAD'

* EXPORTING

* FILENAME = P_FILE

* FILETYPE = 'DAT'

* TABLES

* DATA_TAB = W_TAB

* EXCEPTIONS

* CONVERSION_ERROR = 1

* INVALID_TABLE_WIDTH = 2

* INVALID_TYPE = 3

* NO_BATCH = 4

* UNKNOWN_ERROR = 5

* OTHERS = 6.

Replacement method for the above FM:

DATA : I_FILE_TABLE TYPE TABLE OF FILE_TABLE,

W_FILETABLE TYPE FILE_TABLE,

W_RC TYPE I,

W_P_DEF_FILE TYPE STRING

W_P_FILE TYPE STRING,

w_usr_act TYPE I. W_P_DEF_FILE = P_FILE.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

* WINDOW_TITLE =

* DEFAULT_EXTENSION =

DEFAULT_FILENAME = W_P_DEF_FILE

* FILE_FILTER =

* WITH_ENCODING =

* INITIAL_DIRECTORY =

* MULTISELECTION =

CHANGING

FILE_TABLE = I_FILE_TABLE

RC = W_RC

USER_ACTION = w_usr_act

* FILE_ENCODING =

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5 .

IF sy-subrc = 0

AND w_usr_act <>

CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

LOOP AT I_FILE_TABLE INTO W_FILETABLE.

W_P_FILE = W_FILETABLE.

EXIT.

ENDLOOP.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = W_P_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = W_TAB

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

IF SY-SUBRC <> 0.

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

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

ENDIF.ENDIF. 

5. Obsolete FM:  WS_FILENAME_GET

Replacement Method*:* cl_gui_frontend_services=>file_open_dialog

Example: 
CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = lf_dsnam

* def_path = zifbod-pc_path

mask = ',Month end,Monthend*.xls,All files,..'

mode = 'S'

title = ' '

IMPORTING

filename = lf_dsnam

* RC =

EXCEPTIONS

inv_winsys = 0

no_batch = 0

selection_cancel = 0

selection_error = 0

OTHERS = 0.

NOTE: We need to use '|' symbol instead of ',' in the FILE_FILTER parameter which is equivalent to MASK.

*Replacement method for above FM:*DATA:lt_files TYPE filetable,

l_file TYPE file_table,

l_title TYPE string,

l_subrc TYPE i,

l_usr_act TYPE i,

l_def_file TYPE string.

l_def_file = lf_dsnam.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = ' '* DEFAULT_EXTENSION =DEFAULT_FILENAME = l_def_file

FILE_FILTER = 'Month end|Monthend*.xls|All files|.'* WITH_ENCODING =

* INITIAL_DIRECTORY =

* MULTISELECTION =CHANGING

FILE_TABLE = lt_files

RC = l_subrc

USER_ACTION = l_usr_act* FILE_ENCODING =EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5

.

IF sy-subrc eq 0 AND

l_usr_act <> CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

LOOP AT lt_files INTO l_file.

MOVE l_file-filename to l_def_file.

MOVE l_def_file to lf_dsnam.

EXIT.

ENDLOOP.

ENDIF. 

6. Obsolete Function module : FI_DOCUMENT_READ_SINGLE .    Replacement FM : FAGL_GET_ARCH_FI_DOCUMENT.

Please look at note 928034

Example :

*>>>> START OF INSERTION <<<<

* call function 'FI_DOCUMENT_READ_SINGLE' "637338

* exporting "637338

* i_bukrs = FI_BUKRS "637338

* i_belnr = FI_BELNR "637338

* i_gjahr = FI_GJAHR "637338

* i_group_xread = l_group_xreadall "637338

* i_xuse_database = space "637338

* i_xsuppressdialog = ON "637338
* tables "637338

* c_abkpf = l_archbkpf "637338
* c_bseg = T_BSEG "637338

* exceptions "637338

* others = 99. "637338

* call commented with Note# 928034CALL FUNCTION 'FI_DOCUMENT_READ1'
EXPORTING

i_docno = it_bsik-belnr

i_byear = it_bsik-gjahr

i_compy = it_bsik-bukrs

IMPORTINGe_bkpf = wa_bkpf
TABLES

t_bseg = it_bsegt_bsec = it_bsec
t_bset = it_bset

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

call function 'FAGL_GET_ARCH_FI_DOCUMENT' "928034

Page 3

exporting "928034

i_bukrs = fi_bukrs "928034

i_belnr = fi_belnr "928034i_gjahr = fi_gjahr "928034
tables "928034

t_bseg = t_bseg "928034exceptions "928034
others = 99. "928034

*>>>> END OF INSERTION <<<<<<

Example 2 :* call commented with Note# 928034

* call function 'FI_DOCUMENT_READ_SINGLE' "637338

* exporting "637338

* i_bukrs = FI_BUKRS "637338

* i_belnr = FI_BELNR "637338

* i_gjahr = FI_GJAHR "637338

* i_group_xread = l_group_xreadall "637338

* i_xuse_database = space "637338

* i_xsuppressdialog = ON "637338
* tables "637338

* c_abkpf = l_archbkpf "637338
* c_bseg = T_BSEG "637338

* exceptions "637338

* others = 99. "637338

* call commented with Note# 928034

call function 'FAGL_GET_ARCH_FI_DOCUMENT' "928034

exporting "928034

i_bukrs = fi_bukrs "928034
i_belnr = fi_belnr "928034

i_gjahr = fi_gjahr "928034

tables "928034

t_bseg = t_bseg "928034exceptions "928034
others = 99. "928034

*>>>> END OF INSERTION <<<<<<

Related WIKI Pages

Related Blogs