Hi all,
Deep structures are those structures that contain at least one deep component.
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.
/wp-content/uploads/2013/10/capture_20131009_130413_294915.png
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
*"* 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.
To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Matthew Billingham

    You have to be a little careful with nested tables. If you remove entries from the inner table, the memory that was used is not recovered – it’s only when the outer record is removed. Also, you can find that the inner table is allocated far more memory than it needs. In one instance, that mean every outer record was occupying 8K – leading to a rapid exhaustion of memory.

    (0) 
    1. Eitan Rosenberg Post author

      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:

      • 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 we have in the forums regarding smartform debug.
      • The smartform does not have to be very smart because all he have to do is printing .

      Regards.

      (0) 

Leave a Reply