Application Development and Automation 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: 
Read only

difference between normal FM AND A CLASS FM

Former Member
0 Likes
461

Hi all,

what is the difference if i call a FM gui_upload directly from pattern using CALL FUNCTION

or if i call it USING CLASS

I MEAN TO SAY WHAT IS THE DIFFERENCE BETWEEN BELOW TWO CODES.

1)

CALL METHOD cl_gui_frontend_services=>gui_upload

EXPORTING

filename =

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = SPACE

  • HEADER_LENGTH = 0

  • IMPORTING

  • FILELENGTH =

  • HEADER =

changing

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

2)CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename =

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

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

CAN ANYONE TELL WHAT 'S THE DIFFERENCE BETWEEN THE ABOVE TWO METHODS OF CALLING

Thanks

kajol

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
437

Hi,

I believe both are same..

If you check the class method code..The FM GUI_UPLOAD FM will be called..

Thanks,

Naren

3 REPLIES 3
Read only

Former Member
0 Likes
438

Hi,

I believe both are same..

If you check the class method code..The FM GUI_UPLOAD FM will be called..

Thanks,

Naren

Read only

Former Member
0 Likes
437

I think theres no difference as the class itself uses FM 'GUI_UPLOAD'.

It is suggested to use CLASS method however.

Thanks,

Santosh

Read only

Former Member
0 Likes
437

Hi Kajol,

The cl_gui_frontend_services is developed for envelop the exists functions, to meet the OO develop requirement.

Both does the same job. If you look at the code inside the method cl_gui_frontend_services=>gui_upload, it would be calling GUI_UPLOAD function.

In terms of performance efficiency, there will be a very negligible difference and call function will be slightly better in my opinion.

Regards,

Ferry Lianto