Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Logical databases

Former Member
0 Kudos

hi friends,

can u please explain me the usage of GET_NODE & GET_NODE_LATE.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

try to debug these standarad demo programs and see if u can get answers for ur questions

demo_program_get_late

demo_program_get

Also check this link

http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9b8535c111d1829f0000e829fbfe/content.htm

FORM PUT_<node>

Called in the sequence defined in the structure. Reads the data from the node <node> and uses the

PUT <node>.

statement to trigger a corresponding GET event in the ABAP runtime environment. The PUT statement is the central statement in this subroutine: It can only be used within a subroutine of a logical database. The logical database must contain the node <node>, and the subroutine name must begin with PUT_<node>. The PUT statement directs the program flow according to the structure of the logical database. The depth to which the logical database is read is determined by the GET statements in the application program or the interface parameter CALLBACK of the function module LDB_PROCESS.

First, the subroutine PUT_<root> is executed for the root node. The PUT statement then directs the program flow as follows:

i) If the database program contains the subroutine AUTHORITY_CHECK_<table>, the first thing the PUT_<node> statement does is to call it.

ii) Next, the PUT statement triggers a GET event in the runtime environment. If there is a corresponding GET <node> statement in the executable program to which the logical database is linked, the associated event block is processed. If the CALLBACK parameter of the function module LDB_PROCESS is filled accordingly, the corresponding callback routine is called.

iii) The PUT statement then directs the program flow as follows:

(a) To the next subroutine of a node that follows directly, if a lower-level node (not necessarily the very next) in the same subtree is requested by GET in the executable program or in the function module.

(b) To the subroutine of a node at the same level, if the preceding node branches to such a node and if a GET statement exists for such a node in the executable program or the function module.

The PUT statement in that subroutine starts again at step (i). In the subroutine of the lowest node in a subtree to be processed using GET, the program control does not branch further. Instead, the current subroutine is processed further. When a subroutine PUT_<node> has been executed in its entirety, the program flow returns to the PUT statement from which it branched to the subroutine PUT_<node>.

iv) When control has returned from a lower-level subroutine PUT_<node>, the PUT statement triggers the event GET <node> LATE in the runtime environment.

Regards,

Priyanka.

6 REPLIES 6

Former Member
0 Kudos

Hi,

GET - After the logical database has read an entry from the node <table>.

GET LATE - After all of the nodes of the logical database have been processed that are below <table> in the database hierarchy

      • Using Logical Database: F1S ***

TABLES: SPFLI,

SFLIGHT,

SBOOK,

SCARR.

START-OF-SELECTION.

GET SPFLI.

WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,

SPFLI-AIRPFROM, SPFLI-AIRPTO.

GET SFLIGHT.

WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.

GET SBOOK.

WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,

SBOOK-FLDATE, SBOOK-BOOKID.

GET SFLIGHT LATE.

WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.

Hope this will help.

reward if it helps..

Regards,

omakr.

Former Member
0 Kudos

Hi

see the doc

A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.

LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.

Less coding s required to retrieve data compared to normal internel tables.

Tables used LDB are in hierarchial structure.

Mainly we used LDBs in HR Abap Programming.

Where all tables are highly inter related so LDBs can optimize the performance there.

Check this Document. All abt LDB's

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...

GO THROUGH LINKS -

http://www.sap-basis-abap.com/saptab.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html

www.sap-img.com/abap/abap-interview-question.htm

www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm

Gothru the blog which provides info on LDB's:

/people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases

Sample code

TABLES: SPFLI,

SFLIGHT,

SBOOK,

SCARR.

START-OF-SELECTION.

GET SPFLI.

WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,

SPFLI-AIRPFROM, SPFLI-AIRPTO.

GET SFLIGHT.

WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.

GET SBOOK.

WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,

SBOOK-FLDATE, SBOOK-BOOKID.

GET SFLIGHT LATE.

WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos

<b>GET node </b>

Syntax

GET node [LATE] [FIELDS f1 f2 ...].

Alternatives:

1. GET node [FIELDS f1 f2 ...].

2. GET node LATE [FIELDS f1 f2 ...].

Addition:

... FIELDS f1 f2 ...

Effect

Use GET to handle two types of events after submitting executable programs: Get events and events at the end of a hierarchy level of a logical database. If during a GET event a list is written, previously an automatic line feed is created.

Note

The event blocks after GET are implemented internally as procedures. Declarative statements in GET event blocks create local data.

Alternative 1

GET node [FIELDS f1 f2 ...].

Effect

This statement defines an event block whose result is triggered by the ABAP runtime environment after submitting an executable program, if the logical database to which the program is linked, provides data in the work area node. The node work area must be declared with the NODES statement (or TABLES). The data can be processed in the event block.

GET node also controls the behavior of the logical database.

The logical database reads all data from all nodes that are not defined for field selection using SELECTION-SCREEN FIELD SELECTION in the logical database and are located on the access path of the logical database superior to node. This is independent of whether GET event blocks have been defined for these nodes or not. However, only the data of those nodes can be accessed for which a work area was declared using the NODES (or TABLES) statement.

If for nodes on the access path of the logical database superior to node, for which no GET event blocks are defined, a field selection is defined in the logical database, then all data is read only for those nodes, for which a NODES (or TABLES) statement exists. For nodes without a NODES (or TABLES) statment, only the key fields are read, because the logical database needs the key fields to build the access path.

At the end of a hierarchy level of the logical database, all fields of the work area node are set to hexadecimal null.

Alternative 2

GET node LATE [FIELDS f1 f2 ...].

Effect

This statement defines an event block whose result is triggered by the ABAP runtime environment after submitting an executable program, when the logical database has read in all records of node node. For node and FIELDS, the same applies as for the previous variant. Use this event block for final processing actions concerning the hierarchy level of the node.

Addition

... FIELDS f1 f2 ...

Effect

Use addition FIELDS to read only the specified fields f1 f2 ... and the key fields for node node from the logical database. As a prerequisite, the node must be defined for field selection in the logical database using SELECTION-SCREEN FIELD SELECTION. The content of the other fields of the work area is set to hexadecimal null.

<b>Example</b>

REPORT demo_get.

NODES: spfli, sflight, sbook.

DATA: weight TYPE p DECIMALS 4,

total_weight TYPE p DECIMALS 4.

INITIALIZATION.

carrid-sign = 'I'.

carrid-option = 'EQ'.

carrid-low = 'AA'.

carrid-high = 'LH'.

APPEND carrid TO carrid.

START-OF-SELECTION.

WRITE 'Luggage weight of flights'.

GET spfli FIELDS carrid connid cityfrom cityto.

SKIP.

ULINE.

WRITE: / 'Carrid:', spfli-carrid,

'Connid:', spfli-connid,

/ 'From: ', spfli-cityfrom,

'To: ', spfli-cityto.

ULINE.

GET sflight FIELDS fldate.

SKIP.

WRITE: / 'Date:', sflight-fldate.

GET sbook FIELDS luggweight.

weight = weight + sbook-luggweight.

GET sflight LATE FIELDS carrid .

WRITE: / 'Luggage weight =', weight.

total_weight = total_weight + weight.

weight = 0.

END-OF-SELECTION.

ULINE.

WRITE: / 'Sum of luggage weights =', total_weight.

Regards,

Pavan

Former Member
0 Kudos

Hi,

try to debug these standarad demo programs and see if u can get answers for ur questions

demo_program_get_late

demo_program_get

Also check this link

http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9b8535c111d1829f0000e829fbfe/content.htm

FORM PUT_<node>

Called in the sequence defined in the structure. Reads the data from the node <node> and uses the

PUT <node>.

statement to trigger a corresponding GET event in the ABAP runtime environment. The PUT statement is the central statement in this subroutine: It can only be used within a subroutine of a logical database. The logical database must contain the node <node>, and the subroutine name must begin with PUT_<node>. The PUT statement directs the program flow according to the structure of the logical database. The depth to which the logical database is read is determined by the GET statements in the application program or the interface parameter CALLBACK of the function module LDB_PROCESS.

First, the subroutine PUT_<root> is executed for the root node. The PUT statement then directs the program flow as follows:

i) If the database program contains the subroutine AUTHORITY_CHECK_<table>, the first thing the PUT_<node> statement does is to call it.

ii) Next, the PUT statement triggers a GET event in the runtime environment. If there is a corresponding GET <node> statement in the executable program to which the logical database is linked, the associated event block is processed. If the CALLBACK parameter of the function module LDB_PROCESS is filled accordingly, the corresponding callback routine is called.

iii) The PUT statement then directs the program flow as follows:

(a) To the next subroutine of a node that follows directly, if a lower-level node (not necessarily the very next) in the same subtree is requested by GET in the executable program or in the function module.

(b) To the subroutine of a node at the same level, if the preceding node branches to such a node and if a GET statement exists for such a node in the executable program or the function module.

The PUT statement in that subroutine starts again at step (i). In the subroutine of the lowest node in a subtree to be processed using GET, the program control does not branch further. Instead, the current subroutine is processed further. When a subroutine PUT_<node> has been executed in its entirety, the program flow returns to the PUT statement from which it branched to the subroutine PUT_<node>.

iv) When control has returned from a lower-level subroutine PUT_<node>, the PUT statement triggers the event GET <node> LATE in the runtime environment.

Regards,

Priyanka.

Former Member
0 Kudos

Hi,

try to debug these standarad demo programs and see if u can get answers for ur questions

demo_program_get_late

demo_program_get

Also check this link

http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9b8535c111d1829f0000e829fbfe/content.htm

Well, according to the documentation for GET:

"Addition 1

... LATE.

Effect

Executes the code following "GET dbtab LATE." only when all the subordinate tables have been read and processed.

Example

Count the smokers among the bookings already made:

NODES: SFLIGHT, SBOOK.

DATA SMOKERS TYPE I.

GET SFLIGHT.

ULINE.

WRITE: / SFLIGHT-SEATSMAX,

SFLIGHT-SEATSOCC.

SMOKERS = 0.

GET SBOOK.

CHECK SBOOK-SMOKER <> SPACE.

ADD 1 TO SMOKERS.

GET FLIGHT LATE.

WRITE SMOKERS. "

Regards

Former Member
0 Kudos

GET <table> events can only be used for the basic list in an interactive report.

The GET event is triggered each time a row is read from a logical database table. The data for this record is loaded into the table work area.

A GET event keyword can only be coded once for any one table in the logical database program.

The GET <table> LATE event, if coded, occurs just before the next row (record) of the table specified in the GET event is selected from the database. It also occurs after any other GET or GET LATE events for tables lower in the hierarchy of the logical database program.

GET event processing requires that the logical database be specified as an attribute of the report program (while in the ABAP Editor, use the menu path Go to > Attributes).

Reward if useful

Regards

Prax