Application Development and Automation 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: 
Read only

LDBs

Former Member
0 Likes
996

How to find the last record from logical database. For ex., I have 'Get <db table1>' for getting the header details and 'Get <db table2>' for getting the item details corresponding to the first header. For each header, there are multiple items. I have to calculate the totals after the end of last line item. So, How to find the last item from second 'Get' statement.

When iam debugging, the cursor is going to first 'Get' to get the other header details once it completes all the line items.

Is there any statement to find the last record? Pls. help me regd this....

Thanx,

Vinod

6 REPLIES 6
Read only

Former Member
0 Likes
924

Hi,

there are macros which you can use to get the last or first records.

This is HR specific. But i am not sure of the other modules.

*Get last IT 0000 record

RP-PROVIDE-FROM-LAST P0000 SPACE PN-BEGDA PN-ENDDA.

Similarly you can use RP-PROVIDE-FROM-FIRST

Read only

0 Likes
924

Thanks for the information.

But, how to check/use the macros and where to check these in ABAP. Can you please elaborate with an example...

Thanks,

vinod

Read only

0 Likes
924

Hi Vinod,

The macros are stored in the Table TRMAC (Macros in ABAP/4 programs).

You can check out for the Macros you need from this.

Read only

0 Likes
924

Have you tried the 'GET <db table1> LATE' event ?

~Suresh

Read only

0 Likes
924

Thanks Suresh. Its almost done using late on first dbtable. Rewards are awarded..

Read only

Former Member
0 Likes
924

Hai Vinod

1. A logical database is in fact

a program only.

2. This LDB provides two main things :

a) a pre-defined selection screen

which handles all user inputs and validations

b) pre defined set of data

based upon the user selection.

3. So we dont have to worry about from

which tables to fetch data.

4. Moreover, this LDB Program,

handles all user-authorisations

and is efficient in all respects.

5. tcode is SLDB

good info about Logical Database. you can check the link.

http://www.geekinterview.com/question_details/1506

http://help.sap.com/saphelp_46c/helpdata/EN/35/2cd77bd7705394e10000009b387c12/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/9f/db9bed35c111d1829f0000e829fbfe/frameset.htm

Functions for displaying and changing logical databases:

Call Transaction SE36 or

Choose ABAP Workbench -> Development -> Programming environ. -> Logical databases

Interaction between database program and report:

During program processing, subroutines are performed in the database program and events are executed in the report.

To read data from a database tables we use logical database.

A logical database provides read-only access to a group of related tables to an ABAP/4 program.

advantages:-

The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.

i)An easy-to-use standard user interface.

ii)check functions which check that user input is complete,correct,and plausible.

iii)meaningful data selection.

iv)central authorization checks for database accesses.

v)good read access performance while retaining the hierarchical data view determined by the application logic.

disadvantages:-

i)If you donot specify a logical database in the program attributes,the GET events never occur.

ii)There is no ENDGET command,so the code block associated with an event ends with the next event

statement (such as another GET or an END-OF-SELECTION).

1. transaction code SLDB.

2.enter name z<ldb-name>

3.create

4.short text

5.create

6. name of root node (here Ekko)

7. enter short text (f6)

8.node type -> data base table.

9.create

10 change logical DB

riht click on ekko and insert node

here node name ekpo

11.create

12. click on selections

13. press no Should the changed structure of Z<ldb name> be saved first.

14.select tables which you want to join.

15.transfer

16 now you have to o to coding part.

17. save

activate.

19.click to src code

double click on first include and activate

Regards

Sreeni