Вы находитесь на странице: 1из 12

1. Obsolete Function Module: WS_UPLOAD.

Replacement FM: GUI_UPLOAD.

Note:

1. If the FM ‘WS_UPLOAD' has file type as ASC, then we can use same file
type ASC for GUI_UPLOAD also.

2. 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’.

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_upload.

3. 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.

4. Always uncomment the exceptions for gui_upload.

5. 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
.

IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Else.

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 :

* 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,


L_FILETABLE TYPE FILE_TABLE,
l_RC TYPE I,
l_P_DEF_FILE TYPE STRING
l_P_FILE TYPE STRING,
l_usr_act TYPE I.

l_P_DEF_FILE = P_FILE.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG


EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
DEFAULT_FILENAME = l_P_DEF_FILE
* FILE_FILTER =
* WITH_ENCODING =
* INITIAL_DIRECTORY =
* MULTISELECTION =
CHANGING
FILE_TABLE = I_FILE_TABLE
RC = l_RC
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 = 0
AND w_usr_act <>
CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

LOOP AT I_FILE_TABLE INTO l_FILETABLE.


l_P_FILE = l_FILETABLE.
EXIT.
ENDLOOP.

CALL FUNCTION 'GUI_UPLOAD'


EXPORTING
FILENAME = l_P_FILE
FILETYPE = ‘ASC’
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = i_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 = ' '
def_path = 'C:\'
mask = ',*.*,*.*.'
mode = 'S'
title = ' '
IMPORTING
filename = p_datei
RC =
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5
Replacement method for above FM:

DATA:lt_files TYPE filetable,


l_file TYPE file_table,
l_title TYPE string,
l_subrc TYPE i,
l_def_file TYPE string.

l_def_file = ' '.

CALL METHOD cl_gui_frontend_services=>file_open_dialog


EXPORTING
window_title = l_title
default_filename = l_def_file
file_filter = ' '
initial_directory = 'C:\'
CHANGING
file_table = lt_files
rc = l_subrc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4.
CHECK sy-subrc = 0.

LOOP AT lt_files INTO l_file.


p_datei = l_file.
EXIT.
ENDLOOP.

6.
WRITE : <Itab > is an obsolete statement.

It writes all values of all the fields of the itab to the report.

So, to replace this statement we need to write all fields of the itab individually in the write
statement.

For Ex :
Write : itab-field1,
Itab-field2,
Itab-field3.

If the itab has fields upto 10 , then we can write all these in the Write statement.

But , if the itab has huge no of fields , then we need to get confirmation from the customer to
find out the fields that need to be written in the write statement.

7. Obsolete FM : POPUP_TO_CONFIRM_STEP
Replacement FM: POPUP_TO_CONFIRM

CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'


*\EXPORTING
*\defaultoption = 'N'
*\textline1 = 'Soll das Include überschrieben werden?'(034)
*\textline2 = i_inc-include
*\titel = 'Include existiert bereits!'(039)
*\* START_COLUMN = 25
*\* START_ROW = 6
*\* CANCEL_DISPLAY = 'X'
*\ IMPORTING
*\ answer = answer
*\ EXCEPTIONS
*\ OTHERS = 1.

Replacement Method :

DATA : l_question type string.

Concatenate 'Soll das Include überschrieben werden?'(034)


i_inc-include
into l_question.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Prepack deletion'(019)
* DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = l_question
TEXT_BUTTON_1 = 'Yes'(020)
*ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'No'(021)
*ICON_BUTTON_2 = ' '
*DEFAULT_BUTTON = '2'
DISPLAY_CANCEL_BUTTON = 'X'
*USERDEFINED_F1_HELP = ' '
*START_COLUMN = 25
*START_ROW = 6
*POPUP_TYPE =
*IV_QUICKINFO_BUTTON_1 = ' '
*IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = answer
* TABLES
*PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 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.

Note :

In FM POPUP_TO_CONFIRM_STEP' , the value for import parameter ANSWER is

J (YES),
N (NO).

But for POPUP_TO_CONFIRM , the value for import parameter ANSWER is

1 (YES),
2 (NO).

So, please change these values accordingly while replacing with the new FM.
8. Correcting the Character string errors by creating Text Elements:

Example:

The following is the Obsolete statement:

WRITE: / 'No existe la cuenta asociada para la sociedad: ',

Creating Text Element for above text:

WRITE: / 'No existe la cuenta asociada para la sociedad: '(T01),

We need to add a text element name as above at end of the statement,


and double click on it .

Then it will display a dialog box to confirm to create the text


Element. Select yes and activate the text elements.

9.If you get any errors related to text pools is not defined, you
can ignore.

Please ignore these errors , we no need to correct these errors.

10. OPEN DATASET P_FILE FOR INPUT.

The above statement is obsolete in ECC. So, replace it with the following statement:

OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.

11. DESCRIBE FIELD FTP_PWD LENGTH MI_PWD_LEN.

The above statement is obsolete in ECC. So, replace it with the following statement:

DESCRIBE FIELD FTP_PWD LENGTH MI_PWD_LEN IN CHARACTER MODE.

12. Obsolete FM : CONVERT_TO_LOCAL_CURRENCY_N


The replacement FM for the above FM is :
CONVERT_TO_LOCAL_CURRENCY

13. Obsolete FM : POPUP_TO_DECIDE

The replacement FM for the above FM is POPUP_TO_CONFIRN

14. *constants: gc_tab type x value ‘09’. "Tab

Replacement:

Constants: gc_tab type c value


CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

14. So_oper FOR zoperaciones-tipo_operacion MEMORY ID zoper.


Sol : This memory instruction is useless once the help has been created. So we can remove MEMORY ID.

So_oper FOR zoperaciones-tipo_operacion.

Вам также может понравиться