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

internal table

Former Member
0 Likes
676

Hi all,

This could be a silly question!! i have a z table with about 70 fields . I have a lot of criteria to check if a record canbe inserted into the ztable.

My questions is i have an internal table with include structure of the ztable. Is it possible to add a field to the internal table - tab- status and then the structure of the table. or do i need to write the internal table with 70 fields + the status. The status is for error check or success check.

data: begin of data occurs 0.

include structure ztable.

data: end of data.

this is what i am presently using how do i add the extra field to this internal table.

this field will not be inserted into the z table but just to check if the record can be inserted or no.

thanks in advance.

1 ACCEPTED SOLUTION
Read only

govind_seenivasan
Participant
0 Likes
591

Hi,

You don't have to type all 70 fields.

You can do like this.

data: begin of data occurs 0.

include structure ztable

data : status(1),

end of data.

Thanks

Message was edited by: Govindarajan Seenivasan

Message was edited by: Govindarajan Seenivasan

5 REPLIES 5
Read only

govind_seenivasan
Participant
0 Likes
592

Hi,

You don't have to type all 70 fields.

You can do like this.

data: begin of data occurs 0.

include structure ztable

data : status(1),

end of data.

Thanks

Message was edited by: Govindarajan Seenivasan

Message was edited by: Govindarajan Seenivasan

Read only

Former Member
0 Likes
591

Hi,

You can always include structure & add fields to the internal table definition.

So you can define your Internal table as.

data: begin of data occurs 0.

include structure ztable.

data:new_field(10),

.....

.....

data: end of data.

Message was edited by: Phani Kiran Nudurupati

Read only

Former Member
0 Likes
591

yes its possible.

types: begin of tp_data.

types:include structure ztable.

types: status type c.

tyeps: end of tp_data.

data : itab type standard table of tp_data with header l ine.

Read only

Former Member
0 Likes
591

you can add the fields along with include structure in the following way....

data: begin of data occurs 0. 
include structure ztest.
data : status(1), 
end of data.

try this..

Read only

Former Member
0 Likes
591

you USE

data: begin of data occurs 0.

include structure ztable.

<b>data : v_tab(1) type c.</b>

data: end of data.

so now you will have DATA internal table with some records.but you cant use directly insert command with DATA internal table (if you add field V_TAB).

create a structure of same type ZTABLE.

so in loop at DATA.

move-corresponding DATA TO ZTABLE.

INSERT ZTABLE FROM ZTABLE.

*--check subrc/dbcnt & proceed further.

endloop.