Upload
raky0369
View
21
Download
2
Embed Size (px)
DESCRIPTION
ABAP STRUCTURES
Citation preview
Getting Started Newsletters Store
Products Services & Support About SCN Downloads
Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
1 pointsHi, Vamsee Log Out Search the Community
Activity Communications Actions
Brow se Create
Your
ABAP Development
Previous
post
Next
post
0 Tweet 1
Hi all,
Deep structures are those structures that contain at least one deep component.
See here: http://help.sap.com/abapdocu_702/en/abendata_objects_structure.htm
In this blog entry and the following ones I will try to demonstrate usage scenario that will use
deep structure, class, program and smart form .
Our data will be based on tables:
SCARR Airline
SPFLI Flight
SFLIGHT Flight schedule (with flight date)
STICKET Flight Ticket
I am going to use a class to hold those structure type.
The reason behind this decision will be demonstrated.
The class: Y_R_EITAN_TEST_31_02_CL
The class is used as a types container . we will give the class more roles on in the next blog entry.
At this point I am exposing just part of the public section:
Things to note:
tp_airport_x is used twice in tp_spfli_1 (I do not know if this is posible using SE11 ) .
I always define a new type and include something the reason "is being a boy scout" be prepared for changes .
Table Type is our deep one tp_scarr_1_tab contains lower table type tp_spfli_1_tab that contains..... down to
tp_sbook_1_tab .
r_carrid r_connid and r_fldate are range type tables just like SELECT-OPTIONS: those will be used later on in
the next blog entry.
tp_flat_1 demonstrate "combining tables" note the use of "RENAMING WITH SUFFIX" addition there and in other
places.
The thing that interesting here is that we can combine different structures that contain the same field names.
And they are all living happily ....(This is not our main subject here but I thought why not....) . This is a life saver
when it comes to smart form .
And this is source:
*"* public components of class Y_R_EITAN_TEST_31_02_CL
Deeper Dive into Deep structure - part 1
Posted by Eitan Rosenberg in ABAP Development on Oct 9, 2013 5:37:30 PM
Share 0Like
*"* do not include other source files here!!!
PUBLIC SECTION.
TYPES:
BEGIN OF tp_airport_x .
TYPES: name TYPE sairport-name ,
time_zone TYPE sairport-time_zone .
TYPES: END OF tp_airport_x .
TYPES:
BEGIN OF tp_sbook_1 .
INCLUDE TYPE sbook AS sbook RENAMING WITH SUFFIX _sbook .
TYPES: END OF tp_sbook_1 .
TYPES:
tp_sbook_1_tab TYPE STANDARD TABLE OF tp_sbook_1 WITH NON-UNIQUE DEFAULT KEY .
TYPES:
BEGIN OF tp_sflight_1 .
INCLUDE TYPE sflight AS sflight RENAMING WITH SUFFIX _sflight .
TYPES: it_sbook_1 TYPE tp_sbook_1_tab .
TYPES: END OF tp_sflight_1 .
TYPES:
tp_sflight_1_tab TYPE STANDARD TABLE OF tp_sflight_1 WITH NON-UNIQUE DEFAULT KEY .
TYPES:
BEGIN OF tp_spfli_1 .
INCLUDE TYPE spfli AS spfli RENAMING WITH SUFFIX _spfli .
INCLUDE TYPE tp_airport_x AS fr_airport RENAMING WITH SUFFIX _fr .
INCLUDE TYPE tp_airport_x AS to_airport RENAMING WITH SUFFIX _to .
TYPES: it_sflight_1 TYPE tp_sflight_1_tab .
TYPES: END OF tp_spfli_1 .
TYPES:
tp_spfli_1_tab TYPE STANDARD TABLE OF tp_spfli_1 WITH NON-UNIQUE DEFAULT KEY .
TYPES:
BEGIN OF tp_scarr_x.
TYPES: carrid TYPE scarr-carrid ,
carrname TYPE scarr-carrname ,
currcode TYPE scarr-currcode .
TYPES: END OF tp_scarr_x .
TYPES:
BEGIN OF tp_scarr_1.
INCLUDE TYPE tp_scarr_x AS scarr RENAMING WITH SUFFIX _scarr .
TYPES: it_spfli_1 TYPE tp_spfli_1_tab .
TYPES: END OF tp_scarr_1 .
TYPES:
tp_scarr_1_tab TYPE STANDARD TABLE OF tp_scarr_1 WITH NON-UNIQUE DEFAULT KEY .
TYPES:
BEGIN OF tp_flat_1 .
INCLUDE TYPE tp_scarr_x AS scarr RENAMING WITH SUFFIX _scarr .
INCLUDE TYPE spfli AS spfli RENAMING WITH SUFFIX _spfli .
INCLUDE TYPE sflight AS sflight RENAMING WITH SUFFIX _sflight .
TYPES: END OF tp_flat_1 .
TYPES:
tp_flat_1_tab TYPE STANDARD TABLE OF tp_flat_1 .
TYPES:
r_carrid TYPE RANGE OF sflight-carrid .
TYPES:
r_connid TYPE RANGE OF sflight-connid .
TYPES:
r_fldate TYPE RANGE OF sflight-fldate .
This is all for now until next time .
Regards.
Continue on: http://scn.sap.com/community/abap/blog/2013/10/15/deeper-dive-into-deep-structure--part-2
877 View s Topics: abap Tags: smartforms, abap_objects, deep_structure
Average User Rating
(5 ratings)
My Rating:
0 Tweet 1Share 0Like
8 Comments
Like
(0)
SG Sg Oct 9, 2013 6:12 PM
Helpful info,waiting for next topic.
Like
(0)
Suhas Saha Oct 10, 2013 12:56 PM
Hello Eitan, The topic on Nested, Deep structures has been discussed exhaustively in the blog series by
Marcin Pciak titled Do you really know everything about typing? ?
tp_airport_x is used twice in tp_spfli_1 (I do not know if this is posible using SE11 )
When you define the "include" structure you can define the "Suffix" too which is basically the sameas RENAMING WITH SUFFIX. BR,Suhas
Like
(0)
Eitan Rosenberg Oct 13, 2013 8:44 AM (in response to Suhas Saha)
Hi, I knew that I will learn something new today. Thanks. .INCLUDE SFLIGHT 0 0 Flight _SFLIGHT
Like
(0)
Matthew Billingham Oct 13, 2013 7:54 AM
You have to be a little careful with nested tables. If you remove entries from the inner table, thememory that was used is not recovered - it's only when the outer record is removed. Also, you canfind that the inner table is allocated far more memory than it needs. In one instance, that mean everyouter record was occupying 8K - leading to a rapid exhaustion of memory.
Like
(2)
Eitan Rosenberg Oct 13, 2013 9:03 AM (in response to Matthew Billingham)
Hi,Thanks for the warning. I personaly use it for smart forms (Moderate amount of data). I build the full data model in the calling program and then pass it to the smart form.I intend to demonstrate it soon. The gain is:
Regards.
"Separation of concerns" - http://en.wikipedia.org/wiki/Separation_of_concerns
Debugging is much easier in a program or class . Just look how many questions wehave in the forums regarding smartform debug.
The smartform does not have to be very smart because all he have to do is printing .
Matthew Billingham Oct 13, 2013 9:09 AM (in response to Eitan Rosenberg)
Follow SCNSite Index Contact Us SAP Help Portal
Privacy Terms of Use Legal Disclosure Copyright
Like
(1)
Absolutely. Though my smartforms generally consist of instantiation of a class,followed by lots of calls to getter methods.
Like
(0)
Eitan Rosenberg Oct 16, 2013 7:24 AM (in response to Matthew Billingham)
Hi ,This is a nice idea .So you can develop and test the class as a stand alone unit .Also the regular benefits of using a class.Regards.
Like
(0)
Modadugu Hemanth Kumar Oct 15, 2013 2:04 PM
Helpful Document Eitan Rosenberg