2007 Nov 28 9:11 AM
Hi Developers,
Is it possible to create a structure with in a structure..
Is yes, then how structures can be nested like that?
Thanks,
Kiran
2007 Nov 28 9:16 AM
Hi Kiran,
Yes it is possbile to Nest a structure.
In one structure y can nest only one structure.
Hi Developers,
Is it possible to create a structure with in a structure..
Is yes, then how structures can be nested like that?
Thanks,
Kiran
2007 Nov 28 9:14 AM
Hi!
Possible.
Like this:
TYPES: BEGIN OF t_nested.
field TYPE c,
struc TYPE struc, "struc has also a field, called field
END OF t_nested.
DATA: gs_nested TYPE t_nested.
You can access the nested fields like this:
gs_nested-struc-field = 'X'.
You can nest even tables into structures!
Regards
Tamá
2007 Nov 28 9:14 AM
yes
in the following way...
TYPES: BEGIN OF STRUCT1.
COLI TYPE I,
BEGIN OF STRUCT OF STRUCT2,
COL1 TYPE I,
COL2 TYPE I,
END OF STRUCT 2,
END OF STRUCT1.
TYPES MYTYPE TYPE STRUCT1-STRUCT2-COL2.
2007 Nov 28 9:16 AM
Hi Kiran,
Yes it is possbile to Nest a structure.
In one structure y can nest only one structure.
2007 Nov 28 9:16 AM
possiable.
type: begin of type_str.
<b>include structure type1.
include structure type1.</b> end of type_str.
data: it type standard table of type_str,
wa type type_str.
2007 Nov 28 9:19 AM
Hi
You can use the INLCUDE button to include the Structure
To include the struture in your data base table or to other structure either you can use Append structure or .INCLUDE, for append structure click on push button append structure and give the name of structure u want to add for .INCULDE, write .INCULDE in the field name and where we give data element, give the name of structure...
you can include structure in two ways ist way is first you have creat a structure then call that structure using .INCLUDE <STRUCTURE NAME> keyword.
Another way is you can also append the structure.
<b>Enhancement using Append structures</b>
Append structures allow you to attach fields to a table without actually having to modify the table itself. You can use the fields in append structures in ABAP programs just as you would any other field in the table.
Click on the append structure tab and opt to create new
structure.
Append structures allow you to enhance tables by adding fields to them that are not part of the standard. With append structures; customers can add their own fields to any table or structure they want.
Append structures are created for use with a specific table. However, a table can have multiple append structures assigned to it
Customers can add their own fields to any table or structure they want.
The customer creates append structures in the customer namespace. The append structure is thus protected against overwriting during an upgrade. The fields in the append structure should also reside in the customer namespace, that is the field names should begin with ZZ or YY. This prevents name conflicts with fields inserted in the table by SAP
<b>Enh. using Customizing includes</b>
Some of the tables and structures delivered with the R/3 standard contain special include statements. These are often inserted in those standard tables that need to have customer-specific fields added to them. Such includes are Customizing includes. (CI).
A Customizing include is a structure that satisfies a special naming convention. (name begins with CI_).
A Customizing include is a structure that satisfies a special naming convention. The name of a Customizing include begins with CI_ and the include is in the customer namespace .
If enhancements are already planned in the R/3 standard using customer-specific fields, such Customizing includes are included. in the corresponding standard table or standard structure. The Customizing include (that is the definition of the structure itself) is usually first created in the customer system and filled with fields by special Customizing transactions.
Customers can add their own fields to any table or structure they want.
The Customizing include field names must lie in the customer namespace just like field names in append structures. These names must all begin with either YY or ZZ.
<b>Append structures v/s Customizing includes</b>
In contrast to append structures, Customizing includes can be inserted into more than one table.
As an example the customizing include that we created (CI_DEMO) could be a part of multiple tables in the database whereas the append structure (ZDEMO_APPEND) can only be assigned to one table. (here MARA).
This provides for data consistency throughout the tables and structures affected whenever the include is altered.
2007 Nov 28 9:28 AM
Hi..
yes you can create a structure insidea structure...
You can include structures inside a structure as below and you can nest it.
type: begin of struct1.
include structure struct2.
include structure struct3.
end of struct1.
OR
types:begin of structure1.
abc type I,
begin of struct of structure2,
abc1 type I,
abc2 type I,
end of structure2,
end of structure1.
And also you can append structures inside a structure.
reward if helpful.