step by step guide to creating structures in abap

12
STRUCTURES It is a DATA BASE object, which is a group of fields which can be used in multiple tables. The advantage of structure is REUSABILITY of same structure in multiple tables. The difference between the table and structure is , structure can hold single record only where as a table can hold multiple record. Structure can implemented in two ways. 1) Include structure. 2) Append structure. Include Structure This option is used only for Custom Tables (i. e. the name starting with Z or Y). These include structure can be reusable. Steps to create Include Structure: - Go to SE11 select Data type give a name as zinclude_str .click on create.

Upload: cherukur-sathya

Post on 28-Oct-2014

52 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Step by Step Guide to Creating Structures in Abap

STRUCTURES

It is a DATA BASE object, which is a group of fields which can be used in multiple tables.

The advantage of structure is REUSABILITY of same structure in multiple tables.

The difference between the table and structure is , structure can hold single record only where as a table can hold multiple record.

Structure can implemented in two ways.1) Include structure.2) Append structure.

Include Structure This option is used only for Custom Tables (i. e. the name starting with Z or Y). These include structure can be reusable.

Steps to create Include Structure: -

Go to SE11 select Data type give a name as zinclude_str .click on create.

Page 2: Step by Step Guide to Creating Structures in Abap

Select Structure press enter .

Page 3: Step by Step Guide to Creating Structures in Abap

Give short description as include structure.

Define the fields as below.

Page 4: Step by Step Guide to Creating Structures in Abap

save and activate.

By the above steps a structure is created and can be reusable.

Page 5: Step by Step Guide to Creating Structures in Abap

Icluding structure in a table: -

Go to SE11 give the table name ‘zstru’ click on change.

Page 6: Step by Step Guide to Creating Structures in Abap

Give the field name as .include.

Give the data element name as structure name. (ZINCLUDE_STR)

Press enter. All the fields can be automatically copied.

To display the fields click on the symbol or Icon shown below.

Page 7: Step by Step Guide to Creating Structures in Abap

To hide the fields click on the icon shown below.

Page 8: Step by Step Guide to Creating Structures in Abap

APPEND STRUCTURE: -

This option used only with STANDARD SAP TABLES.

The Append Structures are not reusable.

Steps to create Append Structures: -

BUSINESS REQUIREMENT

Add an extra field by the name ‘MANME’ (middle name) to the table LFA1.

Go to SE11 give the table name as LFA1. Click on Append Structure button.

Page 9: Step by Step Guide to Creating Structures in Abap

A pop up is raised click on create icon as shown below.

Give the append name as ZAPP_STR_MNAME. Press enter.

Page 10: Step by Step Guide to Creating Structures in Abap

Give the short description as Append structure. Give the field name as ‘MANME’. Give the Data element name a NAME3_GP. Press enter. Save and activate it.

Inter view Question is:1) What is the difference between Include structure and Append structure.2) How many fields you have added using append structure (only 1 or 2)