Extract Data from a View into multiple columns
fairly new sql person here, I have a question on extracting data from a View that I have created and formatting it in a way that the user needs.
My View has the following columns:
Account
Department
Budget
Spent
Values would be such as:
Account Department Budget Spent
1 A 1.00 1.00
1 B 2.50 1.45
1 C 3.00 4.00
2 A 4.00 1.00
2 B 2.00 1.00
What I'm wanting to do is extract the data out in the following format:
<dept> <account> 1 <account> 2
<budget> <spent> <budget> <spent>
A 1.00 1.00 4.00 1.00
B 2.50 1.45 2.00 1.00
C 3.00 4.00
basically dept as a column and then separate columns for each accounts budget and spent values going across
thanks!
Search for pivot queries in this forum.
However, you need to have finite number of accounts in Account column, otherwise output will be, i must say, non-readable and the query to be written would be unrealistic.
Similar Messages
-
How to extract data from generic view and function module
hi experts,
can anybody give me the steps to extract data from generic view and functon modules.
thanks and regards
venkathttps://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
https://websmp103.sap-ag.de/~sapidb/011000358700007535452002
Hope it Helps
Chetan
@CP.. -
How to extract data from info cube into an internal table using ABAP code
HI
Can Anyone plz suggest me
How to extract data from info cube into an internal table using ABAP code like BAPI's or function modules.
Thankx in advance
regds
AJAYHI Dinesh,
Thankq for ur reply
but i ahve already tried to use the function module.
When I try to Use the function module RSDRI_INFOPOV_READ
I get an information message "ERROR GENERATION TEST FRAME".
can U plz tell me what could be the problem
Bye
AJAY -
Unable to extract data from R/3 into BW 3.5
I have just started learning BW. I am currently trying to upload data from R/3 into BW. I have tried uploading data into InfoCube , ODS, InfoObjects from R/3 and in all cases I am getting error messages. Please shed some light as the what am doing wrong......below are the steps that I have done
For loading transaction data from R/3 in ODS
1. Created view from VBAP and VBAK tables in R/3
2. Created Transaction type DataSource in R/3 using RSO2 transaction
3. Replicated above DataSource in BW under Source Systems. using 'Replicate DataSource'
4. Created ODS object along the same lines as the above created view in R/3
5.Created InfoSource and assigned the replicated DataSource
6. Activated the Transfer Rules, Transfer Structure, Communivcation Structure
7. Created Update Rules for ODS and activated them
8. Created InfoPackage and started the Data Request
The error message that I see in Monitor is as below
Requests (messages): Everything OK
Data request arranged
Confirmed with: OK
Extraction (messages): Missing messages
Missing message: Request received
Missing message: Number of sent records
Missing message: Selection completed
Transfer (IDocs and TRFC): Errors occurred
Request IDoc : IDoc with errors added
Processing (data packet): No data
I am getting the same error message when I try InfoCube instead of ODS.
Please let me know what is wrong
VidyaI checked the 'Details' and 'Status' tab page in Monitor
On Status Page it says
Request still running
Diagnosis
No errors could be found. The current process has probably not finished yet.
System response
The ALE inbox of the SAP BW is identical to the ALE outbox of the source system
and/or
the maximum wait time for this request has not yet run out
and/or
the batch job in the source system has not yet ended.
Current status
No Idocs arrived from the source system.
On Details Tab page, it says
Requests (messages): Everything OK
Data request arranged
Confirmed with: OK
Extraction (messages): Missing messages
Missing message: Request received
Missing message: Number of sent records
Missing message: Selection completed
Transfer (IDocs and TRFC): Errors occurred
Request IDoc : IDoc with errors added
Processing (data packet): No data -
Extracting data from Essbase & loading into flat file through ODI
Hi,
I want to extract data from Essbase and load it into a flat file through ODI(for extraction from essbase I'm using a report script) and I’m using these KM’s:- LKM Hyperion Essbase data to SQL,IKM SQL to FILE Append & for reversing I’m using RKM Hyperion Essbase.All the mappings have been done and the interface has been made. But when I’m executing the interface it is throwing the error below:-
ODI-1217: Session ESS_FILEI (114001) fails with return code 7000.
ODI-1226: Step ESS_FILEI fails after 1 attempt(s).
ODI-1240: Flow ESS_FILEI fails while performing a Loading operation. This flow loads target table ESS_FILE.
ODI-1228: Task SrcSet0 (Loading) fails on the target FILE connection FILE_PS_ODI.
Caused By: java.sql.SQLException: ODI-40417: An IOException was caught while creating the file saying The system cannot find the path specified
at com.sunopsis.jdbc.driver.file.impl.commands.CommandCreateTable.execute(CommandCreateTable.java:62)
at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
at com.sunopsis.jdbc.driver.file.FilePreparedStatement.execute(FilePreparedStatement.java:178)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:619)
Please let me know what I'm missing and how I can resolve this error.
ThanksIt seems that you are trying to use the file as your staging areas. Hyperion LKM extracts essbase data into a DB staging area which can then be used by your file IKM to load it into file.
You need to use a RDBMS for your staging area. -
How to extract data from maintenance view
Hi experts,
How can I select the data from maintenance view. As you know select query doesn't work on the maintenance view. And View name will be known at run time only.
Thanks
Yogesh Gupta> Let me tell you that I am a SAP certified ABAP consultant having experience of 4.5 years.
I suspect that we will be hearing more comments about that.
> Whatever question I asked can't be replied with the basic training (if yes please tell me even one).
Debugging a macro?
Another one => FM or BAPI to create the Activity Group in 4.0B No answer is possible? You have to be joking!
And in How to get email ID fo a SAP user you obviously didn't even try Graham's answer!
> I closed some of the answered questions since I didn't get the answers for them for a long time and SDN site doesn't allow to keep more than 10 questions open.
The "comment field" is not mandatory. You don't need to flood the forum with your questions again.
> I do respect your concerns but I have no intention to abuse this site as it has been very helpful for me.
That is the most important part. Thank you. But you seem to be unaware of the "search" functionality.
If you can imagine that you are not the first person to ask a certain question, then you can be sure that someone else already has and you can find the answers on your own. If you still have doubts, then ask a specific question providing the details.
Based on your other questions, you are on release 4.0B. Is that still correct?
Cheers and thanks for responding,
Julius
Edited by: Julius Bussche on Jan 23, 2009 12:06 AM -
Error when extracting data from R/3 into BW
Hi,
There is an infoobject Payscale Level(Datsource 0paysclaelv_attr) in BW module HR that is extracting data from R/3. While extracting data, the following error occurs "Assignment to feature PFREQ did not take place". I debugged the standard function module HR_BW_EXTRACT_IO_PAYSCALELV and I believe there is definitely an error in the data. But Im not able to find out that record. Has anyone come across this error before? Please let me know if theres any solution to this error. The help for this error provides the following details. But I havent understood it. Any help would be greatly appreciated.
You can assign a specific operation (assignment) to each decision option
within a feature. You can also define decision option ** whose
assignment is effected for all unlisted decision options (this is known
as a default value).
Example:
o D PERSK
o K1 &ABRKS=D1, <- D1 for employee subgroup K1
o K2 &ABRKS=D1, <- D1 for employee subgroup K2
o K3 &ABRKS=D2, <- D2 for employee subgroup K3
o ** &ABRKS=D0, <- D0 for all other employee subgroups
If you now create employee subgroup K4 and the default entry ** is
missing, the system is unable to find a decision option for payroll area
ABKRS.
Procedure
Define a decision option for K4 or for default value **.Hi ,
The error is due to the existing customizing of feature PFREQ for MOLGA = 05, there the value to be returned depends on the WERKS, but apparently it was forgotten to add a new line for the "Otherwise" case.
Like it was already done for the case of MOLGA = 03, for example. Please add then a line for MOLGA = 05 and "Otherwise" and the issue should be solved.
If this doesnot solves your issue , then kindly check these OSS notes :
1033423 -> 0PAYSCALELV_ATTR: Short dump feature_error
842212 -> 0PAYSCALELV_ATTR: DataSources deliver wrong results
92055 -> RP_FROM_PERIOD_TO_PERIOD: FEATURE_ERROR dump
Regards,
Lokesh -
How can you add data from a variable into a column in a data flow?
I need to populate a table with data from a variable. The data type of the variable is String. I'm running into issues doing it the way I am. I have variable
User:VariableName = "Some moderately sized string of data"
When I try to use a Derived Column Transformation Editor to insert the variable into the data flow as a new column, SSIS forces the Data Type to be Unicode String[DT_WSTR] and I can't change it. Additionally the length is 0 and I also can't change that.
When I run the package it errors with a truncation error. If the length is 0 then that makes sense but then why can't I change it to something that makes more sense?
What is the correct way to go about this?Use advanced editor to change data type and length.
http://www.sureshjoshi.com/development/ssis-string-variables-in-derived-columns/ -
How to get data from maintaince view into internal table
Hi,
I want to get the all data from v_t179 (maintanence view) into intrenal table.
if i write select stmt , it is giving error.
I want all data into internal table.
regards,
AjayI think this is what you want:
TABLES: t179, t179t.
DATA: v_t179_int TYPE TABLE OF v_t179.
SELECT * FROM t179
JOIN t179t ON
t179~prodh = t179t~prodh
INTO CORRESPONDING FIELDS OF TABLE v_t179_int.
Rob -
Extract data from a cube into an excel
Hi All,
I am new to sap BI .
How i can extract content of a cube into an excel sheet with a request id?
Thanks in advance,
Aparna.Goto RSA1 --> InfoProvider
Right Click on your InfoCube --> Manage
then Select the Content Tab and Click on InfoCube Content
Select the fields you want to get in your excel o/p file ( include the Request id field which u want)
change max no of hits from 200 to blank or some greater value
Execute it (press F8)
U ll get the o/p on your screen, next is to take it in excel file.
Press on local file icon ( or Press CTRL + SHIFT + F9 ) , then select radio button Spreed Sheet
Regards,
Vinod -
Extract program to extract data from SAP into multiple worksheets of excel
Hi , I am currently facing an issue.
Extracting the data during data extraction, conversion into an excel and also into multiple worksheets withing a excel file.
What is the function which can help me. Also how do you give refernce to multiple worksheets to be created withing a excel file (which is the destination)
Any sample program extracting data from SAP tables into a excel with multiple worksheet will be of immense help
Please respond. Appreciate it.
Rgds
MadhuHi Madhu,
Here is the program for creating the excel file and creating the multiple worksheets.
*& Report ZEXCEL_UPLOAD2
REPORT ZEXCEL_UPLOAD2.
INCLUDE ole2incl.
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
cells TYPE ole2_object.
CONSTANTS: row_max TYPE i VALUE 256.
DATA index TYPE i.
DATA: BEGIN OF itab1 OCCURS 0, first_name(10), END OF itab1.
DATA: BEGIN OF itab2 OCCURS 0, last_name(10), END OF itab2.
DATA: BEGIN OF itab3 OCCURS 0, formula(50), END OF itab3.
*START-OF-SELECTION
START-OF-SELECTION.
APPEND: 'Peter' TO itab1, 'Ivanov' TO itab2,
'=Sheet1!A1 & " " & Sheet2!A1' TO itab3,
'John' TO itab1, 'Smith' TO itab2,
'=Sheet1!A2 & " " & Sheet2!A2' TO itab3.
CREATE OBJECT application 'excel.application'.
SET PROPERTY OF application 'visible' = 0.
CALL METHOD OF application 'Workbooks' = workbook.
CALL METHOD OF workbook 'Add'.
Create first Excel Sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 1.
CALL METHOD OF sheet 'Activate'.
SET PROPERTY OF sheet 'Name' = 'Sheet1'.
LOOP AT itab1.
index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Value' = itab1-first_name.
ENDLOOP.
Create second Excel sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 2.
SET PROPERTY OF sheet 'Name' = 'Sheet2'.
CALL METHOD OF sheet 'Activate'.
LOOP AT itab2.
index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Value' = itab2-last_name.
ENDLOOP.
Create third Excel sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 3.
SET PROPERTY OF sheet 'Name' = 'Sheet3'.
CALL METHOD OF sheet 'Activate'.
LOOP AT itab3.
index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
SET PROPERTY OF cells 'Formula' = itab3-formula.
SET PROPERTY OF cells 'Value' = itab3-formula.
ENDLOOP.
Save excel speadsheet to particular filename
CALL METHOD OF sheet 'SaveAs'
EXPORTING #1 = 'c:\temp\exceldoc1.xls' "filename
#2 = 1. "fileFormat
Closes excel window, data is lost if not saved
SET PROPERTY OF application 'visible' = 0.
**Quick guide to some of the OLE statements for OLE processing in this program as well as a few other ones.
Save Excel speadsheet to particular filename
CALL METHOD OF sheet 'SaveAs'
EXPORTING #1 = 'C:\Users\dprasad\Desktop\excel_sheet.xls' "filename
#2 = 1. "fileFormat
Save Excel document
CALL METHOD OF sheet 'SAVE'.
Quits out of Excel document
CALL METHOD OF sheet 'QUIT'.
Closes visible Excel window, data is lost if not saved
SET PROPERTY OF application 'visible' = 0. -
How to extract data from 12 tables ?
Hi experts,
I want to extract data from 12 tables into bi.
How can we do this. And also can we extract some fields from
a structure?
Full points will be assigned.
Regards,
V N.Hi,
First you need to check if the tables are standard tables or custom tables. If they are standard tables check which extractors are using those tables.
If they are not being used by any of the standard extractors then you you need to create generic datasource for the same. The same hold true for custom tables as well. For custom tables, you'll need to create generic datasource. If you search the forum for generic datasources you'll get a lot of information.
Its very important that you understand the table relationships, data volumes, if delta is possible or not, data granularity, etc for your datasource design.
Cheers,
Kedar -
How to extract data from custom made Idoc that is not sent
Hi experts,
Could you please advise if there is a way how to extract data from custom made idoc (it collects a lot of data from different SAP tables)? Please note that this idoc is not sent as target system is not fully maintained.
As by now, we would like to verify - what data is extracted now.
Any help, would be appreciated!Hi,
The fields that are given for each segment have their length given in EDSAPPL table. How you have to map is explained in below example.
Suppose for segment1, EDSAPPL has 3 fields so below are entries
SEGMENT FIELDNAME LENGTH
SEGMENT1 FIELD1 4
SEGMENT1 FIELD2 2
SEGMENT1 FIELD3 2
Data in EDID4 would be as follows
IDOC SEGMENT APPLICATION DATA
12345 SEGMENT1 XYZ R Y
When you are extracting data from these tables into your internal table, mapping has to be as follows:
FIELD1 = APPLICATIONDATA+0(4) to read first 4 characters of this field, because the first 4 characters in this field would belong to FIELD1
Similarly,
FIELD2 = APPLICATIONDATA+4(2).
FIELD3 = APPLICATIONDATA+6(2).
FIELD1 would have XYZ, FIELD2 = R, FIELD3 = Y
This would remain true in all cases. So all you need to do is identify which fields you want to extract, and simply code as above to extract the data from this table.
Hope this was helpful in explaining how to derive the data. -
How to extraxct data from a view.
hi,
i'm tying to extrct data from a view vbdka, with select. but i;m getting a syntax error that it anot a DB Table or DB view, pls tell me how to extract data from that view.
thanks.hi,
just check out if u have declared the table or not n see if it is not a structure also
madhuri. -
Error while extracting data from Generic datasource
Hello Gurus,
I have encountered an error "Errors in source system" with status red while extracting data from generic datasource into DSO.
I have done below things:-
1. Checked the jobs in source system, the job is successfully completed
2. The generic datasource is active and supporting delta with calender day in source system.
3. No TRfc error and no idocs stucked.
4. No short dumps in source system.
5. The delta queue(RSA7) is showing 0 with status as green.
6. Replicated the datasource On BW side and also activated the transfer rules by RS_TRANSU_ACTIVATE_ALL
The problem has not yet solved. Could you guys please suggest me what might be the reason for this error......
Thanks,
SonuHello,
I have used the generic delta using calender day.
Safety upper limit : - 1
Safety lowerr limit : - 0
I have made the entries in va01 transaction, but the delta queus is not getting updated which should show 1.
Do Generic extraction require any job to transfer data from Database table to delta queue.
We are not able to get the delta records on BW side. Please suggest.
Please suggest.
Thanks,
Sonu
Maybe you are looking for
-
Multiple sources to a single table
Hi, I have two seperate target tables from two seperate mappings. I need to determine the row count from the two tables and feed it in a seperate mapping to a single target table as two seperate attributes. My several attempts have resulted in the er
-
Custom color palette in WAD charts
Hi BI Experts, we are trying to create a custom color palette, which we want to apply to all your WAD charts. Can anyone tell us how to do this? Of course we can customize the colors in each chart, but that's a hell of a lot of work. Moreover, there
-
Help...Cut list don't match
We're about to use FCP and Cinema tool edit a film. Since it's our first time doing this, we are experimenting the workflow first. However, one problem has occured.When simulating the whole process(from importing the flex file to exporting the change
-
Camera Raw (Adjustment Brush - How do you select NO color?)
With the Adjustment Brush selected, there are six control channel parameters listed: Exposure Brightness Contrast Saturation Clarity Sharpness Color The Color control channel shows a color swatch, which displays the current color parameter setting: W
-
Cache Coordination 10.1.3
Hi, I am using Oracle 10.1.3 and using cache co-ordination using RMC here is the sessions.xml where I specify the attributes <remote-command> <commands> <cache-sync>true</cache-sync> </commands> <transport xsi:type="jms-topic-transport"> <topic-host-