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

how to enhance a function module?

Former Member
0 Likes
7,881

Hi,

I need to enhance standard the function module,i.e. i want to add a field to the parameter interface and also i need to add this field in the internal table already declared.?i tried but it's not allowing me to add that field in the internal table.

and when you add any field in parameter interface ,its available for the source code right?do we get that field in declaration part of source code i.e. commented block?if so how to get that one?

types: begin of employee_tab,

ename type emnam,

perner type perner_d,

(at this spot an implicit enhancement is there)

end of employee_tab.

to this internal table in the source code i need to add the "plans type plans field."how to add this field to the internal table..

enhancement 1

plans type plans,

endenhancement .i added like this but its throwing an error.

how to rectify this? please tell me ...its urgent.

Regards,

Lakshmi,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,889

Hi Lakshmi,

You can't add the field in the middle of the type declaration. so that implement the structure and add the fields which you want.

Example

enhancement1.

types: begin of emp1.

include structure emp.

Plane type plane.

end of emp1.

endenhancement1.

if you want to use the added fields in out side of the FM, you should enhance the exporting parameter of the FM using the following Steps.

1. click 'Enhancement Source code' button in the App.toolbar.

2. in Edit menu->enhnacement operation->show implicit enhancement.

3. Go to Import, export, Changing or table tab where you want to enhance the parameter.(Export).

4. it will ask to create the enhancement option.

5. Give the parameter name and type, it should be optional parameter only.

6. save and activate.

7. in the source code tab, create the enhancement option before the 'Endfunction' statement.

8. write your logic and export the value to your option parameter which you created in this FM's exporting parameter.

if you don't want to use the fields from out side of FM, the above steps are not requried.

Regards,

SB

3 REPLIES 3
Read only

Former Member
0 Likes
2,889

I'm assuming that you are using this Function Module in a bespoke program. The easiest thing to do is to copy the function group that the finction module belongs to to a 'Z' Function group and the function Modules to a start with Z. Once you have done this them you will be able to amend the function module to do what you want it to do. The other option which I wouldn't do is to register the Function group so that you can make your own changes - the downside is that SAP will not support it.

Regards

J

Read only

Former Member
0 Likes
2,889

Hi Lakshmi,

If ur using ECC 6.0 u have the option of enhancing the function module using the Enhancement framework technology Function Group enhancement.

For information about this technology and to implement refer the link below

[https://www.sdn.sap.com/irj/sdn/nw-development?rid=/webcontent/uuid/2342e1f3-0b01-0010-a186-fdd404884050] [original link is broken];

Refer the following pdf in the link above.

Enhancement Framework - The New Way to Enhance Your ABAP Systems

Thanks,

Surya

Read only

Former Member
0 Likes
2,890

Hi Lakshmi,

You can't add the field in the middle of the type declaration. so that implement the structure and add the fields which you want.

Example

enhancement1.

types: begin of emp1.

include structure emp.

Plane type plane.

end of emp1.

endenhancement1.

if you want to use the added fields in out side of the FM, you should enhance the exporting parameter of the FM using the following Steps.

1. click 'Enhancement Source code' button in the App.toolbar.

2. in Edit menu->enhnacement operation->show implicit enhancement.

3. Go to Import, export, Changing or table tab where you want to enhance the parameter.(Export).

4. it will ask to create the enhancement option.

5. Give the parameter name and type, it should be optional parameter only.

6. save and activate.

7. in the source code tab, create the enhancement option before the 'Endfunction' statement.

8. write your logic and export the value to your option parameter which you created in this FM's exporting parameter.

if you don't want to use the fields from out side of FM, the above steps are not requried.

Regards,

SB