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: 

difference between funtion module and pre define function in abap

Former Member
0 Kudos

HI,

CAN ANY ONE TELL ME WHAT IS DIFFERENCT BETWEEN FUNCTION MODULE AND

PREDEFINE FUNCITON IN ABAP.

IN ORDER TO EXPLAIN U MY QUESTION I WILL GIVE U AN EXAMPLE OF COUNTING

THE NUMBER OF CHARACTERS IN A STRING

THE FUNCITON MODULE FOR THIS OPERATION IS

CALL FUNCTION 'STRING_LENGTH'

EXPORTING

STRING =

  • IMPORTING

  • LENGTH =

AND THE PREDEFINE FUNCTION FOR THIS OPERATON IS

STR_LEN = STRLEN( STRING ).

I WANT TO KNOW WHAT IS DIFFERNECE BETWEEN ABOUT TWO FUNCTIONS

note: the fm itself is using that predefine function and it is allowing us to use the predefine funtion also.

regards,

MAQSOOD

3 REPLIES 3

Former Member
0 Kudos

Function Modules mostly will have upward capability . So suppose the syntax of STRLEN changes , the function module 'STRING_LENGTH' will have the updated version .

On WAS 620 the FM STRING_LENGTH conatins code -

<b>class cl_abap_list_utilities definition load.

length = cl_abap_list_utilities=>dynamic_output_length( string ).</b>

May be you are on a lower release ( 46B / 46C ) so you still see STRLEN in the Function module .

So STRLEN is a key word of ABAP whose syntax may change with upgrade . But the FM STRING_LENGTH would keep the functionality even on upgrades . So its better to use standard FMs if available for any functinality.

Cheers.

0 Kudos

Hi,

I think different than Sanjay. I consider that it's safer to use one of ABAP standard syntax command than one of SAP function module. Syntax command can be in future marked as obsolete but should work also in future releases.

There is no such warranty for SAP FM. Unless it's BAPI.

Krzys

Former Member
0 Kudos

I suggest use ABAP command, which is a part of ABAP Language. For Function Modules, you need check if it released, In many cases, they are not leased, which means it is not available for customer use.