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: 

function module.

Former Member
0 Kudos

Hi all,

while creating the FM can i use user defined types

if we can where we need to define this type.

thank u.

sai

8 REPLIES 8

Former Member
0 Kudos

if u have to define your own type then it has to be registered in Data dictionary, that means basically you will be creating a structure with all the required fields through SE11. Similarly you can create table types through Data dictionary if you want to pass tables as import/export parameters.

Former Member
0 Kudos

Hi Sai,

i guess u meant dat types as user defined types....

yes, u can use user defined types in your fm.

in import/export parameters,u have to mention like this

<field name> like <ztablename-fieldname>

now the datatype associated with <ztablename-fieldname> is assigned to your <field name>

Regard,

Sakthi.

former_member188685
Active Contributor
0 Kudos

Hi,

you can define from SE11 , using the option data type

enter your data type name and then say create then you can choose the type which you want to create .

Regards

vijay

0 Kudos

HI all,

my question is in Fm

PARAMETERS: PAR1 TYPE ZZTAB.

ZZTAB IS A TYPES DECLARED BY THE USER .

IT NOT DEFINED IN THE DICTIONARY.

IS IT POSSIBLE

THANKS.

0 Kudos

Hey Sai,

1 . You can declare a variable in this manner :

data : a like zztab.

This is done in the source code of your function module.

To do so however , zztab should be known .It means it has to be defined earlier ( that is, it should be either import / export parameter ). If it is a table, you can declare this variable in your tables tab of the function module.

2. You can not declare this way :

parameters : atab like zztab.

" zztab, a user defind data type has been declared earlier.

Reason :

2.1) You can only use parameters for programs other than type 1 between Begin/end of Screen.

2.2) Now if you try to declare this way,

selection-screen : begin of selection-screen 300.

parameters : atab like zztab.

selection-screen : end of screen 300.

This is also not possible . The reason for this is that within form routines and function modules, the <b>selection-screen</b> statement is not allowed.

Regards,

Kunal.

Message was edited by: Kunal Kumar

former_member927251
Active Contributor
0 Kudos

Hi Sai,

You can define your own types in the TOP include of the main program i.e. your function group.

TYPES : BEGIN OF TYPE,

END OF TYPE.

Data : variable type i.

Hope this helps.

Regards,

Amit Mishra

Message was edited by: Amit Mishra

Former Member
0 Kudos

HI

GOOD

I DONT THINK WE CAN ABLE TO DEFINED OUR TYPES WHILE CREATING A USER EXIT.

YOU GO THROUGH THE FOLLOWING LINKS FOR THE FUTHER CLARIFICATION

http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm

THANKS

MRUTYUN

sbhutani1
Contributor
0 Kudos

Hi Sai,

You can declare your user defined types in function pool. this is where you can define global data that will available to all the function modules under this function group.

Regards

Sumit Bhutani