‎2010 Nov 19 1:14 PM
experts
i have internal table with 10 fields itab1. now i want to add one more field in 2nd position in itab2.
aleady in the program it is decalared as
data: begin of itab occurs 0,
field1
field2
end of itab.
so how to decalre the itab2 with extra one filed at 2nd postion.
shall i need to decalre all the fileds again and insert 2nd.
data: begin of itab2 occurs 0,
field1
field2 " new filed
field3 - which is equal to field to in itab
etc
end of itab2.
or any other way to add a field with all the fields of itab in itab2.
‎2010 Nov 19 1:18 PM
Hello,
AFAIK this is not possible the way you've defined.
BR,
Suhas
‎2010 Nov 19 1:23 PM
Hi,
Please be more clear. What do you mean by fields? You mean columns? If it is so and you want to declare another internal table similar to itab1 exccept for the extra column in 2nd position, I guess you cannot refer to the itab1 and do that but declare a new structure with the required columns.
Thanks,
Sri.
‎2010 Nov 22 6:30 AM
You can use deep structures,
But if you're trying
begin of itab2,
field1 - itab1(field1),
field2 - new field,
field3 - itab1(field2)......
Then its not possible.
You can use itab1 in itab2 in following ways:
DATA:BEGIN OF ty_message, (itab1)
count TYPE sytabix,
test type c,
bdc_messages TYPE STANDARD TABLE OF VBAK,
END OF ty_message.
DATA: Begin of all_messages,(itab2)
test2 type c,
bdc_messages1 like ty_message,(itab1)
test3 type c,
END OF all_messages.
I think this might prove usefull.
-Regards,
Rahul
‎2010 Nov 22 8:08 AM
HI ,
Why dont you try splitting the internal table type into 2 parts?
Then you can add the 2nd field to the first half and then join these subsequently.
For eg:
TYPES : BEGIN OF t_itab1,
a(3) TYPE c.
TYPES: END OF t_itab1.
TYPES:BEGIN OF t_itab2,
b(3) TYPE c,
c(3) TYPE c,
END OF t_itab2.
DATA: wa_itab1 TYPE t_itab1,
wa_itab2 TYPE t_itab2.
TYPES : BEGIN OF t_itab3.
INCLUDE STRUCTURE wa_itab1 .
INCLUDE STRUCTURE wa_itab2.
TYPES : END OF t_itab3.
DATA:wa_itab3 TYPE t_itab3,
i_itab3 TYPE TABLE OF t_itab3,
‎2010 Nov 22 8:27 AM