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

TYPES DECLARATION IN REPORT

Former Member
0 Likes
1,045

HI

IN CREATION OF REPORT

which is better to write nameoftable-fieldname or dataelementname

for exp :

1.

Types : begin of ty_mara,

matnr type mara-matnr,

pstat type mara-pstat ,

end of ty_mara.

2.

Types : begin of ty_mara,

matnr type matnr ,

pstat type pstat_d,

end of ty_mara.

which one is the common practice...

pls tell me this

Regards

Rajan Mehta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
855

Hi rajan,

1. I would say the first one TABLE-FIELDNAME

is always better.

2. Bcos

3. We are essentially interested in the FIELDNAMEs type.

4. In future, if SAP changes the data element of the

field, then we do not need to change the program.

The program (since it is declared using table-fieldname),

will automatically ADAPT to the new settings.

(If we had declared using data element, then

our program would not ADAPT to the field in question. It would

still point to the old data element, which is now not used in the table)

regards,

amit m.

6 REPLIES 6
Read only

Former Member
0 Likes
855

Hi,,

Types : begin of ty_mara,
matnr type mara-matnr,
pstat type mara-pstat , 
end of ty_mara.

This is the best way .

Regards,

S.Nehru

Read only

Former Member
0 Likes
855

referring to the data element .. is better ...

as the nameoftable-fieldname will also refer to the data element

Read only

Former Member
0 Likes
855

Hi,

The first one is of common practice, and widely used.

The second one is usually not preferred because it generally refers to a domain and not to a field.

<REMOVED BY MODERATOR>

Regards.

Edited by: Alvaro Tejada Galindo on Mar 18, 2008 6:15 PM

Read only

Former Member
0 Likes
855

hi,

nameoftable-fieldname this is the common practice.

Read only

Former Member
0 Likes
855

Hi,

Both are same.....

mara-matnr is reference matnr of mara but if u wrote matnr type matnr it means it refrenced directly journal matnr data element but a purpose for which u r using no issues u can use either.......

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Mar 18, 2008 6:15 PM

Read only

Former Member
0 Likes
856

Hi rajan,

1. I would say the first one TABLE-FIELDNAME

is always better.

2. Bcos

3. We are essentially interested in the FIELDNAMEs type.

4. In future, if SAP changes the data element of the

field, then we do not need to change the program.

The program (since it is declared using table-fieldname),

will automatically ADAPT to the new settings.

(If we had declared using data element, then

our program would not ADAPT to the field in question. It would

still point to the old data element, which is now not used in the table)

regards,

amit m.