List Report ( Join Query )
I am developing list report and in that i have to use approximately 8-9 inner joins and according to SAP we can use only 2-3 joins so is there any alternative of fetching data from multiple table without effecting performance, i am listing my query below for proper understanding of the situation.
SELECT vbrk~vbeln vbrk~kunag vbrk~vtweg vbrk~vkorg
vbrp~fkimg vbrp~matnr vbrp~werks vbrp~vkbur
j_1iexchdr~exnum j_1iexchdr~exdat
kna1~stceg kna1~name1 kna1~regio
t005u~bezei
adrc~street adrc~str_suppl1 adrc~str_suppl2
t023t~wgbez
likp~traid
zmm_deliv_badi~lr_number zmm_deliv_badi~lr_date zmm_deliv_badi~manual_no
zmm_deliv_badi~curr_num zmm_deliv_badi~manual_no1 zmm_deliv_badi~curr_num1
mara~spart
FROM vbrk INNER JOIN vbrp ON vbrp~vbeln = vbrk~vbeln
INNER JOIN j_1iexchdr ON j_1iexchdr~rdoc = vbrk~vbeln
INNER JOIN kna1 ON kna1~kunnr = vbrk~kunag
INNER JOIN t005u ON t005u~bland = kna1~regio
AND t005u~spras = 'EN'
AND t005u~land1 = 'IN'
INNER JOIN adrc ON adrc~addrnumber = kna1~adrnr
INNER JOIN t023t ON t023t~matkl = vbrp~matkl
INNER JOIN likp ON likp~vbeln = vbrp~vgbel
INNER JOIN zmm_deliv_badi ON zmm_deliv_badi~vbeln = vbrp~vgbel
INNER JOIN mara ON mara~matnr = vbrp~matnr
INTO CORRESPONDING FIELDS OF TABLE lit_st
WHERE vbrk~vtweg IN ('03','04','06')
AND vbrk~fkdat IN so_date
AND vbrp~werks IN p_werks
AND j_1iexchdr~status = 'C'
AND vbrk~vkorg IN p_vkorg
AND vbrk~kunag NOT IN ('0000001130','0000001150','0000001220','0000001240').
What is the other alternative of apart from using joins , making views is not the solution as it will increase database objects and it is also not recommended and ranges and for all entries in will also decrease performance and for that we have to make lots of temporary objects
So , please advice.
Thanks .
Ankesh Jindal
>
Ankesh Jindal wrote:
> What is the other alternative of apart from using joins , making views is not the solution as it will increase database objects and it is also not recommended and ranges and for all entries in will also decrease performance and for that we have to make lots of temporary objects
If you are saying neither Views nor for all entries nor Joins would work with aspect of performance, than I'm Sorry to say that we have no option left now.
BTW you are misleading with your assumption for join. You can use Join in this case.
Cheers,
Amit.
Similar Messages
-
Join query in a dynamic list of values query
I have a join query in a dynamic list of values query. The value does not return a text value, but rather the id value.
Is it possible to use a join query in a dynamic list of values query?
For example...in the below query, I expect to see ename in the drop down list, but I see class_emp_id.
select b.ename d, a.class_emp_id r
from class_emp a, emp b
where a.class_cat_id = :CURR_CLASS_CAT_ID
and a.emp_id = b.emp_id
order by 1
Thanks,
Reid:CURR_CLASS_CAT_ID is a number datatype.
I think the problem is with the ARF. Whenever I change the dynamic LOV query to exclude the :CURR_CLASS_CAT_ID (a passed in session variable), the drop down shows all the text names I am looking for; albeit, too many since I am excluding the :CURR_CLASS_CAT_ID.
The page I am having the problem with is a popup that is called from a report link on another page. When I show the session variables on the popup page, it shows values for only 1 of the 3 session variables I am passing to this page.
I am using the javascript:popUp2 syntax when I call the popup page from the report link.
As I said previously, I am passing 3 parms and only the 1st parm is getting a value. Yes, there are values for all three parms in the record of the report.
Is there a limit to the number of variables (itemNames) that can be passed to the popup using this method? -
Can i join a list in sub-site using Join query?
Hi all,
I'm newbie and i have tried to join a list in parent site with a list in sub-site using Join query but i always get the error. How can i do this action? Thanks!You could try using SPSiteDataQuery or a DataTable.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery%28v=office.14%29.aspx
http://sharepoint.stackexchange.com/questions/75713/is-it-possible-to-populate-result-by-joining-two-lists-throughout-the-site-colle
--Cheers -
Join Query in Object Oriented Programming
Hi,
I am trying to understand better how OO programming should work in CFC context. For example, I have two database tables: Customer and Order. So I create two CFCs, one for Customer and another for Order. In the CFCs I have query functions (select, insert, update) to access and manipulate data in the underlying tables.
Now, I need to create a new CFC, OrderReport. This CFC takes in customerID and returns data pulled from both Customer and Order tables. I can just have a join query that pulls data from these two tables. However, I have been wondering whether this method is within the spirit of Object Oriented programming. Should this CFC be able to access directly to the two tables? Or should I pull data separately using Customer CFC and Order CFC, and join them locally (ie. in OrderReport CFC)? This latter method would be a lot slower to run than the first method.
Can you advise me as to what the best practice is in the context of OO programming? Thank you.This is a common question for those new to OO programming. Here are some of
my thoughts on the topic.
OO programming has nothing to do with tables. Your tables are essentially a
relational storage of one part of a business concept. It just so happens
that most of the data you need to support the business concept of Customer
and the business concept of Order are stored in tables named Customer and
Order. This is because database tables often relate to a business concept. I
think you'd find that to get the entire customer, you'd have to get data
from other tables, like State and Gender and other such tables.
The reason why I bring this up is to begin to separate your thinking.
Databases are concerned with efficient storage and retrieval of data.
Objects (CFCs) are not concerned at all with storage of data. Objects are
concerned with encapsulating business logic relating to a business concept.
Just like your database may have columns not needed by your CFCs, your CFCs
likely have methods not needed by your database.
For example, if you wanted to know, in your application, whether to show an
In Store Pickup option, you may wish to add an isLocal() method to your
customer object. This would ( we'll pretend) get the customer's zip code,
and look it up in GeographicalPostalServiceMapper object to tell us how far
away the customer is.
The point is, the right OO (CFC) design has nothing to do with how your
tables are organized in the database. You would do well to concern yourself
with the needs of the application and what sort of questions you need your
customer object to be able to answer to the other parts of your application.
Like, isLocal(), isOver21(), isBadCreditRisk() and so on.
As to your question about joins, you would do well to use joins in your
application. Do not be afraid of using queries to get the information you
need. Especially for reporting queries. In these cases, I often make an
object called a xxxList. My CustomerList.cfc would have the different ways
to list customer data, like CustomerOrders and CustomerOrderReturns. I'd
hide this join relationship inside of the CustomerList object so only the
CustomerList object has the SQL. That's usually enough encapsulation for the
needs of my application.
Truly, it doesn't matter what the name of the object is, just that you
assign it the responsibility of managing a business concept and keep that
business concept inside that object. You seem to have suggested
CustomerReport.cfc and that would be a fine name for an object that can
return numerous Customer Reports.
Happy Coding
DW -
Unable to create report. Query produced too many results
Hi All,
Does someone knows how to avoid the message "Unable to create report. Query produced too many results" in Grid Report Type in PerformancePoint 2010. When the mdx query returns large amount of data, this message appears. Is there a way to get all
the large amount in the grid anyway?
I have set the data Source query time-out under Central Administration - Manager Service applications - PerformancePoint Service Application - PerformancePoint Service Application Settings at 3600 seconds.
Here Event Viewer log error at the server:
1. An exception occurred while running a report. The following details may help you to diagnose the problem:
Error Message: Unable to create report. Query produced too many results.
<br>
<br>
Contact the administrator for more details.
Dashboard Name:
Dashboard Item name:
Report Location: {3592a959-7c50-0d1d-9185-361d2bd5428b}
Request Duration: 6,220.93 ms
User: INTRANET\spsdshadmin
Parameters:
Exception Message: Unable to create report. Query produced too many results.
Inner Exception Message:
Stack Trace: at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.ExtractReportViewData()
at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.CreateRenderedView(StringBuilder sd)
at Microsoft.PerformancePoint.Scorecards.ServerRendering.NavigableControl.RenderControl(HtmlTextWriter writer)
PerformancePoint Services error code 20604.
2. Unable to create report. Query produced too many results.
Microsoft.PerformancePoint.Scorecards.BpmException: Unable to create report. Query produced too many results.
at Microsoft.PerformancePoint.Scorecards.Server.Analytics.AnalyticQueryManager.ExecuteReport(AnalyticReportState reportState, DataSource dataSource)
at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportBase(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer, String formattingDimensionName)
at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
PerformancePoint Services error code 20605.
Thanks in advance for your help.Hello,
I would like you to try the following to adjust your readerquotas.
Change the values of the parameters listed below to a larger value. We recommend that you double the value and then run the query to check whether the issue is resolved. To do this, follow these steps:
On the SharePoint 2010 server, open the Web.config file. The file is located in the following folder:
\Program Files\Microsoft Office Servers\14.0\Web Services\PpsMonitoringServer\
Locate and change the the below values from 8192 to 16384.
Open the Client.config file. The file is located in the following folder:
\Program Files\Microsoft Office Servers\14.0\WebClients\PpsMonitoringServer\
Locate and change the below values from 8192 to 16384.
After you have made the changes, restart Internet Information Services (IIS) on the SharePoint 2010 server.
<readerQuotas
maxStringContentLength="2147483647"
maxNameTableCharCount="2147483647"
maxBytesPerRead="2147483647"
maxArrayLength="2147483647"
maxDepth="2147483647"
/>
Thanks
Heidi Tr - MSFT
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
Deciphering column names in a join query using jdbc
hi all....
I am making a database adapter for a generic report generater. This adapter would be forming queries involing various tables. There are two ways of doing it . I fire an sql on parent table to get the keys and then go to child table for each one of them or i form a join query to get desired result.
i want to go with the later approach where my query would be forming a join. The problem comes when table involved in this join has columns with the same name. for eg if a column "NOTE" is there in table A as well as table B on which i have a join. Resultset returns me with two "NOTE" columns and i cannot recognize which one belongs to which table.
all API calls including getString("Note") seems to be referring to the first occurence of "Note" column.
Also getTableName() and getSchemaName() APIs on resultsetMetadata doesnt return in anything in case of joins.
Any pointers would be most appreciated.
cheers
vivekthanks for suggesting this solution ... though i had thought of the same onece .... unfortunately i cannot implement something like this coz out of the result set i have to instantiate an object hierarchy depending on the schema ....
this also puts me in a doubt whether i can use join in my case.
for eg ... .
lets say we have a customer talbe and and address table which has one to many relationship .... one contact can have multiple addresses.
Assuming a contanct "Joe Bloggs" having 3 addresses ...a query like following
select contact.firstname contactfirstname , address.streetname addressstreetname from contact , address where contact.contactid = address.contactid
this would return me 3 rows and i can also recognize various columns with their aliases ..
but i would lose an important fact that i have to create one java object for contact class and 3 instances for addresses which i have to return finally.
this means that i would like to return an object hierarchy with one contact object and 3 address object underneath it linked with contactid.
Any other suggestions after reading the complete requirement are most welcome ...sorry for not puting the entire thing at first.
i guess the only soln left is to visit contact and address table separately. :( -
ABAP list report, multiple selections - select-options
I have written a very simple ABAP list report, that contains a single select-option. On the selection screen, I have the option of entering multiple values, with each new value being displayed directly underneath the old, but I am only getting the first value entered on the screen displayed. Does anyone have any sample code for me?
Hi Daniel,
Select_Options consists of 4 parameters, in with the range consists in eg...
Select-options s_vbeln for vbak-vbeln.
then s_vbeln-low, s_vbeln-high are the range values...
So whne you write select query.
write vbeln in s_vbeln
instead of vbeln eq s_vbeln
Hope this solves your problem.
Thanks & Regards,
Dileep .C -
How to build table join query in Jdeveloper
Hi,
Can someone tell me how to build table join query in Jdeveloper's Expression Builder UI?[Is it possible to create a table of contents in Crystal Reports?|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313335333133303330%7D.do]
-
Hi expert,
regarding crystal report query,im still new in crystal report,actually i want to make report join with table opor,por1,opor,oitm,oshp,nnm1,ocrn,por10 and octg.im face difficulty when want to join por10.then i join with por10.docentry = por1.docentry with table por1 and por1.visorder = por10.aftlinenum and im not sure it correct or not.im just want to make condition like this
if (T1.U_CSUS_Size = '') and (t2.LineType = 'T') then it will show (t0.U_CSUS_ItmCode + ' ' + t0.U_CSUS_ItmDescp + ' ' + t1.U_CSUS_Size) else (t0.U_CSUS_ItmCode + ' ' + t0.U_CSUS_ItmDescp) and joining (from POR1 T0
INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
inner join por10 T2 on T0.docentry = T2.docentry and T0.visorder = T2.aftlinenum)
for 'u_csus_.....' is for udf i created.can i know how easier step for this condition.i also already try alot of query.sometime can make duplicate column.
regards,
Arif
Edited by: Ahmad Arif on Jan 10, 2012 4:03 AMDear Anmad Arif
Try the below query
SELECT
(CASE WHEN (T1.U_CSUS_Size = '') and (t2.LineType = 'T') THEN
(t0.U_CSUS_ItmCode + ' ' + t0.U_CSUS_ItmDescp + ' ' + t1.U_CSUS_Size)AS NVARCHAR(1000))
else T1.[Dscription] End) AS [Description],
T1.VisOrder,
(CASE WHEN T1.[Quantity]<=0 THEN NULL ELSE T1.[Quantity] END) AS Qty,
CAST(ISNULL(T3.UserText, '''') AS VARCHAR(MAX)) As ItemDesc,
T1.Currency, T3.SuppCatNum,
(CASE WHEN T1.linetotal<=0 THEN NULL ELSE T1.linetotal END) as amount,
(CASE WHEN T1.[price]<=0 THEN NULL ELSE T1.[price] END) AS Rate,
T3.UserText,
T0.DocEntry,
ISNULL(T1.U_Unit, T3.SalUnitMsr) AS SaleUnit,
ISNULL(T3.BuyUnitMsr, '''') AS PurchaseUnit,T1.VisOrder,'' LineSeq,'' aftLineNum,
ISNULL(T0.U_QText,'') AS QText,T1.U_QRR as QRR
FROM OPOR T0
RIGHT OUTER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
RIGHT OUTER JOIN OITM T3 ON T1.ItemCode = T3.ItemCode
LEFT OUTER JOIN dbo.OSCN AS T4 ON (T0.CardCode=T4.CardCode AND T1.ItemCode=T4.ItemCode)
WHERE T0.Docnum = '4063'
UNION ALL
SELECT CAST(ISNULL(T1.LineText, '') AS VARCHAR(MAX)) AS [Description],
T1.AftLineNum,
NULL Qty,
null,
null ,NULl ,NULL,
null Rate,
NULL,
T0.DocEntry,
null,
null,T1.OrderNum,T1.LineSeq,AftLineNum,'' AS BPCatlog,
null
FROM OPOR T0
RIGHT OUTER JOIN POR10 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.Docnum = '4063'
And T1.LineText IS NOT NULL
Note : Change the DocNum= DocKey When you use Crystal report As per your requied
Regards
Kamlesh -
Hi all!
I am doing a report by query. In the Infoset query i have given PO Number(EBELN) as output along with some other fields. But the PO no is not displaying in the output while i execute the query. I have not ticked PO Number field as selection field. Its only output field. What may be the reason?
Can anyone tell me the reason?
Yuvi.Hi raju!
I am making query as below...
List all the materials for a particular period which has been done GR with the output as PO No - Material Docu No- excise invoice No.
So PO should be displayed as output..
I am refering MSEG and J_1IPART1.
Any inputs?
Yuvi. -
Create dynamic report or query for piece count
Hi abaper's
This is a very straight forward requirement. so please give me code
First you have to get the corresponding plant from table T320 for the given warehouse numbers in the selection screen.
1. Get the sum of order qty of sales orders from the sales order tables for the given warehouse(Plant), distribution channel and the give date range.
2. Get the confirmed transfer orders qty from the TO master table where TO confirmation date is in the given date range and WH number.
3. Get the total PGIed qty from the delivery master table where PGI'ed date in the given date range, shipping point is in the corresponding plant of the WH and for the given distribution channel.
As you are going to use the major tables please try to write the select commands effectively to avoid further performance issues.How to improve the performance fo this code.....this very urgent.
& Issue Number : 22199 &
& Programmer : Anjaneyulu.Pabba &
& Transport Number : D01K962471 &
& Date of Creation : 19/03/2008 &
& Description : Dynamic report or query for piece count &
& Requested By : Parvati.Polisetty &
REPORT ZR_SD_PIECE_COUNT_ALV no standard page heading
line-size 255
line-count 65.
TABLES DECLARATION
*TABLES: T320, "Assignment IM Storage Location to WM Warehouse Number
VBAK, "Sales Document: Header Data
VBAP, "Sales Document: Item Data
TVKOV, "Org. Unit: Distribution Channels per Sales Organization
LTAK, "WM transfer order header
LTAP, "Transfer order item
LIKP, "SD Document: Delivery Header Data
LIPS. "SD document: Delivery: Item data
TYPE-POOLS DECLARATION
TYPE-POOLS: SLIS .
Internal Table Declaration
DATA : BEGIN OF TY_T320,
WERKS TYPE WERKS_D,
LGNUM TYPE LGNUM,
END OF TY_T320.
DATA : BEGIN OF TY_VBAK,
VBELN TYPE VBELN_VA,
VTWEG TYPE VTWEG,
WERKS TYPE WERKS_D,
KWMENG TYPE KWMENG,
VSTEL TYPE VSTEL,
END OF TY_VBAK.
DATA : BEGIN OF TY_LTAK,
LGNUM TYPE LGNUM,
TANUM TYPE TANUM,
VISTA TYPE LTAP_VISTA,
END OF TY_LTAK.
DATA : BEGIN OF TY_LIKP,
VBELN TYPE VBELN_VL,
WERKS TYPE WERKS_D,
LFIMG TYPE LFIMG,
END OF TY_LIKP.
DATA : BEGIN OF TY_ITAB ,
LGNUM TYPE LGNUM, "Warehouse Number / Warehouse Complex
WERKS TYPE WERKS_D, "Plant
VBELN TYPE VBELN_VA, "Sales Document
VTWEG TYPE VTWEG, "Distribution Channel
KWMENG TYPE KWMENG, "Cumulative order quantity in sales units
TANUM TYPE TANUM , "Transfer Order Number
VISTA TYPE LTAP_VISTA, "Source actual quantity in alternative
unit of measure
LFIMG TYPE LFIMG, "Actual quantity delivered (in sales units)
END OF TY_ITAB .
DATA: T_T320 LIKE STANDARD TABLE OF TY_T320 INITIAL SIZE 0 WITH HEADER
LINE,
T_VBAK LIKE STANDARD TABLE OF TY_VBAK INITIAL SIZE 0 .
DATA: T_LTAK LIKE STANDARD TABLE OF TY_LTAK INITIAL SIZE 0 WITH HEADER
LINE.
DATA :T_LIKP LIKE STANDARD TABLE OF TY_LIKP INITIAL SIZE 0 WITH HEADER
LINE.
DATA:T_ITAB LIKE STANDARD TABLE OF TY_ITAB INITIAL SIZE 0 WITH HEADER
LINE .
*& Fieldcatalog Declaration
DATA : T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA : W_LAYOUT TYPE SLIS_LAYOUT_ALV.
********Global Data Declaration***
DATA :G_REPID LIKE SY-REPID,
G_EXIT(1) TYPE C,
GX_VARIANT LIKE DISVARIANT,
X_SAVE, "for Parameter I_SAVE
GS_VARIANT TYPE DISVARIANT. "for parameter IS_VARIANT
data: g_lgnum type t320-lgnum,
g_vtweg type vbak-vtweg,
g_erdat type vbak-erdat.
*& Selection-Screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_LGNUM FOR g_lgnum, "Warehouse Number
S_VTWEG FOR g_vtweg, "Distribution Channel
S_ERDAT FOR g_erdat ."Date on which the record was
**********"created
SELECTION-SCREEN END OF BLOCK B1 .
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETER: P_VARI LIKE DISVARIANT-VARIANT. "Layout
SELECTION-SCREEN END OF BLOCK B2.
*& INITIALIZATION EVENT
INITIALIZATION.
CLEAR GS_VARIANT.
'gs_variant' must at least contain the report-id to allow
saving a variant.
G_REPID = SY-REPID.
§ 2.At least field REPORT of this structure has to be filled!
GS_VARIANT-REPORT = G_REPID.
§ 3.Determine saving options.
X_SAVE = 'A'. "The user may save all types of variants
*******Validating selection-screen values**********************
getting F4 value for display variant field
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
****validation of F4 value of display variant
AT SELECTION-SCREEN.
PERFORM PAI_OF_SELECTION_SCREEN.
*& Start-Of-Selection
START-OF-SELECTION.
*****Subroutine to select Plant from T320
PERFORM FIND_PLANT .
*****Subroutine to select Order Quantity from VBAP
PERFORM ORDER_QUANTITY .
*****Subroutine to select Transfer Order Quantity from LTAK and LTAP
PERFORM TRANSFER_ORDER_QUANTITY.
*****Subroutine to select TDelivery Quantity from LIKP and LIPS
PERFORM DELIVERY_QUANTITY.
*& End-Of-Selection
END-OF-SELECTION.
*****Subroutine for Fieldcatalog
PERFORM FIELDCATALOG .
*****Subroutine for Final Output
PERFORM DISPLAY_OUTPUT .
*& Subroutine Implementaion
*& Form FIND_PLANT
text
--> p1 text
<-- p2 text
FORM FIND_PLANT .
SELECT WERKS
LGNUM
FROM T320
INTO TABLE T_T320
WHERE LGNUM IN S_LGNUM.
ENDFORM. " FIND_PLANT
*& Form order_quantity
text
--> p1 text
<-- p2 text
FORM ORDER_QUANTITY .
SELECT VK~VBELN
VK~VTWEG
VP~WERKS
VP~KWMENG
VP~VSTEL
INTO TABLE T_VBAK FROM VBAK AS VK
INNER JOIN VBAP AS VP
ON VKVBELN = VPVBELN
FOR ALL ENTRIES IN T_T320
WHERE VK~VTWEG IN S_VTWEG
AND VK~ERDAT IN S_ERDAT
AND VP~WERKS = T_T320-WERKS.
ENDFORM. " order_quantity
*& Form Transfer_order_quantity
text
--> p1 text
<-- p2 text
FORM TRANSFER_ORDER_QUANTITY .
SELECT LK~LGNUM
LK~TANUM
LP~VISTA
INTO TABLE T_LTAK FROM LTAK AS LK
INNER JOIN LTAP AS LP
ON LKLGNUM = LPLGNUM
WHERE LK~KQUIT = 'X'
AND LK~BDATU IN S_ERDAT
AND LK~LGNUM IN S_LGNUM.
ENDFORM. " Transfer_order_quantity
*& Form Delivery_QUANTITY
text
--> p1 text
<-- p2 text
FORM DELIVERY_QUANTITY .
SELECT VBELN WERKS LFIMG FROM LIPS
INTO TABLE T_LIKP
FOR ALL ENTRIES IN T_T320
WHERE WERKS = T_T320-WERKS
AND ERDAT IN S_ERDAT
AND VTWEG IN S_VTWEG.
ENDFORM. " Delivery_QUANTITY
*& Form fieldcatalog
text
--> p1 text
<-- p2 text
FORM FIELDCATALOG .
W_FCAT-COL_POS = '1' .
W_FCAT-FIELDNAME = 'LGNUM' .
W_FCAT-REF_TABNAME = 'T320'.
W_FCAT-REF_FIELDNAME = 'LGNUM' .
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = '2' .
W_FCAT-FIELDNAME = 'VTWEG' .
W_FCAT-REF_TABNAME = 'VBAK'.
W_FCAT-REF_FIELDNAME = 'VTWEG' .
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = '3' .
W_FCAT-FIELDNAME = 'KWMENG' .
W_FCAT-REF_TABNAME = 'VBAP'.
W_FCAT-REF_FIELDNAME = 'KWMENG' .
*w_fcat-seltext_m = '# of Orders'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = '4' .
W_FCAT-FIELDNAME = 'VISTA' .
W_FCAT-REF_TABNAME = 'LTAP'.
W_FCAT-REF_FIELDNAME = 'VISTA' .
*w_fcat-seltext_m = '# of Pcs Picked'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = '5' .
W_FCAT-FIELDNAME = 'LFIMG' .
W_FCAT-REF_TABNAME = 'LIPS'.
W_FCAT-REF_FIELDNAME = 'LFIMG' .
*w_fcat-seltext_m = '# of Pcs Shipped'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = '6' .
W_FCAT-FIELDNAME = 'TANUM' .
W_FCAT-REF_TABNAME = 'LTAK'.
W_FCAT-REF_FIELDNAME = 'TANUM' .
**w_fcat-seltext_m = '# of Pcs Shipped'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS = '7' .
W_FCAT-FIELDNAME = 'WERKS' .
W_FCAT-REF_TABNAME = 'T320'.
W_FCAT-REF_FIELDNAME = 'WERKS' .
**w_fcat-seltext_m = '# of Pcs Shipped'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
ENDFORM. " fieldcatalog
*& Form display_output
text
--> p1 text
<-- p2 text
FORM DISPLAY_OUTPUT .
LOOP AT T_T320 INTO TY_T320.
TY_ITAB-WERKS = TY_T320-WERKS.
TY_ITAB-LGNUM = TY_T320-LGNUM.
READ TABLE T_VBAK INTO TY_VBAK WITH KEY WERKS = TY_T320-WERKS.
IF SY-SUBRC = 0.
TY_ITAB-VBELN = TY_VBAK-VBELN.
TY_ITAB-VTWEG = TY_VBAK-VTWEG.
TY_ITAB-KWMENG = TY_VBAK-KWMENG + ty_itab-kwmeng.
ENDIF.
READ TABLE T_LTAK INTO TY_LTAK WITH KEY LGNUM = TY_T320-LGNUM.
IF SY-SUBRC = 0.
TY_ITAB-TANUM = TY_LTAK-TANUM.
TY_ITAB-VISTA = TY_LTAK-VISTA + ty_itab-vista.
ENDIF.
READ TABLE T_LIKP INTO TY_LIKP WITH KEY WERKS = TY_T320-WERKS.
IF SY-SUBRC = 0.
TY_ITAB-LFIMG = TY_LIKP-LFIMG + ty_itab-lfimg.
ENDIF.
APPEND TY_ITAB TO T_ITAB.
ENDLOOP.
Function Module for Displaying Final Output ********
W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FCAT[]
TABLES
T_OUTTAB = T_ITAB.
ENDFORM. " display_output
*& Form f4_for_variant
text
--> p1 text
<-- p2 text
FORM F4_FOR_VARIANT .
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = GS_VARIANT
I_SAVE = X_SAVE
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = GX_VARIANT
EXCEPTIONS
NOT_FOUND = 2.
IF SY-SUBRC = 2.
MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF G_EXIT = SPACE.
P_VARI = GX_VARIANT-VARIANT.
ENDIF.
ENDIF.
ENDFORM. " f4_for_variant
*& Form pai_of_selection_screen
text
--> p1 text
<-- p2 text
FORM PAI_OF_SELECTION_SCREEN .
IF NOT P_VARI IS INITIAL.
MOVE GS_VARIANT TO GX_VARIANT.
MOVE P_VARI TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = X_SAVE
CHANGING
CS_VARIANT = GX_VARIANT.
GS_VARIANT = GX_VARIANT.
ELSE.
PERFORM VARIANT_INIT.
ENDIF.
ENDFORM. " pai_of_selection_screen
*& Form variant_init
text
--> p1 text
<-- p2 text
FORM VARIANT_INIT .
CLEAR GS_VARIANT.
GS_VARIANT-REPORT = G_REPID.
ENDFORM. " variant_init -
Adding a field to rhe join query
Dear Friends,
I need your help in adding a field to a join query.
I have created a reort using join(SQVI). Now i want to add an addition field to that report. The issue is the field i am looking at is stored in structure. Is there any way i can add this field....
SanjayIt is not possible here (in SQVI).
you have to Go with Query.
SQ02 using this Create infoset, add all the tables , here include that structure field, and then add the logic to populate the field.
Now go to SQ01 and create Query. -
Inner join query used with 7 Database tables
HI All,
In a report they used the Inner join Query with 6 Data base table..now there is a performance issue with at query.
its taking so much of time to trigger that query. Please help how to avoid that performance issue for that.
In that 2 database tables containing lakhs of records..
According to my knowledge it can be avoided by using secondary indexs for those 2 database tables..
and by replacing the Inner join Query with FOR ALL ENTRIES statement.
i want how to use the logic by using FORALL ENTRIES statement for this..
So, please give you proper suggestion to avoid this issue..
Thanking you.
Moderator message: Please Read before Posting in the Performance and Tuning Forum
Edited by: Thomas Zloch on Oct 16, 2011 10:27 PMHi,
And what do you mean with "they used"? If "SAP used" then yo will need to ask a SAP for note
FOR ALL ENTRIES is quite good described in help. Please search forum also.
Without query it won't be possible to tell how it can be optimized, however you can try to use SE30/SAT and ST05. Maybe it will help you.
BR
Marcin Cholewczuk -
Populate list by executing query with where clause
Hi,
I m populating my list from database table using following command.
EntityManagerFactory emf = Persistence.createEntityManagerFactory("learning", new HashMap());
EntityManager em = emf.createEntityManager();
String query = "select d from Dept d";
List list = em.createQuery(query).getResultList();
My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string.
String query = "select d from Dept d where d.dept_name='ANYNAME'";
Moreover I cant select even indivisual columns by using following line
String query = "select d.dept_code,d.dept_name from Dept d";
It looks like that my query is getting all rows from table as Object.
What to do to
1. put some where clause
2. get some particular colums instead of all columns
3. apply some table joins in query
plz help.Hi Alex,
I misunderstood your question. You had mentioned "My list is getting populated with all of rows in my database table(dept). The problem is, I cant use where clause in my query string. "
I thought you might not have permissions to modify the code in the class, and that's why I suggested that you could write new classes.
1) write new classes,? means if I need just two columns from a table >(instead of all columns), do I need to write new class with just two >columns (getters and setters)?You can write a SQL statement anyway you want , there are no restrictions in JDBC , so if you need just 2 columns you can write a custom query for that.
"select column1 as a, column2 as be from table_name where column3 = xyz" etc.
2) Is not anyway to write SQL statement like
select dept_code,dept_name from dept where dept_name='anything'The above SQL is correct, it should work.
3) Stored procedures? can I get some example(code) to get an idea >how to implement complex queries with where clause and joinings >using stored procedures?Stored procedures are specific to the database you are using, Oracle has a particular syntax for store procdures.
You can call stored procedures from JDBC also, search on Google for
"Calling stored procedures from JDBC"
4) I m using hibernate. can I get any example of using hibernate own >query?Tutorial on Hibernate Query Language:
http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html -
Join query getting poor performance
Hi,
This is my join query to retriving data , i had a problem from this, its getting very slow to retrive data, even i used in report builder, it could not build the report.
From this select statement i've using three tables ,
please help and have suggestion to tune my query better fast and give some new idea , but i'm using oracle 8i.
select a.customer_code customer, c.name name, c.place place, a.product_code product, b.quantity ord_qty, nvl(b.delivery_district_code,c.district_code) district, nvl(b.delivery_town_code,c.town_code) town
from order_book a, order_book_detail b, customer c
where a.region_code = b.region_code
and a.order_book_form_no = b.order_book_form_no
and a.customer_code = c.customer_code
and c.division_code = 34
and a.region_code = 10
and c.state_code = 1
and a.order_book_form_date = '18-OCT-2007'
and nvl(c.classification_code,'N') = 'S'
order by 1;
regards
venkiwhy nobody answering me.Because you gave us nothing to investigate. Please read [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]this thread and post a tkprof output here. For an explain plan in 8i, you could "set autotrace on explain" in SQL*Plus.
Regards,
Rob.
Maybe you are looking for
-
Game Center crashes after ios 7.1 update
I just updated to ios 7.1 last night. I click on Game Center and I can see my profile but if I click on "Friends", "Games", "Challenges", etc on the bottom menu my screen goes white. I stay on the screen for a long time but it does not load or resolv
-
Why is Disk Utility so fast?
Hello, I formatted a 250 GIG drive (with the write zeros option) and it only took about 2 hours. Wow. Thats fast. In the past I used OS 9's "Drive Setup" utility and it used to take much longer. For example, the last time I formatted a drive with OS
-
Regarding Drill Down Reporting
Hai guys, could you please confirm what is the transaction for Drill down reporting tool. Expecting your reply. thanks. Ambichan Message was edited by: ambi chan
-
Hi Gurus, We have Hyperion System 9.3.3 with Reporting and Analysis components (IR) installed. If we want to move to EPM 11.1.2.1, is it an upgrade or migration? If migration, does Oracle provide any tools in 11.1.2.1 to seamlessly migrate the object
-
I have done upgrade to 8.1.2. Now iPad a iPhone will will not connect to iTunes, iCloud or do updates on apps.Shows message "unable to connect" or "error in connecting" as well as "unable to verify". How can this be sorted? Thanks