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

Structure

Former Member
0 Likes
752

Hi,

I am creating a base structure, I am getting the error "4 is not expected".

DATA:

Begin of TAB_EMP,

EMPID (4) TYPE N,

ENAME (30) TYPE C,

SALARY TYPE I,

END OF TAB_EMP.

Also plz let me know how to create a table based on this

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
731

remove the space in empid and (4) like that

DATA:

Begin of TAB_EMP,

EMPID(4) TYPE N,

ENAME(30) TYPE C,

SALARY TYPE I,

END OF TAB_EMP.

regards

shiba dutta

null

7 REPLIES 7
Read only

Former Member
0 Likes
732

remove the space in empid and (4) like that

DATA:

Begin of TAB_EMP,

EMPID(4) TYPE N,

ENAME(30) TYPE C,

SALARY TYPE I,

END OF TAB_EMP.

regards

shiba dutta

null

Read only

Former Member
0 Likes
731

HI,

Try This,

DATA:

Begin of TAB_EMP,

EMPID TYPE N, --- >For type N no need to Give Length of the Field,

ENAME (30) TYPE C,

SALARY TYPE I,

END OF TAB_EMP.

Thanks.

Read only

0 Likes
731

Hi,

how to create a table based on this structure

Read only

0 Likes
731

Hi,

DATA:

Begin of TAB_EMP,

EMPID(4) TYPE N,

ENAME(30) TYPE C,

SALARY TYPE I,

END OF TAB_EMP.

Data : Itab like table of TAB_emp with header line.

Itab is the Internal Table.

Thanks,

Reward All helpful Answers.

Read only

Former Member
0 Likes
731

for table

data : itab like TAB_EMP occurs 0 [with header line].

the statement in [with header line] is optional.

regards

shiba dutta

Read only

Former Member
0 Likes
731

Try This

DATA:

Begin of TAB_EMP,

EMPID(4) TYPE N,

ENAME(30) TYPE C,

SALARY TYPE I,

END OF TAB_EMP.

Data : Itab like table of TAB_emp.

here Itab is an internal table.

Thanks

Read only

Former Member
0 Likes
731

Hi,

You can use Standard Table concept.

When you create a standard table, you can use the following forms of the TYPES and DATA

statements. The addition INITIAL SIZE is also possible in all of the statements. The addition

WITH HEADER LINE is possible in the DATA statement.

Standard Table Types

Generic Standard Table Type:

TYPES <itab> TYPE|LIKE [STANDARD] TABLE OF <linetype>.

The table key is not defined.

Fully-Specified Standard Table Type:

TYPES <itab> TYPE|LIKE [STANDARD] TABLE OF <linetype>

WITH [NON-UNIQUE] <key>.

The key of a fully-specified standard table is always non-unique.

Standard Table Objects

Short Forms of the DATA Statement

DATA <itab> TYPE|LIKE [STANDARD] TABLE OF <linetype>.

DATA <itab> TYPE|LIKE [STANDARD] TABLE OF <linetype>

WITH DEFAULT KEY.

Both of these DATA statements are automatically completed by the system as follows:

DATA <itab> TYPE|LIKE STANDARD TABLE OF <linetype>

WITH NON-UNIQUE DEFAULT KEY.

The purpose of the shortened forms of the DATA statement is to keep the declaration of standard

tables, which are compatible with internal tables from previous releases, as simple as possible.

When you declare a standard table with reference to the above type, the system automatically

adopts the default key as the table key.

Fully-Specified Standard Tables:

DATA <itab> TYPE|LIKE [STANDARD] TABLE OF <linetype>

WITH [NON-UNIQUE] <key>.

The key of a standard table is always non-unique.

For your question, internal table will create like this:

data itab type standard table of tab_emp with default key.

Regards,

Bhaskar