How to select data from an aggregate in a customer exit for a query?
Hi,
I have written a virtual key figure customer exit for a query. Earlier the selection was from the cube, where there was severe performance issue. So I have created an aggregate, activated and have loaded the data.
Now when I select that data I find that the Key table is different in development and production. How do I resolve this.
My code is attached below. The table in developemnt is KEY_100027 and in production is KEY_100004. This code is activated and running in BW development server.
SELECT
F~KEY_1000041 AS K____035
F~KEY_1000271 AS K____035
F~QUANT_B AS K____051
F~VALUE_LC AS K____052
INTO (xdoc_date, xval1, xqty1)
UP TO 1 ROWS
FROM
FROM
*/BIC/E100004 AS F JOIN
/BIC/E100027 AS F JOIN
/BIC/DZMM_CGRNU AS DU
ON FKEY_ZMM_CGRNU = DUDIMID
JOIN /BI0/SUNIT AS S1
ON DUSID_0BASE_UOM = S1SID
JOIN /BI0/SCURRENCY AS S2
ON DUSID_0LOC_CURRCY = S2SID
JOIN /BI0/SMATERIAL AS S3
*ON FKEY_1000042 = S3SID
ON FKEY_1000272 = S3SID
JOIN /BI0/SMOVETYPE AS S4
*ON FKEY_1000043 = S4SID
ON FKEY_1000273 = S4SID
JOIN /BI0/SPLANT AS S5
*ON FKEY_1000044 = S5SID
ON FKEY_1000274 = S5SID
JOIN /BIC/D100004P AS DP
*ON FKEY_100004P = DPDIMID
ON FKEY_100027P = DPDIMID
WHERE
WHERE
( ( ( ( F~KEY_1000041 BETWEEN 20051230 AND 20060630 ) ) AND ( (
( ( ( ( F~KEY_1000271 BETWEEN 20051230 AND 20060630 ) ) AND ( (
S3~MATERIAL = <l_0material> ) ) AND ( (
s2~movetype BETWEEN '101' AND '102' OR
s4~movetype BETWEEN '921' AND '922' OR
s4~movetype BETWEEN '105' AND '106' OR
s4~movetype BETWEEN '701' AND '701' OR
s4~movetype BETWEEN '632' AND '632' ) ) AND ( (
S5~PLANT = <l_0plant> ) ) AND ( (
DP~SID_0RECORDTP = 0 ) ) ) )
GROUP BY
ORDER BY F~KEY_1000271 DESCENDING.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ENDSELECT.
How do I transport the code and make it work?
Whats the reason that the two key fields are different.
I had transported the aggregate from development to production. Activated it and filled the data.
What is the way out? Please help.
Regards,
Annie.
Hi Sonu,
The main task is to move the contents of the one internal table to another with some condition.
First sort and delete the duplicate entries from the First Internal table like below :
sort it_tab by material ascending date_modified descending.
delete adjacent duplicates from it_tab.
Then move that Internal table contents to another internal table.
Define another internal table with the same structure as you have first internal table and then
Second Step :
it_itab1 = it_itab.
If you are using seperate Header line and Body then you can do like below :
it_itab1[] = it_itab[].
This will fix the issue.
Please let me know if you need any further explonation.
Regards,
Kittu
Edited by: Kittu on Apr 24, 2009 12:21 PM
Similar Messages
-
How to select data from a table using a date field in the where condition?
How to select data from a table using a date field in the where condition?
For eg:
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = '31129999'.
thanks.Hi Ramesh,
Specify the date format as YYYYMMDD in where condition.
Dates are internally stored in SAP as YYYYMMDD only.
Change your date format in WHERE condition as follows.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = <b>'99991231'.</b>
I doubt check your data base table EQUK on this date for the existince of data.
Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and <b> bdatu <= '99991231'.</b>
Thanks,
Vinay
Thanks,
Vinay -
How to select data from a table by passing document number from another tab
How to select data from a table by passing document number from another table.
for eg:-
I want to display name, adres, region from ADRC table
by using field delivery document number
Kind Regards,
Shanbagavalli.SHi Shanbagavalli,
There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
**Consider that you have a Internal table having document number from other table..
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
**Consider that you have 1 document number then
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
WHERE DOCUMENT_NO = W_DOCUMENT_NO.
Hope this solves your problem.
Regards,
Kunjal -
How to select data from cluster table
hi experts,
I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
please advice.
maniHi Manikandan,
The following code may be helpful to understand how to select the data from cluster table.
Types: Begin of ty_kna1,
Kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_kna1,
begin of ty_bseg,
belnr type bseg-belnr,
kunnr type bseg-kunnr,
end of ty_bseg,
begin of ty_final,
belnr type bseg-belnr,
kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_final.
Data: it_kna1 type table of ty_kna1,
wa_kna1 type ty_kna1,
it_bseg type table of ty_bseg,
wa_bseg type ty_bseg,
it_final type table of ty_final,
wa_final type ty_final.
Select kunnr adrnr from kna1 into table it_kna1 where....
if sy-subrc = 0.
select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
endif.
sort it_kna1 by kunnr.
Loop at it_bseg into wa_bseg.
move wa_bseg-belnr to wa_final-belnr.
read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-kunnr to wa_final-kunnr,
wa_kna1-belnr to wa_final-belnr.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
Loop at it_final into wa_final.
write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
endloop.
Reward if useful.
Thankyou,
Regards. -
How to select data from structure
how to select data from structure
Hi Laxman,
Structure holds single record of data. You can acess data by using the syntax <b>Structure-field</b>
Please see sample.
data: wa_mara type mara.
select *
from mara
into wa_mara
up to 1 rows.
endselect.
write:/ wa_mara-mandt,
wa_mara-matnr,
wa_mara-maktl.
if helps plz reward points.
Regards
Bhupal Reddy -
How to select data from Maintance View in Program
Dear All ,
How to select data from Maintance View V_T052 in abap Program.
Regards,
ArchanaTABLES: t179, t179t.
DATA: v_t179_int TYPE TABLE OF v_t179.
SELECT * FROM t179
JOIN t179t ON
t179prodh = t179tprodh
INTO CORRESPONDING FIELDS OF TABLE v_t179_int.
Reward points... -
How to select data from one nested table and into another nested table
create or replace
TYPE ctxt_code_rec as object
ctxt_header varchar2(10),
header_description varchar2(300),
status varchar2(30),
adjacent_code varchar2(300),
adjacent_desc Varchar2(400),
adjacent_flag varchar2(4000),
adjacent_text_href varchar2(4000)
create or replace
type ctxt_code_table as table of CTXT_CODE_REC
d_table ctxt_code_table ;
v_tab ctxt_code_table ;
Iam trying to select data from d_table to v_tab
using and bulk collect into
select m.*
bulk collect into p_code_result
from table(l_loop_diag_code_table1)m
order by 1;
Receiving error:
ora 94007 : not enoughvalues
Could you please let me know how to solve it?
Thanks,
in advance>
create or replace
TYPE ctxt_code_rec as object
ctxt_header varchar2(10),
header_description varchar2(300),
status varchar2(30),
adjacent_code varchar2(300),
adjacent_desc Varchar2(400),
adjacent_flag varchar2(4000),
adjacent_text_href varchar2(4000)
create or replace
type ctxt_code_table as table of CTXT_CODE_REC
d_table ctxt_code_table ;
v_tab ctxt_code_table ;
Iam trying to select data from d_table to v_tab
using and bulk collect into
select m.*
bulk collect into p_code_result
from table(l_loop_diag_code_table1)m
order by 1;
Receiving error:
ora 94007 : not enoughvalues
Could you please let me know how to solve it?
>
Not unless you provide the code you are actually using.
There is no definition of 'p_code_result' in your post and you say you 'trying to select data from d_table' but there is no code that loads 'd_table' in what you posted.
And the SELECT query you posted actuall selects from an object named 'l_loop_idag_code_table1' which isn't mentioned in your code.
Post the actual code you are using and all of the structures being used.
Also explain why you even need to use nested tables and PL/SQL for whatever it is you are really doing. -
How to select data from cube by BAPI
Hi
now i want to select data from cube by selection
and the parameter is BAPI'S import.
I want to know how can i select data from which table the storage the cube's data
Thank you for your help !!Hi,
You can use FM: RSDRI_INFOPROV_READ.
BAPI_CUBE_GETDETAIL
Pls Check the below weblog
/people/dinesh.lalchand/blog/2006/06/07/reading-infocube-data-in-updatetransfer-rules
Regards,
CSM Reddy -
How to select data from view V_TCURR
Hi all,
how to fetch data from view V_TCURR.
I have to fetch 2 fieds: kursp and *tfact
(what does this * indicates in field name *tfact)The view is a maintenance view and it doesn't even have field tfact available.
Just select from the table directly
PARAMETERS: p_kursp for tcurr-kurst,
p_fcurr for tcurr-fcurr,
p_tcurr for tcurr-tcurr,
p_date for tcurr-gdate.
SELECT SINGLE
kursp
tfact
INTO ( lv_kursp, lv_tfact )
FROM tcurr
WHERE kurst eq p_kurst
AND fcurr eq p_fcurr
AND tcurr eq p_tcurr
AND gdatu le p_date.
Hope that helps,
Michael -
How to select data from struture
hello experts,
here i stuk am in smart forms where i want to populate the data from struture.
here in our comp there is no functional guy so i face bit problem to find a perticuler table but at last i found
a struture from where my problem can be resolve so can u tell me if i want to select data from struture
so how it is possible...
thanks in advance....Hi,
ST05 is the transaction used for tracing the SQL...for the particular time between Swtich on and Switch off..
If it is still difficult for you..
Then use this approach..
Go to the structure in SE12.
Then double click on the data element of the field you are looking for.
Then whereused list of the data element and search in tables..
You might get the tables that is using this data element..
Thanks,
Naren -
How to select data from a PL/SQL table
Hi,
I am selecting data from database after doing some screening i want to store it in a PL/SQL table (temporary area) and pass it to oracle reports.
Is there any way to select the data from a PL/SQL table as a cursor. Or is there any other way of holding the temporary data and then pass it back as a cursor.
Regards
KamalA PL/SQL "table" is anything but a table. Whoever came up with this term in PL/SQL to describe what is known as dynamic arrays (the correct programming terminology that existed since the 70's if not earlier and what is used in all other programming languages I'm familiar with)... well, several descriptions come to mind and none of them are complimentary.
You cannot "select" from a PL/SQL dynamic array as it is not a table within the Oracle context of tables.
Thus you need to convert (cast) a PL/SQL dynamic array into a temporary Oracle data set/table in order to select from it. This is in general a Bad Idea (tm). Oracle tables and SQL and concurrency controls and all that are especially designed for processing data. PL/SQL arrays is a very simplistic data structure with very limited usage. Why would you want to use that in SQL via a SELECT statement when you can use Oracle tables (or proper temp tables) instead? Besides that, it is also slow to cast a dynamic PL/SQL array into an Oracle SQL data set structure (context switching, copying of memory, etc).
The proper way to use PL/SQL to generate data sets for use via the SQL engine is pipelined table functions.
This is not to say that you should never use PL/SQL arrays and casting in SQL.. simply that you need to make sure that this is the correct and scalable way to do it. And that will also always be an exception to the rule when you do. -
How to select data from Sql server 2005 database tableinto oracle database table
Hi,
I have table text1 in sql server database and text2 in oracle database (11g). Now how to move data from SQL Server table into oracle table. So please help me how to do it.
Thanks a lot in advance.
rk
OS: Windows 7 professionalHi,
you can use export/import wizard and specify sql server as a source and oracle as destination.
I hope this is helpful.
Please Mark it as Answered if it answered your question
OR mark it as Helpful if it help you to solve your problem
Elmozamil Elamir Hamid
MCSE Data Platform
MCITP: SQL Server 2008 Administration/Development
MCSA SQL Server 2012
MCTS: SQL Server Administration/Development
MyBlog -
How to select data from 3rd row of Excel to insert into Sql server table using ssis
Hi,
Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.CUSTOMER DETAILS
REGION
COL1 COL2 COL3 COL4 COL5 COL6 COL7
COL8 COL9 COL10 COL11
1 XXX yyyy zzzz
2 XXX yyyy zzzzz
3 XXX yyyy zzzzz
4 XXX yyyy zzzzz
First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
Set range within Excel command as per below
See
http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
How to select data from another schema in Oracle-Sqldeveloper?
Hi,
I open two schemas, assumed schema1 and schema2, in SQL-Developer. In the SQL-Edit Area of schema1 I want to select data from schema2. So I did followings:
select * from schema2.table1;
But I got error message: 00942. 00000 - "table or view does not exist"
What could be the problem?Correct place for your question is SQL Developer (Not for general SQL/PLSQL questions)
Oh my bad.. Check previous post.. Its privilege issue.
Message was edited by: Karthick_Arp -
How get selected data from oracle data as per give input
sir i use Sun Java Studio Creator with oracle 10g
my direct want user give input through both listbox , textbox or string variable
how i pass this input in sessionbeen query and page give data in table as per user need
please give me step and code
this is urgent
thank'sYou would get hierarchical data from a functrion in the same way as you would any data. Create a function returning a cursor and then use your SQL statement to open the cursor. Very simplistically:
Create Function My_Func Return Sys_Refcursor As
l_cur Sys_Refcursos
Begin
Open l_cur For
'select EMPNO,ENAME,SYS_CONNECT_BY_PATH(ename, '/') "Path"
from EMP
start with MGR is null
connect by prior empno=mgr';
Return l_cur;
End;
Then, whatever calls the function would walk through the cursor an do whatever.
Jhn
Maybe you are looking for
-
Why would only the first line of my data set txt file work?
Hi - I had a lot of success using variables and external data sets until today. I have an external text file that I have imported as a data set (Image/Variables/Data Sets/Import...). All of the variables have been defined and confirmed (at least PSD
-
ICloud Email Issue: Messages sent to same account
Issue: When sending an email from my (personal-email)@me.com to the same account, with an attachment, email doesn't show up on any devices, even Apple mobile devices. Troubleshooting Attempts: - Sending emails on iMac machine with attachments from (p
-
Problem sorting list with virtual layout = false (and also with true)
Hi, I've a problem sorting a list... or better... I've a problem showing the sorted list ;-) I've a list of xml item. The list is shown with an item renderer. my needs: a button to refresh data and a button to sort data. useVirtualLayout = false -> r
-
I have implemented a BADI for Purchase requisition and in PROCESS_HEADER method of BADI Implementation for ME_PROCESS_REQ_CUST. I am trying to access account assignment lines on the purchase requisition (EKBN). IM_HEADER is the only parameter availab
-
Can you red flag an outgoing email on ipad
Does anyone know if you can flag an outgoing email on iPad?