Transpose Columnwise data to row wise date in 10g
Hi,
How can I transpose the below type of data to
ID MOTNH YEAR Pram1 Param2 Parm2
10000 11 2012 200 300 500
10001 11 2012 700 800 100
to
ID MONTH YEAR PARAMETER TARGET
10000 11 2013 Pram1 200
10000 11 2013 Pram2 300
10000 11 2013 Pram3 500
10001 11 2013 Pram1 700
10001 11 2013 Pram2 800
10001 11 2013 Pram3 100
Regards,
Tarun
Basic think in converting column to row is you need to know the number of columns up front. In your case its 3. Now you have to create a dummy table that will have three rows and cross join this with your original table. Then you need to manipulate your data with a DECODE or CASE statement.
below is an example.
with my_table
as
select 10000 id, 11 mth, 2012 yr, 200 prm1, 300 prm2, 500 prm3 from dual union all
select 10001 id, 11 mth, 2012 yr, 700 prm1, 800 prm2, 100 prm3 from dual
), cross_join_table
as
select level no
from dual
connect by level <= 3 -- This will change based on number of param columns in my_table
select id, mth, yr, decode(no, 1, prm1, 2, prm2, 3, prm3) prm
from my_table
cross
join cross_join_table
order by id, mth, yr, no
Similar Messages
-
How to display the data in row wise in smartform
Hi,
I have to make a modification a smartform of poprinting and i want to display the row wise . At present it is displaying the
column wise. Actually there is a text which i want to display the data row wise.
It is possible to display the data in row wise of the text .
Edited by: nav009 on Oct 8, 2009 10:39 AMHello ,
I assume that your requiremen is related to smartform.the below is the solution i suggest.
As per my understanding of your requirement ,It's clear that as of now there is some description field which is also getting displayed along with other PO fields.
However you would like to display the description field in a new line since the length of this field is longer than other fields as a result the data is getting scattered .
Therefore one better option could be: since the whole data from PO would be in a loop you can display all other fields in one line type of the table as per the intial requirement and you display the description line alone in a new line type wth the desired length so that data would not be scattered and no data loss would happen.
I assume you are aware of creating of line types for table.
Thanks
M.Naveen. -
Output data in row wise instead of column
hi all,
i need to get the output data in row wise which is getting now as column wise.
for eg:
below is my final internal table.
HEADING DATE MATNR BUKRS DMBTR
jan/08 200801 567 10 800
feb/08 200802 567 10 900
mar/08 200803 567 10 200
apr/09 200804 567 10 400
the output should come as
MATNR BUKRS Jan/08 Feb/08 Mar/08 Apr/08
567 10 800 900 200 400.
instead of column wise the output should display as row as above.
please help how to get this.
thanks in advanceHi Vignesh,
Please use below program which I created for you reference. It will work for your requirement.
DATA:BEGIN OF it_test OCCURS 1,
date(6),
matnr(5),
bukrs(3),
END OF it_test.
it_test-date = 'jan/08'.
it_test-matnr = '01234'.
it_test-bukrs = 'AE1'.
APPEND it_test.
it_test-date = 'feb8'.
it_test-matnr = '56789'.
it_test-bukrs = 'AE1'.
APPEND it_test.
it_test-date = 'mar8'.
it_test-matnr = '23478'.
it_test-bukrs = 'AE1'.
APPEND it_test.
START-OF-SELECTION.
LOOP AT it_test.
WRITE :/ 'DATE', 'MATNR', 'BUKRS', it_test-date, it_test-matnr, it_test-bukrs .
ENDLOOP.
Output Will be as follows :-
DATE MATNR BUKRS jan/08 01234 AE1
DATE MATNR BUKRS feb8 56789 AE2
DATE MATNR BUKRS mar8 23478 AE3
Please set to resolve if this satisfies your requirement.
Regards
Abhii.. -
How to transpose the data records (rows) to column(lists) using apd
Hi,
how to transpose the data records (rows) to column (lists) using apd in sap bw.
I do not want to use abap routine.only use the transpose rows to list transformation .
Pls provide the step by step procedure .
thanks,
NimaiSave youe file to transpose as a csv and in the header row of your file for the columns you want to transpose you need to put some soer of a tag before the column name (ie your colum header was for a period budget will be something lie 2011001:ZFIBDD)
1. You will need to create a new apd process (rsanwb)
2. Insert a "Read from Data File" data source object and map it file (,csv)
3. insert a transpose object into your apd process (middle row 4th one over in the transformations section)
4. under the definition tab in the transformation object select all the columns that are to be transposed into rows and move them to the transformed area, the grouping fields section should contain the rows that you want to now be columns
5.under the transformation tab enter in the seperator you selected under the Field Name/Infoobject area (ie. ZFIBDD)
6. under the details tab you need to enter in all the fields to be transformed and tner the transposition field (ie ZFIBDD)
7. Then you can insert a set of transformations and a DSO and link the newly transposed fields into that.
hope that helps -
Need help in some what complex transpose of data...
Dear Team,
I need a small help, to transpose the data...
The Input data is shown below...
Product
Level
Position
Route
1st_Prod_id
Request_Flag
Qty
99904228
LEVEL_1
1
1
828452
Y
0
96500436
LEVEL_2
2
1
828452
N
1
96500437
LEVEL_2
3
1
828452
N
1
96500437
LEVEL_3
4
1
828452
N
2
66500084
LEVEL_3
5
1
828452
Y
0
67653972
LEVEL_3
6
1
828452
N
2
47418545
LEVEL_4
7
1
828452
Y
0
47418545
LEVEL_5
8
1
828452
N
0
35264043
LEVEL_5
9
1
828452
N
2
37411616
LEVEL_5
10
1
828452
N
0
35264044
LEVEL_6
11
1
828452
Y
2
The output format is shown below along with transpose logic...
Dmd_Product
From_Prod
From_Level
To_Prod
To_Level
Total_QtY
99904228
99904228
LEVEL_1
66500084
LEVEL_3
4
99904228
66500084
LEVEL_3
47418545
LEVEL_4
2
99904228
47418545
LEVEL_4
35264044
LEVEL_6
4
1. Depending upon the Req_Flag = 'Y', we have to identify our from_product - to_product, & from_level - to_level...
2. Between from_product - to_product we have to sum up the quantity (QTY)
3. The position 1 product should remain as it throught out the transformation and shown under new column Dmd_Prod
4. Between Position 1 and Position 5 we have 2 Req_Flag --> One req_flag = 'Y' at pos = 1 and another req_flag = 'Y' at pos = 5
So my From_Product will be product as pos = 1 and to_product will be product at pos = 5...
5. The same iteration goes on and my product at pos = 5 becomes my from_product and another item at pos = 7 becomes to_product... and so on...
I hope i am clear in my explanation...
please give me some hints or tips how to solve it...
Attached is the create table statement for sample data...
Create Table test As
(Select 99904228 prod, 'LEVEL_1' l_level, 828452 first_prod_id, 1 position, 1 route, 'Y' req_flag, 0 qty From dual Union All
Select 96500436 prod, 'LEVEL_2' l_level, 828452 first_prod_id, 2 position, 1 route, 'N' req_flag, 1 qty From dual Union All
Select 96500437 prod, 'LEVEL_2' l_level, 828452 first_prod_id, 3 position, 1 route, 'N' req_flag, 1 qty From dual Union All
Select 96500437 prod, 'LEVEL_3' l_level, 828452 first_prod_id, 4 position, 1 route, 'N' req_flag, 2 qty From dual Union All
Select 66500084 prod, 'LEVEL_3' l_level, 828452 first_prod_id, 5 position, 1 route, 'Y' req_flag, 0 qty From dual Union All
Select 67653972 prod, 'LEVEL_3' l_level, 828452 first_prod_id, 6 position, 1 route, 'N' req_flag, 2 qty From dual Union All
Select 47418545 prod, 'LEVEL_4' l_level, 828452 first_prod_id, 7 position, 1 route, 'Y' req_flag, 0 qty From dual Union All
Select 47418545 prod, 'LEVEL_5' l_level, 828452 first_prod_id, 8 position, 1 route, 'N' req_flag, 0 qty From dual Union All
Select 35264043 prod, 'LEVEL_5' l_level, 828452 first_prod_id, 9 position, 1 route, 'N' req_flag, 2 qty From dual Union All
Select 37411616 prod, 'LEVEL_5' l_level, 828452 first_prod_id, 10 position, 1 route, 'N' req_flag, 0 qty From dual Union All
Select 35264044 prod, 'LEVEL_6' l_level, 828452 first_prod_id, 11 position, 1 route, 'Y' req_flag, 2 qty From dual
Regards
nic..Maybe
select dmd_product,
from_product,
from_level,
to_product,
to_level,
total_qty,
agg_yield
from (select position,
dmd_product,
case when to_flag = 'Y' and lag(from_flag,1) over (order by position) = 'Y'
then lag(from_product,1) over (order by position)
end from_product,
case when to_flag = 'Y' and lag(from_flag,1) over (order by position) = 'Y'
then lag(from_level,1) over (order by position)
end from_level,
to_product,
to_level,
total_qty,
case when total_qty is not null
then yield
end agg_yield
from (select position,
first_value(dmd_product ignore nulls) over (order by position) dmd_product,
from_product,
from_level,
to_product,
to_level,
case to_flag when 'Y'
then total_qty -
lag(total_qty,1) over (order by position) +
lead(qty,1) over (order by position)
end total_qty,
case when to_flag = 'Y'
and lead(to_flag,1) over (order by position) = 'N'
then yield
else yield * lead(yield,1) over (order by position) / 100
end yield,
from_flag,
to_flag
from (select position,
case when req_flag = 'Y'
and position = (select min(position)
from test
where req_flag = 'Y'
then prod
end dmd_product,
prod from_product,
l_level from_level,
req_flag from_flag,
lead(prod,1) over (order by position) to_product,
lead(l_level,1) over (order by position) to_level,
lead(req_flag,1) over (order by position) to_flag,
qty,
sum(qty) over (order by position) total_qty,
last_value(nullif(yield,100) ignore nulls) over (order by position) yield
from test
where from_flag != 'N'
or to_flag != 'N'
where dmd_product is not null
where from_product is not null
order by position
DMD_PRODUCT
FROM_PRODUCT
FROM_LEVEL
TO_PRODUCT
TO_LEVEL
TOTAL_QTY
AGG_YIELD
99904228
99904228
LEVEL_1
66500084
LEVEL_3
4
92
99904228
66500084
LEVEL_3
47418545
LEVEL_4
2
90
99904228
47418545
LEVEL_4
35264044
LEVEL_6
4
97.02
Regards
Etbin -
Row wise total in editable ALV
hello all,
I am workin on editable alv, the user need to enter the values in the editable fields and in the last column(non-editable) i need to populate the total row wise,as soon as user enters a value and goes to next editable cell or on entering a vale and press enter.how to accomplish this task...
with regards,
sandeep akella.
Edited by: sandeep akella on Aug 20, 2009 1:58 PMYou need to Implement the OnCellAction event.follow these steps;
1. Goto WDDOMODIFYVIEW and place the following code
IF first_time IS INITIAL.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usg_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_usg_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
EXPORTING
value = abap_true.
ENDIF.
2. Implement the onCellAction event as follows;
Goto Methods tab, create a new method. Method Type- Event Handler , Event - ON_CELL_ACTION
3. Now in this method retrive the contents of the row and calculate the value as follows.
DATA: l_element TYPE REF TO if_wd_context_element.
DATA:ls_stru TYPE wd_this->element_cn_alv.
DATA: l_node TYPE REF TO if_wd_context_node.
l_node = wd_context->get_child_node( 'CN_ALV' ).
l_element = l_node->get_element( r_param->index ).
l_element->get_static_attributes( IMPORTING static_attributes = ls_stru ).
ls_stru-last_col = ls_stru-col1+ls_stru-col2....+ ls_stru-col5. " add all the cells data
l_element->set_static_attributes( exporting static_attributes = ls_stru ). -
Regarding Logical level key and row wise initialization
Hi Gurus,
What is the purpose of row wise initialization in external table authentication and when we have to go for row wise initialization.
Why we have to enable logical level key in hierarchy is this only for getting drill down to the next level if we make two columns as logical level key what will happens. If we want to enable a column as a logical level key what are the character sticks that column should satisfy.
Thanks,1) Row Wise Initialization used to hold multiple values in a variable. Let says SQL gives 4 rows (A,B,C,D) as output. Now I want to hold 4 value in a variable to get this happen we need to go for RowwiseIniziation. If you do not do this at any point in time Variable holds only value A not others. Simply it works as Array.
2) Level keys define the unique elements in each level and provide the context for drill down. You can make two logical columns as logical key but you need to make sure what to be displayed in your hierarchy by selecting DISPLAY. If you make to as separate logical keys and set Display for both you get two columns in the hierarchy
http://gerardnico.com/wiki/dat/obiee/hierarchy_level_based -
How 2 Change of column wise o/p to row wise output in ABAP?
Hi all,
I am getting the output in column wise as normally but how can I get the ouput in row wise.in ABAP.
its urgent. can any one help me how to change the output layout?
thanks in advance,
Sakthi.Cif it is normal report .then
go through the write statents . one of that is below
Loop at itab .
write : itab .
endloop.
if it is ALV then you have to define an internal table which are the fieldds you want palce in the Row .
so that
data c type i value '1'.
loop at itab .
fieldcatalog-fieldname = itab-field.
fieldcatalog-col_pos = c.
append fieldcatalog to fieldcatalog.
clear fieldcatalog
c = c + 1.
endloop.
so that the Col_pos will be increased and the Column data will be moved into Row .
reward points if it is usefull...
Girish -
How to display 7 values of single field in row wise.
hi,
how to display 7 values of single field in row wise.
thankx in advance.hi ,
do it like this :
1 Place ur UI element in tranparent container with Layout as Row Data and Layout Data as Row Head Data
2 Ur first UI , which contains the first value as Row Head Data ,
3 Others as Row Data
u can do it with Matrix Data as well
if u want to give space , u can use HORIZONTAL GUTTER and set its width to medium / large / Xlarge
also there is a UI element "INVISIBLE ELEMENT" ,
1 u can use this UI element to provide space between ur other UI elements in the view
2 u can insert a text element as well , and in the Text property of the element press ALT + 0160.
u can give the space bw UIs as desired.
regards,
amit -
Hi Gurus,
What is the use of row wise initialization when we have go for this can i have one scenario for better under standing.
Thanks,Check these
http://gerardnico.com/wiki/dat/obiee/row-wise
http://docs.oracle.com/cd/E12103_01/books/admintool/admintool_Variables6.html
http://obiee10grevisited.blogspot.com/2012/03/row-wise-initialization.html -
Row-Wise Session Variable Initialization Block (Max Rows)
Hi, we have a problem with Row-Wise Session Variable.
We'll try to implemented the security with a External Query and a Row-Wise Initialization Block. But when we'll try to open the Web Obiee and the rows of result of the query is more than 3000 rows, the browser is broken. The access is very slowly.
When the result of Query to Row-Wise Variable is more than 3000 rows and we'll try to open the Web Obiee, we have to close NQServer.EXE process of Obiee Server.
Is there a best practise or a limit rows in the Row-Wise Initialization Block?.
Thanks.You're Right, the people can't be in 3000 groups.
Is possible I don't explain my problem correctly.
We use this Row-Wise Variable for implement Data Level Security. .
For Example :
I have a fact table with Offices and Office's Sales.
And each Obiee User can see many Offices according to their level of security.
I want filter the fact table using a external SQL table implemented in a Session Row-Wise Variable and a User can have X Offices (In the worst case, 3000 Offices). -
Accessing Row-Wise Initialization variable in OBIEE Answers 11g
Hi All,
I need to access row-wise initialized session variable in answers fx section, i came to know from following blog
http://carpediemconsulting.wordpress.com/
that i can use VALUELISTOF(NQ_SESSION.ROW-WISE-VAR)) function to get the list of values in answers, but i m getting syntax error in obiee 11.1.1.3
Any work arounds for this. Please help!!
Thanks,
SreekanthYou can't, it's only intended for use in the RPD initblocks, it's mainly used to restrict data acces:
http://www.orastudy.com/oradoc/selfstu/fusion/doc.1111/e16816/biapps_security.htm
regards
John
http://obiee101.blogspot.com/
http://obiee11g.com/ -
Row-wise Initialization: Use caching
We have the 'Use Caching' check box available for row-wise initialized system variables. Although I do understand how this is useful as it shortens the login time for users who have logged in before by initializing the session variable from the cache instead of firing the query on the database everytime, I need to understand how this cache mechanism works especially when the overall server caching is disabled.
I have faced a situation where the session variable was initialized from the cache although the server caching was disabled. Is there any way to purge this cache or set a refresh frequency? As of now I had to uncheck the 'Use Caching' check box to fetch the refreshed results in the session variable. But I believe this is undesirable in the long term.
Thanks,
GauravHad thought so. But then it means that you can use row-wise initialization with caching, only when the underlying data is never going to change. Restarting the BI server is not a viable option to clear the cache in systems which require 100% availability.
But any ways, thanks for the input Dhar.
Thanks,
Gaurav -
Row wise Initialization - "Session Variable has no value Definition"
Hi,
I have gone through other posts relating to this error, but could not find a solution.
I have defined an initialization block with 'Data Source' as SELECT 'TEST_VARIABLE', cost_center from XX_COST_CENTER.
In the 'Edit Data Target', i have selected the 'Row Wise Initialization' option.
When i 'Test' this initialization block, using the 'Test' button, i get the exected output, with all the different Cost Centers being defined.
However, in the Presentation Services when i add a column and change its formula to VALUEOF(NQ_SESSION.TEST_VARIABLE), i get an error
+[nQSError: 23006] The session variable, NQ_SESSION.TEST_VARIABLE, has no value definition.+
Would appreciate some input, to check if i have missed any steps, or am doing something wrong
Thanks & Regards,
Ab
Edited by: obiee_user_ab on Jan 16, 2012 6:25 AMHi,
Error is caused because no value is returned from the sesision variable for the logged in user, you may check the NQquery.log file to see if the initblock was successfull and if that returned any rows, try setting default value in the session variable
It might also happen when
1. You created the variable as Repository variable in RPD and referring as session variable in Answers
2. It may also happen when you are referring the Session variable Name wrongly in Answers. E.g "Current Week" in RPD (2 Words) and CurrentWeek in Answers (Single word).
Try to use the same letter case for the name of the variable (upper and lower).
Hope this helps.
Regards
MuRam -
OBIEE 11.1.1.6.2 Row Wise Init for Roles variable
Gurus,
Why is the NQ_SESSION.ROLES ( Row Wise Initialized ) behaving differently when compared to other Row Wise initialized session variables.
I am using EBS Authentication and Authorization for OBIEE, so my authorization query is
SELECT DISTINCT 'ROLES', RESPONSIBILITY_KEY
FROM FND_USER,FND_USER_RESP_GROUPS, FND_RESPONSIBILITY_VL
WHERE FND_USER.user_id=FND_USER_RESP_GROUPS.user_id
AND FND_USER_RESP_GROUPS.RESPONSIBILITY_ID = FND_RESPONSIBILITY_VL.RESPONSIBILITY_ID
AND FND_USER_RESP_GROUPS.RESPONSIBILITY_APPLICATION_ID = FND_RESPONSIBILITY_VL.APPLICATION_ID
AND FND_USER_RESP_GROUPS.START_DATE < SYSDATE
AND (CASE WHEN FND_USER_RESP_GROUPS.END_DATE IS NULL THEN SYSDATE ELSE TO_DATE(FND_USER_RESP_GROUPS.end_Date) END) >= SYSDATE
AND FND_USER.user_name = 'VALUEOF(NQ_SESSION.USER)';
Now I plan to use these Roles( EBS Responsibility name) which I have populated in a DB table against some Cost Center and below is the how I view the data in DB.
ID | PROFIT_CENTER | RESPONSIBILITY
0 | 0 |0
1 | 100 |BI_Fin_Role
2 | 200 |BI_P2P_Role
3 | 300 |BI_Inv_Role
Then my Profit Centers Initialization Block is now
SELECT DISTINCT 'PROFIT_CENTER', PROFIT_CENTER FROM WC_OBIEE_PC_SECURITY WHERE RESPONSIBILITY IN (VALUELISTOF(NQ_SESSION.ROLES))
So User1 has BI_Fin_Role and PC_Security Role so does the User2 has BI_Inv_Role and PC_Security now when User1 logs in they should see only 100 Profit center data and User2 should see only 300.
I have created data filter for that application role (PC_Security) and limiting with "Dim.Profit Center"."Profit Center" = VALUEOF(NQ_SESSION."PROFIT_CENTER")
However first problem I encounter is there is no value definition for PROFIT_CENTER, snap that means the VALUELISTOF(NQ_SESSION.ROLES) value is not being passed or recognized by whenever BI Server sends that query to DB.
This is confirmed by my query log which says:
[2013-04-29T12:49:06.000+00:00] [OracleBIServerComponent] [TRACE:5] [USER-39] [] [ecid: 11d1def534ea1be0:48033065:13e4213bbd0:-8000-0000000000008dc8] [tid: 47796940] [requestid: fffe0313] [sessionid: fffe0000] [username: ] -------------------- An initialization block named 'PC_Security', on behalf of a Session Variable, issued the following SQL query: [[
SELECT DISTINCT 'PROFIT_CENTER', PROFIT_CENTER FROM WC_OBIEE_PC_SECURITY WHERE RESPONSIBILITY IN (VALUELISTOF(NQ_SESSION.ROLES))
Returned 0 rows. Query status: Successful Completion
So I try to issue the SQL to BI Server thru Issue SQL Directly:
SELECT "Profit Center"."Profit Center" FROM "SLA Details" WHERE "Profit Center"."Profit Center" = VALUEOF(NQ_SESSION.ROLES)
and the query log gives be the below log which blew my mind as its being delimited by ';'
select distinct T1260626.ACCOUNT_SEG3_CODE as c1
from
W_GL_ACCOUNT_D T1260626 /* Dim_W_GL_ACCOUNT_D */
where ( T1260626.ACCOUNT_SEG3_CODE = 'BIAuthor;BIConsumer;PC_Security;BI_Fin_Role;AuthenticatedUser' )
I have other Row Wise Init blocks for HR_ORG which when fired and used in reports give be stings ('1000','2000',...) which is what I was expecting to see in the filter and query here.
Am I doing something wrong here can someone please point me to right direction please.
Any help is much appreciated.
Thanks,
VidyaS
Edited by: VidyaS on Apr 29, 2013 2:47 PMThis is because the ROLES variable in OBIEE 11g is designed to retrieve the LDAP or DB groups etc.. in form of semicolon delimiters this would be not the same case with other Row Wise init blocks.
Refer to : OBI 11g - LDAP and semicolon-delimited string for Groups [ID 1274964.1]
HTH,
SVS
Maybe you are looking for
-
Image Preview not working in Dreamweaver CC
I recently switched from Dreamweaver CS5 to Dreamweaver CC and my images don't preview in Dreamweaver CC interface "Design" mode/tab at all. My images are hosted at an Adobe Scene7 URL that I know the image path is correct because it works when I pre
-
The bottom navigation pane in iTunes is gone, how do i get it back
Since the last program update, My iTunes window is too long (up and down) to fit on the monitor and the lower navigation pane is off of the screen. Does anyone know how to re-size the window so it will fit?
-
Basically I've a table that needs to link to three other tables. As far as I can tell Designer will only let me have the foreign keys on seperate columns; Column_1 - FK1 Column_2 - FK2 Column_3 - FK3 I think it's a much better database design is to h
-
Is there a Web-Interface to configure Time Capsule?
Every router has a web interface to configure it from any locally connected computer independent from what computer or OS you are using (Mac, Windows PC, Linux, etc...). So far, as I figured out, Time Capsule can only be configured via the AirPort Ut
-
Insérer de façon précise une valeur dans un fichier tableur
Bonjour, J'utilise le VI "écrire dans un fichier tableur" dans une structure séquence pour enregistrer une acquisition. dans un premier temp, Mon VI écrit l'entête du fichier de mesures contenant diverses informations, ensuite les valeurs sont écrite