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

Enhancement in Function module

Former Member
0 Likes
556

hi all,

i have created an enhancement in function module. i copied the original codes and placed it in the enhancement and plan to put additional codes for my requirement. But i am getting an error like this: ...Before the statement "ENDFUNCTION", the sructure introduced by "ENHANCEMENT" must be concluded with "END-ENHANCEMENT-SECTION"...

The copied codes contains enhancement also. When i tried to add end-enhancement...the FM dumps. Do you have any ideas how can i implement the enhancement correctly? Or how can i correct the error. Please help.

Thanks.

2 REPLIES 2
Read only

Former Member
0 Likes
448

Hi,

Please try with respect to below example.

PROGRAM p1.

WRITE u2018Hello Worldu2019.

ENHANCEMENT-POINT ep1 SPOTS

s1.

..

..

..

ENHANCEMENT-SECTION ep2

SPOTS s1.

WRITE u2019Originalu2019.

END-ENHANCEMENT-SECTION.

ENHANCEMENT 1.

WRITE u2019Hello

Parisu2019.

ENDENHANCEMENT.

ENHANCEMENT 2.

WRITE u2019Hello

Londonu2019.

ENDENHANCEMENT.

ENHANCEMENT 3.

WRITE u2019Enhancedu2019.

ENDENHANCEMENT.

It should be ENDENHANCEMENT instead of end-enhancement. Please check.

Rgds,

Raj.

Read only

Former Member
0 Likes
448

are you creating a enhancement in the FM or are you creating a FM. what is the need of copying the standard code?

enhancements are points provided by SAP in standard codes where you can add a piece of code to suite your requirement. do not touch SAP codes in standard program unless it is extremely necessary.

when sap gives a enhancement spot. u right click there. create enhancement. it will automatically give you a block called enhancement -- end enhancement.

And if you are creating a Z FM from the standard code then there is no need of enhancement.