‎2006 Aug 28 4:32 PM
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
‎2006 Aug 28 4:54 PM
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
‎2006 Aug 28 5:06 PM
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
‎2006 Aug 28 5:28 PM
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.
‎2006 Aug 28 6:06 PM
‎2006 Sep 01 9:26 AM
Thanks Suresh. Its almost done using late on first dbtable. Rewards are awarded..
‎2006 Aug 28 6:01 PM
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