Diff between database view and inner join
Hello,
I need to select data from multiple tables. I need to choose between 2 options.
1) create a database view and use this view for select.
2) write an inner join in abap prorgam.
In which cases we should create a view and in which cases we should use a inner join?
What are the factors which decide these?
Pls advice.
Thanks,
Rupali.
Hi,
Both are same..
But if you use regulary and used view in Multiple programs then create view..
If inner join in abap prorgam between two or more table used in less Programs and do not want to
create View (Means not to create transport request) then go for JOin in Program.
Prabhudas
Similar Messages
-
Difference between Database view and Table
Hi there,
Can anyone tell me the difference between Database view and Table.
Will the Database view query be more faster than a database table?Tables and database views can be defined in the ABAP Dictionary.
These objects are created in the underlying database with this definition. Changes in the definition of a table or database view are also automatically made in the database.
Data from several tables can be combined in a meaningful way using a view (join).
You can also hide information that is of no interest to you (projection) or only display
those data records that satisfy certain conditions (selection).
Database views implement an inner join. You only get those records which have an
entry in all the tables included in the view.
in views db modifications are not possible
views only contain data at run time
when they consult the database
in case of views the join definitions are already sstored in the database itself
whereas join as open sql is a query to oracle database as similar select statements
Views are optimized by SAP and stored in the repository while Joins
are in reports that needs to be compiled at every execution
Reward if helps
Regards,
Senthil
Message was edited by: senthil kumar -
Hi, difference between database view and elementary search help
hi
pl. can any one tell me the difference between
database view and elementary search help,
and help view and elementary search help,
and database view and help view.
in the output i do not see any difference.
thanx.
rocky roboHI
An entire table can be included in a database view. In this case all the fields of the included table will become fields of the view (whereby you can explicitly exclude certain fields). If new fields are included in the table or existing fields are deleted, the view is automatically adjusted to this change.
Database view:
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/36/74c0358373003ee10000009b38f839/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/36/74c0358373003ee10000009b38f839/frameset.htm</a>
Elementary search help:
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/8b/415d363640933fe10000009b38f839/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/8b/415d363640933fe10000009b38f839/frameset.htm</a>
Help view:
Help views are used if a view with an outer join is needed as selection method in a search help.
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/42/81c1351181b73fe10000009b38f839/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/42/81c1351181b73fe10000009b38f839/frameset.htm</a>
Regards,
Gunasree -
DIFF. between Quick Viewer and Query Builder
Hi experts,
can any body explain the difference between Quick Viewer and Query Builder with examples and can u forward the related material( how to create Quick Viewer and Query Builder ) other than help.sap.com.
useful answers duly rewarded
thanks in advance
sai krishnamy mail id: was [email protected], please send me the material
i will assign the points
thanks in advance
sai krishna -
Diffrance between saved views and workbooks
Hello Friends,
Good Morning ..
Could any one please tell me what is the diff between saved view and Workbooks. .?
It will be nice help for me.
Thanks .Hi Jain,
Do not know if your question is already answered. Let me give you my thoughts on this subject ... start with what is a query.
A query definition is saved on the server. Never anywhere else.
Although people say a workbook contains a query (or several queries); it does not. It contains a reference to a query. The workbook can be saved on the server; or anywhere else that you might save an Excel workbook.
What happens if someone changes the query definition on the server? Answer: the next time you refresh the query in the Excel workbook, the new query definition replaces the old query definition in the workbook. Maybe. It depends on what change was made.
For example, if someone added a Condition to the query definition, the workbook will be virtually invisible to this. The Condition is available; but, is not implemented in the workbook. (Until the user of the workbook manually adds the view of the Condition and then activates it.)
For example, if someone changed the definition of a KF in the query definition, the revised KF will show up in place of the old KF in the workbook.
But ... if, for example, someone deleted the old KF and added a new KF, we get a different story. Now the old KF no longer appears (it does not exist); but, the new KF does not appear (it was not marked to be visible in the workbook).
About workbooks as views ... OK, a workbook may very well have a certain "view" of the query (drilldown, filters, et cetera). And, if the workbook is saved to the server in a Role where everyone can access it, this is good. But, if the workbook is saved to one's favorites, then this "view" is only accessible to that individual. Which may be good. Or may not.
A "saved view", on the other hand is stored on the server. So, it is available to all.
If you navigate in a workbook you can back up. You can back up, though, only as far as you navigated in the current session. You cannot back up to where you were in the middle of last week's session. Unless you saved that navigation state as a "saved view". Then, you can jump to that view at any time.
The downside of saved views is that they are easy for anyone to set up and difficult for most to delete.
- Pete -
Diff bt Help view and Maintanence view
hi gem's
i need the diff bt Help view and Maintanence view with example...............Hi
The followings are different types of views:
- Database View (SE11)
Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
- Help View ( SE54)
Help views are used to output additional information when the online help system is called.
When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
Go thru this link plzz
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
Difference between "Help View" and "Search Help"
- Projection View
Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
- Maintenance View ( SE54 )
Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
Please have a look at below link. It will help you.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
for more detailed info look on:
http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
1.Go to se11
2. select view radiobutton and give a name
3. Create
4. select type of view you want to create. Such as database view.
5. give short description
6. give a table name such as mara
7. press the pushbutton relationship. here you will find all the tables which are allowed to create view with mara.
8. select one or mane tables.
8 copy
9.save , check and activate.
Regards
Anji -
hi all,
can any body tell me the diff between all views
projection view ,database view,maintance view,help view
plz tell me the difference with a example
hope for positive reponseMaintenance views offer easy ways to maintain complex application objects.
Data distributed on several tables often forms a logical unit, for example an application object, for the user. You want to be able to display, modify and create the data of such an application object together. Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables.
A maintenance view permits you to maintain the data of an application object together. The data is automatically distributed in the underlying database tables. The maintenance status determines which accesses to the data of the underlying tables are possible with the maintenance view.
database view
Data about an application object is often distributed on several database tables. A database view provides an application-specific view on such distributed data.
Database views are defined in the ABAP Dictionary. A database view is automatically created in the underlying database when it is activated.
Application programs can access the data of a database view using the database interface. You can access the data in ABAP programs with both OPEN SQL and NATIVE SQL. However, the data is actually selected in the database. Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way. Database views implement an inner join
projection view
Projection views are used to hide fields of a table. This can minimize interfaces; for example when you access the database, you only read and write the field contents actually needed.
A projection view contains exactly one table. You cannot define selection conditions for projection views.
There is no corresponding object in the database for a projection view. The R/3 System maps the access to a projection view to the corresponding access to its base table. You can also access pooled tables and cluster tables with a projection view.
help views
Help views are used if a view with an outer join is needed as selection method in a search help.
You have to create a help view if a view with outer join is needed as selection method of a search help.
The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help, you should generally use a database view as selection method. However, a database view always implements an inner join. If you need a view with outer join for the data selection, you have to use a help view as selection method. -
Difference among the Help view,Database view and Maintanance View
hi,
can Anyone pls let me know the Difference among the Help view,Database view and Maintanance View
thanks®ards
ramaThe followings are different types of views:
Database View (SE11)
Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
Help View ( SE54)
Help views are used to output additional information when the online help system is called.
When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
Go thru this link plzz
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
Difference between "Help View" and "Search Help"
Projection View
Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
Maintenance View ( SE54 )
Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
Please have a look at below link. It will help you.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
for more detailed info look on:
http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
1.Go to se11
2. select view radiobutton and give a name
3. Create
4. select type of view you want to create. Such as database view.
5. give short description
6. give a table name such as mara
7. press the pushbutton relationship. here you will find all the tables which are allowed to create view with mara.
8. select one or mane tables.
8 copy
9.save , check and activate.
The followings are different types of views:
Database View (SE11)
Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
Help View ( SE54)
Help views are used to output additional information when the online help system is called.
When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
Go thru this link plzz
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
Difference between "Help View" and "Search Help"
Projection View
Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
Maintenance View ( SE54 )
Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
Please have a look at below link. It will help you.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
for more detailed info look on:
http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
Go thru this link plzz
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
Difference between "Help View" and "Search Help"
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
Hope this is helpful, Do reward -
In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC
hello all
In LSMW, what is diff between LSMW-BAPI and LSMW-IDOCHi Swamy,
The differences between IDoc and BAPI are as follows:
IDOC
IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system.
Idocs are processed asynchronously and no information whatsoever is returned to the client.
The target system need not be always online. The IDOC would be created and would send the IDOC once the target system is available (tRFC concept). Hence supports guaranteed delivery.
With asynchronous links the sub-process on the client can be finished even if the communication line or the server is not available. In this case the message is stored in the database and the communication can be done later.
The disadvantage of asynchronous links is that the sub-process on the server cannot return information to the calling sub-process on the client. A special way for sending information back to the client is required. In addition, a special error handling mechanism is required to handle errors on the receiving side.
IDOCs may be more changeable from release to release.
IDOCs are poorly documented.
BAPI
BAPIs are a subset of the RFC-enabled function modules, especially designed as Application Programming Interface (API) to the SAP business object, or in other words: are function modules officially released by SAP to be called from external programs.
BAPIs are called synchronously and (usually) return information.
For BAPIs the client code needs to do the appropriate error handling.
Problems with synchronous links occur if the communication line or the server is temporarily not available. If this happens, the sub-process on the client cannot be finished (otherwise there would be data inconsistencies).
Synchronous links have the advantage that the sub-process on the server can return values to the sub-process on the client that has started the link.
BAPIs are not totally immune to upgrades.
BAPIs are reasonably well documented.
Reward points if useful.
Best Regards,
Sekhar -
What exactly is the diff between client dependant and client independant te
Hi gurus,
What is the diff between client independant and client dependant term.. I initially had a confusion related to client independant and client dependant Transport requests, where else are these words applicable, do they apply to data as well, if so how? any links to help me understand the difference..
regards,
kishoreHi Kishore,
Client Independant: These objects are not specific to any client. And it is universal which can be viewed,changed across the clients.
Client Dependant: These are the objects can be viewed, changed for the client for which it has been assigned. Other clients do not have access on these objects.
In SAP, all objects are finally stored as tables. "Mandt" is key field which determines whether the object is client dependant or not.
Client Independant transport requests will make the transported objects available across the clients. and Client dependent transport request make the objects available only for the client mentioned by field "Mandt"
Regards,
Dinesh D -
Diff between ECC5.0 and ECC6.0
Hi,
This is Ramakrishna,can any one give proper explanation diff between ECC5.0 and ECC6.0
Regards
RamakrishnaHi,
Refer following link;
[SAP ERP Solution Browser|http://solutionbrowser.erp.sap.fmpmedia.com/]
Following are the basic differences as far as MM Module is concerned;
Pickup list - Batch where-used list display in transaction MB56
u2022 Until release 4.7, the top-down and bottom-up analyses in the function pickup list for batch where-used list (transaction MB5C) were displayed only in the form of simple output lists. As of release 6.00 of SAP ERP Central Component, the function pickup list for batch where-used list branches to the batch where-used list itself (transaction MB56).
u2022 In addition, user can define how the data in the batch where-used list is displayed, in the initial screen.
u2022 User can use all the settings available in the batch where-used list. For example, he can expand transfer posting or display vendor batch. However, it is not possible to limit the selection to valid plants in the initial screen of the pickup list.
Usability enhancements for transaction MIGO for the posting of goods movements
u2022 For goods movements that refer to purchase orders as reference documents (for example, goods receipt, goods issue, subsequent adjustment), user can specify the ordering plant as an additional selection criterion directly next to the purchase order number and the item number.
u2022 There is a new default value: "copy account assignment fields." When entering other goods receipts, user can copy existing account assignment data from the previous item to use as the default values for a new item. To do this, user has to set the copy account assignment fields indicator in the default values.
u2022 User changes the default values in the menu path "Settings -> Default Values."
u2022 Goods movement is monitored with reference to a material document. When you enter the following goods movements, it is possible to specify a material document, such as the following, as the reference document:
- Goods receipt
- Goods issue
- Transfer posting
- Remove from storage
u2022 Note that these material documents must be documents that have arisen from a goods movement without reference ("Others") and that are not reversal documents.
New report : display list of invoice documents (MIR5)
u2022 Logistics invoice verification offers a new report display list of invoice documents (RMMR1MDI), w hich user can use to display such a list (Transaction is MIR5).
u2022 As an addition to the existing program invoice overview (transaction code MIR6), user have extended selection criteria and display options. For example, on the initial screen user can make selections by one-time customers, invoice gross amount, and entry date.
u2022 User can also show an expert mode, which enables him to select at plant level by FI document, GL A/c posting, and Material Posting.
u2022 In the output list, the report shows both posted and held invoices.
u2022 It does not show invoices without a corresponding FI document; such as invoices planned for verification in the background or which the software has already verified as containing errors.
Requirement prioritizations in materials management
u2022 With Requirement Prioritization functionality user can assign requirement urgency at item level in purchasing and reservation documents.
u2022 The software determines the relevant requirement priority (overall priority) of a material requisition from the combination of requirement urgency group and organizational priority.
Mass maintenance of outline agreements
The following two transactions available:
u2022 Mass maintenance for contracts: transaction code MEMASSCONTRACT
u2022 Mass maintenance for scheduling agreements: transaction code MEMASSSA
Commitment plan for purchase contracts
u2022 With the function of the commitment plan for purchase contracts, it is possible to pre plan value consumption for a purchase contract.
u2022 To this end, a commitment plan is generated for each document item of the relevant contract.
u2022 This commitment plan itself can have any number of items.
u2022 User can define a value and a validity date for each commitment plan item.
u2022 This enables user to pre plan different values for different periods of time.
u2022 The software generates an earmarked fund document for a defined commitment plan item.
u2022 This earmarked funds document can in turn contain several different items with different account assignments.
u2022 The software adopts these account assignments from the item account assignments of the commitment plan.
u2022 If a purchase requisition or purchase order references this contract, the earmarked funds document is copied into the purchase order, and the account assignment is adopted from that document.
u2022 Account assignment to a different account assignment object is then no longer allowed.
Availability check in "Enjoy purchase order and requisition"
u2022 Display and checking of availability are invokable separately in the "Enjoy purchase order and requisition" function, in line with the software behavior on the sales side.
u2022 User invoke the display and checking of availability in the "Enjoy purchase order" function (transaction code ME21N) and the "Enjoy purchase requisition" function (transaction code ME51N) as follows:
- To display the availability overview, choose the menu path "Environment -> Availability." - To check availability, choose the "Check Availability" icon.
- Until this release, if user carried out the availability check for an item of a stock transport order, the software adopted confirmations as per the desired date/time only.
u2022 Two settings are possible with availability check:
- Confirmation as per desired date/time (this is the standard setting and corresponds to previous software behavior)
- Delivery proposal - Full confirmation
External services: putting service items in the purchase order on hold (changed)
User can put purchase orders with service items on hold if these items do not contain any errors. Purchase orders with service items can also be put on hold if errors occur only at header level or as a result of the availability check.
Customizing transactions OX18 replaced by view
The assigned customizing transactions have been replaced by the following view in the following implementation guide activity in customizing for the enterprise structure: Assign plant to company code: transaction OX18 replaced by view V_T001K_Assign. One will find this activity in the implementation guide under the menu path "Enterprise Structure -> Assignment -> Logistics General -> Assign Plant to Company Code."
Goods receipt: new movement types in inventory management
The following new movement types are available in inventory management:
- 107: Goods receipt to valuated goods receipt blocked stock
- 109: Goods receipt from valuated goods receipt blocked stock
Prepayment of invoices
This functionality is characterized as follows:
u2022 User can trigger prepayment of vendor invoices in logistics invoice verification.
u2022 User use the prepayment function for vendors with whom organisation has a good, long-standing relationship.
u2022 The function enables payment soon after issue of the invoice and full exploitation of the date of required payment and existing cash discounts, by posting the vendor liabilities, taxes, and cash discounts in financial accounting in advance.
u2022 The software executes the payment of the invoice regardless of the relevant goods receipt and the outcome of the invoice verification check.
u2022 Most logistics invoice verification standard functions are not affected by the prepayment function.
u2022 When the software posts invoices, it continues to execute the standard checks.
u2022 If the software has already posted the prepayment document, user can make only restricted changes to the header fields of the invoice.
u2022 To ensure adequate and orderly financial accounting postings, a prepayment clearing account has been added to SAP ERP Central Component.
u2022 Upon prepayment, the software debits this account and then settles the account again after executing the check.
Purchasing accounting information to the former SAP Business Information Warehouse
u2022 With the transfer of the purchasing account information to the former SAP Business Information Warehouse component (whose functionality is now part of SAP Net Weaver), it is now possible to maintain Info Cubes, reports, and queries that can determine how and where the costs from purchasing documents have been assigned and controlled.
u2022 As part of the software, a new data source (2LIS_02_ACC) has been created and the purchasing extraction process extended to cover the account information for purchasing orders, schedule agreements, and contracts.
Automatic settlement of planned delivery costs with evaluated receipt settlement (MRDC)
u2022 A new report (RMMR1MDC), available within the logistics invoice verification, can be used to automatically settle planned delivery costs.
u2022 To invoke the report, from the SAP easy access screen, choose the menu path "Logistics -> Materials Management -> Logistics Invoice Verification -> Automatic Settlement -> Automatic Delivery Cost Settlement" (transaction code MRDC).
u2022 Functionality for report RMMR1MRS is enhanced.
u2022 User can use the report RMMR1MRS, "Evaluated receipt settlement with logistics invoice verification (LIV)" (transaction code MRRL), to settle planned delivery costs in addition to goods and service items within logistics invoice verification.
u2022 To do so, set the relevant indicator on the initial screen of the report.
Parking service items
It is now possible to put service orders without errors or with commitment errors on hold.
Report MB5B : Stock on Posting Date
u2022 This Report is available with u201CNon-Hierarchyu201D display option which provides details of Opening, Receipt, Issue and Closing balances of Stock with quantity and value both for a given period.
u2022 This functionality is not available in Release 4.7.
Stock Transfer Between Storage Locations
u2022 Function of stock transport orders between storage locations is available from ECC 6.0 onwards.
u2022 As a result of which user can input issuing storage location with supplying plant.
u2022 Facility of using different delivery types for different issuing storage locations is available.
u2022 Shipping Point data can also be determined based on the issuing storage location -
Different between database lock and sap lock
Hi All,
What is different between database lock and sap lock why sap introduced locking mechanism.
Thanks
SantoshFrom a database perspective, every dialog step forms a physical and logical unit:
the database transaction.. The database lock administration can only coordinate
this type of database transaction. From an SAP point of view, however, this is
not sufficient, because SAP transactions, which are formed from a sequence of
logically related work steps that are consistent in business terms, are generally
made up of several dialog steps. SAP systems need to have their own lock
management. This is implemented using the enqueue work process. This also
ensures that the platform-independence of the lock management is maintained. -
Diff between select single and select upto 1 rows.
Hello aLL,
PL tell what is technical diff between select single and select upto 1 rows and how it is affecting the performance.
RushikeshHi
Knowing when to use SELECT SINGLE or SELECT ... UP TO 1 ROWS
A lot of people use the SELECT SINGLE statement to check for the existence of a value in a database. Other people prefer to use the 'UP TO 1 ROWS' variant of the SELECT statement.
So what's the difference between using 'SELECT SINGLE' statement as against a 'SELECT .... UP TO 1 ROWS' statement ?
If you're considering the statements
SELECT SINGLE field INTO w_field FROM table.
and
SELECT field INTO w_field FROM table UP TO 1 ROWS. ENDSELECT.
then looking at the result, not much apart from the extra ENDSELECT statement. Look at the run time and memory usage and they may be worlds apart.
Why is this ?? The answer is simple.
The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.
The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.
Get the difference ??
If not, here is a good example, credit for this example goes to Richard Harper, a friend of mine on sapfans.com :
Create a Ztable called ZDifference with 2 fields in it, MANDT of type MANDT and POSNR of type POSNR. Make sure both of these are keys. Also create a table maintenance dialog for it (SE11->Utilities->Table Maintenance Generator). Fill the table with ten rows 000001-000010.
Then run the program shown below:
Code:
Program: Z_Difference
Purpose: A program that demonstrates the difference
between SELECT SINGLE and SELECT UP TO n ROWS.
This program requires the data table Z_DIFFERENCE
to have been created according to the structure
outlined in the text above and populated with
at least 10 records.
Creation Date: 21/04/2004
Requested By:
Reference Doc:
Author: R Harper
Modification History:
Date Reason Transport Who
Report Z_Difference
Message-id 38
Line-Size 80
Line-Count 0
No Standard Page Heading.
Start-Of-Selection.
Data: w_Single type Posnr,
t_Rows type standard table of Posnr
initial size 0
with header line.
Select single Posnr
from zDifference
into w_Single.
Select Posnr
into table t_Rows
from zDifference
up to 1 rows
order by Posnr descending.
Write :/ 'Select single:', w_Single.
Skip 1.
Write :/ 'Up to 1 rows :'.
Loop at t_Rows.
Write t_Rows.
EndLoop.
You should see the output:
Select single: 000001
Up to 1 rows : 000010
The first 'SELECT' statement selected the first record in the database according to any selection criterion in the 'WHERE' clause. This is what a 'SELECT SINGLE' does. The second 'SELECT' has asked the database to reverse the order of the records before returning the first row of the result.
In order to be able to do this the database has read the entire table, sort it and then return the first record. If there was no ORDER BY clause then the results would have been identical (ie both '000001') but the second select if given a big enough table to look at would be far slower.
Note that this causes a problem in the Extended Program Check if the full key is not specified in a 'SELECT SINGLE'. Replacing the 'SELECT SINGLE' by an "UP TO 1 ROWS" will give the same exact results without any warning but the program will run slower and consume more memory. This is a good example of a warning that we should ignore... considering you are sure of what you are doing !! -
Hi,
I need to join three tables, based on some conditions (EKPO, EKBE and EKKN Note: All PO line items from EKPO will have a movement associated in the EKBE Table. Capture all PO line items where no matches found in the EKPO-EKBE join)
for the above requirement shall I write my query like this?
SELECT ekpo~ebeln
ekpo~ebelp
ekpo~loekz
ekpo~txz01
ekpo~matnr
ekpo~bukrs
ekpo~werks
ekpo~menge
ekpo~meins
ekpo~knttp
ekbe~vgabe
ekbe~bwart
ekbe~menge
ekbe~dmbtr
ekbe~shkzg
ekkn~sakto
ekkn~kostl
ekkn~ps_psp_pnr
INTO CORRESPONDING FIELDS OF TABLE i_podata
FROM ekpo LEFT OUTER JOIN ekbe ON ekbeebeln = ekpoebeln AND
ekbeebelp = ekpoebelp
INNER JOIN ekkn ON ekknebeln = ekpoebeln AND
ekknebelp = ekpoebelp
WHERE ekpo~werks IN s_werks AND
ekpo~ebeln IN s_ebeln.
Shall I use both Outer Join and Inner join in one Query?
Please correcte me.
Thanks
Frank RexHi,
You can use both inner join and outer join in the same select statement.
Ensure first all the inner joins between tables are declared and put the left outer join at the end.
Some sample code for your reference:
SELECT
AVBELN AKUNNR ABSTNK ABSTDK AVKORG AVTWEG AAUART AKNUMV
BPOSNR BMATNR BWERKS BSPART BLGORT BKZWI1
SUM( BKWMENG ) AS KWMENG DBZIRK D~VKGRP
EDISPO EPRCTR
FROM VBAK AS A INNER JOIN VBAP AS B ON AVBELN EQ BVBELN
INNER JOIN VBPA AS C ON CVBELN EQ BVBELN
INNER JOIN KNVV AS D ON DKUNNR EQ AKUNNR
AND DVKORG EQ AVKORG AND DVTWEG EQ AVTWEG
LEFT OUTER JOIN MARC AS E ON E~MATNR EQ
BMATNR AND EWERKS EQ B~WERKS
INTO CORRESPONDING FIELDS OF TABLE IT_ORDERS
WHERE A~VKORG IN SO_VKORG
AND A~VTWEG IN SO_VTWEG
AND A~KUNNR IN SO_KUNNR
AND A~ERDAT IN SO_ERDAT
AND A~AUART IN ('ZFOR','ZROR','ZEOR','ZDXR','ZXOR','ZRM1','ZGOR','ZSOR')
AND B~MATNR IN SO_MATNR
AND B~WERKS IN SO_WERKS
AND B~SPART IN SO_SPART
AND B~ABGRU EQ SPACE
AND A~LIFSK EQ SPACE
AND A~FAKSK EQ SPACE
AND B~VSTEL IN SO_VSTEL
AND B~LGORT IN SO_LGORT
AND C~KUNNR IN SO_SHIP
AND C~PARVW EQ 'WE'
AND D~VKGRP IN SO_VKGRP
AND D~BZIRK IN SO_BZIRK
AND B~LGORT NE '0950'
GROUP BY AVBELN AKUNNR ABSTNK ABSTDK
AVKORG AVTWEG AAUART AKNUMV B~POSNR
BMATNR BWERKS BSPART BKZWI1 D~BZIRK
DVKGRP BLGORT EDISPO EPRCTR E~MATGR.
Lakshminarayanan.
P.S.Mark all helpful answers for points. -
Diff between Solaris 8 and Solaris 9
Hello Experts,
Do we have a document which talks about the diff between Solaris 8 and Solaris 9
I need to know what are the new featured in Solaris 9 and etc....
Thanks in Advance.
Sunil.Sadly, the difference between the early releases of Solaris 9 and the late releases of Solaris 8 isn't that big, since Sun backported a lot of the cool features in Solaris 9 to Solaris 8..
Hence; the answer to your question depends on which Solaris 8 and which Solaris 9 releases you are talking about.
However, a complete list of changes incoperated in the different Solaris 9 releases can be found here:
http://docs.sun.com/app/docs/doc/817-5770/6ml72d6k9?a=view
I guess there are similar lists for Solaris 10, which is even cooler than 8/9.
Enjoy!
//Magnus
Maybe you are looking for
-
Downloaded pdf editor app for $2.99 it is in my dock but won't open when clicked
DOwnloaded pdf editor app for $2.99 and it flew down to the dock, appeared to download (sliderbar) but now won't do anything when clicked. How do I delete and reinstall and won't i get charged again?
-
I have 2 accounts in Itunes. My old one and new one. I just purchased my first MAC book pro and my 2nd Ipad (Retina). I have an old IPOD Touch and have different stuff on each device. I am trying to sync without having to ERASE and REPLACE to syn
-
SELECT returns no result when there is a default namespace definition inXML
Hi, I have a problem that my select doesn't return any result when there is a default namespace definition in my XML file. I'm using oracle 11g release 1 XML file stored as a binary XML: <SIMS xmlns="http://sims.ics.muni.cz" xmlns:xsi="http://www.w3.
-
CS5/CS6 Illustrator suitcase font problems
We have been having incompatibility issues with Suitcase fusion 3 and Illustrator CS5 from months now. Now Illustrator CS6 has launched, we are having the same issues. Upon startup we load all our suitcase fonts then open Illustrator CS5, We also hav
-
Lion server shows up in Finder "Shared" section but won't connect
My Lion server iMac shows up both on my home LAN and from work in the Finder Shared section. Other Shared servers show up (just Lion not Lion Server) and work fine, as usual. When clicking on the Lion server icon the Finder tries to connect and then