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

Any thumb rule for function module interface parameters?

Former Member
0 Likes
675

Hi ,

Is there any standard thumb rule for FM interface parameters i.e. TYPE or LIKE for structure, table type , data element, database table in import, export, tables tab. Which will create internal table with header line?

Even I am comfortably working with the function modules now as of now.  But things are going by trail and error method if TYPE is not worked LIKE keyword using etc.

Regards,

Praveen Chitturi.

6 REPLIES 6
Read only

mtremblay-savard
Participant
0 Likes
641

Hi Chitturi,

If i understood well your question, all you're asking is when to use TYPE or LIKE right?

here's the answer :

Use the LIKE addition whenever your declaration is directly linked to a data object. Examples of this include auxiliary variable in procedures that must have the same type as interface parameters or their components. This keeps your program valid even if the data object changes.

In all other case, use TYPE

Best Regards,
Maxime

Read only

0 Likes
641

Hi Max,

1. Thank you for reply and you are correct, My doubt is about like or type in Interface parameters .

As you said LIKE is for only dobj's like auxilary variables -----> what this means whether structure type or table type or database structure or type group data type.

2. Also for creating internal table referring to structure will it create  internal table with header line or with out header?

3. For declaring internal table which data type should I use i.e. Can I refer structure/database table/table type?

Regards,

Praveen Chitturi.

Read only

0 Likes
641

Hi Praveen,

1. LIKE can be used to refer to something you have already declared using DATA statement or it exists in SE11. LIKE addition describes the line type of a table object that is visible at that point in the program

2. It will create an internal table without header line(unless specified explicitly)

3. You can use any of the types you have listed. There is no such restriction.

Read only

0 Likes
641

Hi chitturi,

The TYPE addition is used to refer to an independent data type and the LIKE addition to refer to a data object of the corresponding type. So according to these facts, i'd say (i have not tried so i might be wrong) :

1. Structure, table, database structure or type group data type should use TYPE except if they directly depends or needs to be the exact same as an other Structure, table ... etc. In these cases, you use LIKE.

2. I unfortunately have no idea if it is going to create an internal table with or without an header line, just give it a try and give me some feedback

3. I guess you should use TYPE except (as i said just before) if you want your internal table to have the same data type as a database table or table type. I am not sure if you can refer an internal table to a structure. Just give it a try too

Sorry for being kind of vague but i hope this might help you!

Best Regards,
Maxime

Read only

0 Likes
641

Hi max,

I will note down one by one by going in trail and error method.

Thank you,

Praveen Chitturi

Read only

FredericGirod
Active Contributor
0 Likes
641

Hi,

I'm not sure to understand.

  • You want to work with table & header line for calling function module :

CALL FUNCTION 'toto'

CHANGING toto = it_toto[].

  • You want to work inside the function with a table & header line

it_toto_bis type table of .. .with header line ...

it_toto_bis[] = toto

and you could play with header line

But don't forget, header line is bad, it's the dark force

Fred