SAP Query hierarchically
Hello guys,
I am trying to create a SAP Query from a join of 2 tables. One of them contains some document header, the other one, for that header several rows.
I would like to display the Query for that join, with alv grid or a abap list, or something... but hierarchically. First the info from the header, then (maybe indented) the multiple rows regarding that header.
Is there any way i cand do that?
Thanks,
Andrew
try this:
REPORT ytest .
TYPE-POOLS: SLIS.
TYPES: BEGIN OF TY_VBAK,
VBELN TYPE VBELN,
ERDAT TYPE ERDAT,
NETWR TYPE NETWR,
WAERK TYPE WAERK,
END OF TY_VBAK.
TYPES: BEGIN OF TY_VBAP,
VBELN TYPE VBELN,
POSNR TYPE POSNR,
ARKTX TYPE ARKTX,
NETWR TYPE NETWR,
END OF TY_VBAP.
DATA: W_VBAK TYPE TY_VBAK.
DATA: T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 1.
DATA: W_VBAP TYPE TY_VBAP.
DATA: T_VBAP TYPE STANDARD TABLE OF TY_VBAP INITIAL SIZE 1.
DATA: W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV.
CONSTANTS: C_VBAK TYPE SLIS_TABNAME VALUE W_VBAK.
CONSTANTS: C_VBAP TYPE SLIS_TABNAME VALUE W_VBAP.
DATA: W_KEYINFO TYPE SLIS_KEYINFO_ALV.
W_KEYINFO-HEADER01 = VBELN.
W_KEYINFO-ITEM01 = VBELN.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = VBELN.
W_FCAT-SELTEXT_M = ORDER NO.
W_FCAT-TABNAME = W_VBAK.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = ERDAT.
W_FCAT-SELTEXT_M = DATE.
W_FCAT-TABNAME = W_VBAK.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = NETWR.
W_FCAT-SELTEXT_M = ORDER VALUE.
W_FCAT-TABNAME = W_VBAK.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = POSNR.
W_FCAT-SELTEXT_M = ITEM NO.
W_FCAT-TABNAME = W_VBAP.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = ARKTX.
W_FCAT-SELTEXT_L = DESCRIPTION.
W_FCAT-TABNAME = W_VBAP.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = NETWR.
W_FCAT-SELTEXT_M = ITEM VALUE.
W_FCAT-TABNAME = W_VBAP.
APPEND W_FCAT TO T_FCAT.
SELECT-OPTIONS: ORDNO FOR W_VBAP-VBELN.
&SELEC HEADER DATA AND SORT-
SELECT VBELN ERDAT NETWR FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE T_VBAK
WHERE VBELN IN ORDNO.
SORT T_VBAK BY VBELN.
&SELEC ITEM DATA AND SORT-
SELECT VBELN POSNR ARKTX NETWR FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE T_VBAP.
SORT T_VBAP BY POSNR.
&REUSE_ALV_HIERSEQ_LIST_DISPLAY-
CALL FUNCTION REUSE_ALV_HIERSEQ_LIST_DISPLAY
EXPORTING
IT_FIELDCAT = T_FCAT
I_TABNAME_HEADER = C_VBAK
I_TABNAME_ITEM = C_VBAP
IS_KEYINFO = W_KEYINFO
TABLES
T_OUTTAB_HEADER = T_VBAK
T_OUTTAB_ITEM = T_VBAP.
reward if useful
Similar Messages
-
Problem with create universe on Business Objects XI 3.1 base on SAP Query
Hello,
I have a problem with create universe on Business Objects XI 3.1 base on SAP Query.
The problem is hierarchy. Massage on Busines Objects is :
OWBS_ELEMT__ISTKOSZT(cube ICPC01/BEX_ICOC01):Exception condition "HIERARCHY NOT FOUND" raised.(WIS 10901)
Query in BEX run OK.
Best regards.
Ela.Hello,
Thanks for response.
When I run BEX QUERY, all works OK.
All hierarchies was created and activated on system BW.
This situation appears after upgrade BW to SAP NetWeaver 7.3.
Before upgrade I created universe without any problems.
Regards Ela -
Creation of SAP Query in SQ02 with Single Table With Condition
Hi All,
I want to Create SAP Query in SQ02 using single Table MCHA.
ii) I dont want all entries of MCHA Table I mean , I have to apply some Condition on this Table.
i.e Suppose I am having actual data in MCHA table is like this for Material M1.
Plant Material Batch BatchCreationdate
P1 M1 B1 20.06.2007
P2 M1 B1 04.05.2009
P3 M1 B1 04.05.2009
But I want the Output of SAP Query is like this:
Material Batch BatchCreationdate
M1 B1 20.06.2007
That is irrespective of Plant if Material & Batch are equal ---> 1st record with Lowest date shoud get at the output.
Please help me How write the code on single table in the SAP Query.
Thanks,
Kiran ManyamHi,
Your query should be like this:
Select MATNR CHARG HSDAT
from MCHA
into table t_mcha
where matnr = Materlal number from selection screen.
The structure of t_mcha should contain the fields that you select.
Then sort the table by date ascending
Sort t_mcha by HSDAT.
Hope this solves your problem.
Thanks,
Sowmya -
Hello ABAP Guru
I need a help here. trying to create SAP query joining three table VBAK VBAP KONV since KONV being cluster table I am not able to do that
thpough I am suceesfully establishe dthe link
VBAK-VBELN=VBAP-VBELN
VBAK-KNUMV=KONV-KNUMV & VBAP-POSNR=KONV-KPOSN
OSS msg says we have to write routine in sap query
but I never used that option
anyone has any clue on how to use cluster table in SAP query?
Thx
PraveenHi,
Inner Join can't be used for cluster tables.
Write a routine in SAP query as follows.
do inner join on vbak,vbap into internal table
itab.
select for konv for all entries itab .
Regards
Amole -
How to call SAP query in a program
Hi experts
I have created a query in SQVI its gives a result. Now i want this query to be used in my program. Is there any FM which gets the quary name and populates the result in iternal table. So that i can use that result.
I know without query you can write using the tables you can fetch the records but i just want to explore a new way to do things. If any body done such type let me know and also give some sample code or process how to achieve it.
Regards
VijayHi Siva
My final option is that only. That you can do any how. But my intension is to learn something new way. How to do copy the query and where to inject the code is there any example in wiki or artical for that. I want to something new. Old way of creating a report program is possible i want to do this way. If some body could help me out.
@ karthik
I have generated the SAP query and i got the program but when i view the code i dont find any select statment or where storing my input data. How to identity that i did in debug mode but am not sure where it pulls the data and where it put in internal table. Can you throw some light with example code or an article.
Regards
Vijay -
SAP QUERY report for vendor line items
Hi
I have created a SAP QUERY report for vendor line items with fields vendor no.,vendor name,amount,company code and period.But there is one line item i donot know from wher system is getting it picked with is not in that vedor account,when i compare with fbl1n.I checked the document number too...the same doc number is twice in my query report.One with correct amount and another with wrong one.How do i chk.Where did i go wrong in creating query.I used logical database KDF.
Please advise.i chked...how do we get the amount displayed in query...it just displays amount no debit credit symbol... i have selected BSEG-DMBTR field but no -/+ sign,how is it done in query,please suggest.
-
Hello everyone,
I need some help in creating a report in SAP Query based on user's processing Vendor Invoices and also Vendor Payments?
I would like to have the following columns to report on:
USNAM u2013 User Name (from BKPF)
BLDAT u2013 Document Date (from BKPF)
BELNR u2013 Document Number (from BKPF)
BUKRS u2013 Company Code (from BKPF)
BLART u2013 Document Type (from BKPF)
LIFNR u2013 Vendor Number (from BSEG)
NAME1 u2013 Vendor Name (from LFA1)
WRBTR u2013 Amount (from BSEG)
Vendor Invoice- I would like to restrict to only document type fields that are KA,KR,RC,RE,RN and ZE
Vendor Payment- I would like to restrict to only document type fields that are ZV,ZS,ZP,ZH and KZ
I have a few questions:
First is i am using a logical database (BRM as BSEG cannot be joined) to select my columns however i do not know how to pull the 'Vendor Name' from LFA1. I understand that this table is not in BRM but is there a way to add any extra tables to work along side the logical database?
Secondly, i have managed to report on all columns except the vendor name (from LFA1) and although i can restrict my output data based on document type fields, i need the report to only show the user's that have process vendor invoices & vendor payments only?
At the moment i have a list of restricted document type but cannot seem to jsut show only those users who have processed both in both processes. For example User A has processed a vendor invoice (which is shown) and the same user may have processed vendor payment (after searching through the long output list!)
I want all users who have doen one of the other process and only interested in those that have done both?
Any feedback is much appreciated and pelase let me know if i have not explained this problem properly (as i am a newbie in this area)
Many thanks
AmarHi Pascal,
Since the IT2501 is a "Simulated Time Infotype" you cannot look at the data in it, but you can confirm the data from the ZL cluster and the data from the employee. Since it is only this employee or a few employees, it is probably not the configuration of the time buckets for the IT2501, but you may want to make sure all time times are captured as you want. Then look at the time entries for this individual or individuals. Did they enter a time type that was not expected or configured? Is all their time approved and passed through Time Evaluation? Finally check the Master Data for the employee - is the Planned Working Time (IT0007) infotype correct or has it been recently changed? Is he in a special Cost Center (IT0027) or Project that is captured differently for time purposes?
Since it just one or a few individuals, I would suspect the Master Data and some inconsistant entry that affects the time cummulation for the IT2501.
Paul -
How can I define Double Click Processing in SAP Query ?
The first question is : How Can I define drill-down for SAP Query report ?
The second one : How can I program Double Click in SAP Query report for Different columns like ALV Grid processing ?you can attach a repot or at tcode etc in an SAP query using report assignment in SQ01 but as far as i remember you cannot attach multiple reports.
regards,
khusro habib -
How to find the report for the SAP query (Query exists in table AQLQCAT)
Hello Experts,
I need to find the tables used in the SAP Query but i don't have access to transaction SQ01,SQ02 and SQ03 to check the same.
Therefore i checked table AQLQCAT and got the SAP Queries in the system. Then searched for the reports that would have been generated for the same passing AQusergroupquery name* in transaction SE38.
But unfortunately the program does not exists for the given paramenter.
Could you please let me know how to get the report name for the SAP Query.
Secondly please suggest any other way of checking the tables used in the SAP Query.
Also the table name from where i can download the SAP Queries.
Thanks in advance.
Regards,
Rahul SinhaI suggest you a simple method.
Execute the query. When the selection screen is showed, go to menu and click to SYSTEM->STATUS.
Check the program name and double click it to access the program code.
Search for tables or functions into the source code in order to understand where data are taken.
If you do not find anything , go to the program atttribute and check for logic database, sometimes they are used....
Best regards. -
SAP BW hierarchies into Microstrategy
Hi,
I'm just wondering if there is a way of bringing BW/BI Hierarchies into Microstrategy reporting.
We are planning to report in Microstrategy on top of a BW infocube with data. everything is OK except we can't bring SAP hierarchies into a Microstrategy report.
I appreciate if someone could shed ideas on this.
Hari Immadi
http://immadi.com
SEM BW AnalystImmadi,
In SAP BI Hierarchies are stored externally and not within the infocube. However for many Data Warehousing systems - the hierarchy is stored within the infocube. I am not sure if Microstrategy supports external hierarchies... -
Error 'Unable to open file' when downloading SAP Query to Excel
Hi all
I'm running a SAP Query which is set to download straight to a spreadsheet (Pivot Table / Microsoft Excel). Intermittently it does not work - apparently at random (at least, I've can't recreate the error at will).
It does one of the following:
- Works ok, and creates the pivot table
- Gives an Excel error message 'Unable to open file', then returns to the 'save the data in a spreadsheet' popup when enter is pressed on the error.
- Does not issue error message, just goes to the 'save the data in a spreadsheet' popup.
In the last two cases, the excel pivot table sheet is not created.
Has anyone seen anything similar, or have any idea as to what is causing the problem?
Any help gratefully received!
Not urgent as I've found a way round - further testing seems to show that I don't get the error is Excel is already open - but in the past I've run many SAP query downloads without needing to open Excel first. I suppose it's possible that this is just something to do with the Excel setup at the user site
Message was edited by:
E GregoryHi,
Ensure that file name with same name and in same path should not be open while saving the data.
Award if it helps.
Jogdand M B -
Sales Order Text Lines in SAP Query
I have a requirement to output several text lines into a SAP query based around sales orders.
I have included some code to read the details into my query and get no syntax errors, however the report gives a blank output for each of the text fields included, despite there definitely being some text with the specified attribute ID and text object in the table STXL.
Where am I going wrong?
Please find the coding below for one of the text field I'm trying to extract:
TABLES:STXL.
DATA:
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
TDNAME LIKE STXL-TDNAME,
MYLINE LIKE TLINE-TDLINE,
ZE18_LINE(1200) TYPE C.
DATA:BEGIN OF LINES OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA:END OF LINES.
DATA:BEGIN OF MYHEADER.
INCLUDE STRUCTURE THEAD.
DATA:END OF MYHEADER.
CLEAR TDNAME.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = VBAP-VBELN
IMPORTING
OUTPUT = VBELN.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = VBAP-POSNR
IMPORTING
OUTPUT = POSNR.
CONCATENATE VBELN POSNR INTO TDNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'ZAT2'
LANGUAGE = SY-LANGU
NAME = TDNAME
OBJECT = 'VBBP'
IMPORTING
HEADER = MYHEADER
TABLES
LINES = LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT FOUND = 4
OBJECT= 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
LOOP AT LINES.
MOVE LINES-TDLINE TO TEXT.
ENDLOOP.
ENDIF.Hi -
Please check in debuging.
check the value of TDNAME correctly populated with sales order no and sales order item.
You can cross check with the table STXH with TDNAME and see if any entries is available for TDID 'ZAT2' as your case.
Here are sample code.
DATA : lv_tdname TYPE tdobname,
lw_line TYPE tline,
li_line TYPE STANDARD TABLE OF tline.
CLEAR : lv_tdname , li_line[],
cocatenate w_vbak-vbeln w_vbap-posnr into lv_tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ZAT2'
language = 'E'
name = lv_tdname
object = 'VBBP'
TABLES
lines = li_line
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0.
CLEAR lw_line.
loop at li_line INTO lw_line .
* Put your logic
endloop.
ENDIF. -
Report from SAP Query due by universe
Guys,
I create universe based on SAP Query.
Now I want to build BO report.
So I connect a Universe drag to window my objects, but when I push Run Query I receive error:
A database error ocured.
The database error text is:
The MDX query SELECT { [Measures].[D4M5A7PITT7CVVVC8GMZS6QIH] } ON COLUMNS , NON EMPTY [WLENTITY].[LEVEL01].MEMBERS ON ROWS FROM [Z_ROSDOB/REP_20081202071548] failed to execute with the error See RFC trace file or SAP system log for more details. (WIS 10901)
I can easily build reports based on other queries or cubes.Hi Roman,
This is normally a connection issue when connecting to RDBMS rather than infocubes. a couple of questions
Is you universe set up to pass through the authentication or is it using a specific logon?
Does the user running the report have the appropriate responsiblities to run the query?
Regards
Alan -
How to display long text in SAP Query ALV layout? It only show 129 char now
I have a SAP Query which show a remark field(Max length more than 500 char), but it only show max length 129 char now. In fact, the lenght of remark field text is more than 300, and i had debug the source code, the field text value do is correct, its length do is 376.
Do anybody can help me solve the issue, let the query ALV layout can show the long text field value?
thanks very much in addvance.Hi,
ALV can show only a restrict value length around 128 characters, many experts said that we can not extend. many suggestions is split text into some column.
Regards, -
Error while creating report from BW SAP Query
Hi
While creating a report from BW SAP Query, I get the following error.
"An error occured while creating a report template.No error"
On opening the same query in BEx Analyser, i can see the fields and output.
Help me on this issue.
Thanks
Eswari.Hello Garett,
I've the same problem and have tried now to get the data with MDX-Query. The error message below appears:
'No RFC-authorization for function group /Crystal/MDX for User ...'
So it seems to be a authorization problem. Which special authorization must be assigned to Crystal users in SAP BI?
Thank you for your help.
best regards
Oliver
Maybe you are looking for
-
How do I delete an ICloud acct on IPhone when the old email address no longer exists?
I changed my Apple ID password due to a phishing email and it started a downward spiral of issues. My original ICloud email address no longer exists. I have tried to sign out/in in itunes that worked but I cannot delete the ICloud account because th
-
Oracle 9i Installation on Existing Oracle 8i on HP Unix 11.11
Hi Gurus, I need to Install Oracle 9i R2 with (9.2.0.6) Patch set on HP Unix Server. My concern is Oracle 8i running on the same server which is a production Database. What are the pre Installation steps I need to take before installing Oracle 9i R2
-
JTabbedPane : JPanel transparent to 2D drawings
Hi. I am using ptolemy/ptplot package for 2D graphics. I use a JTabbedPane to managae my plots by pages. Each plot is updated continuously by a Thread which get data from a datatbase. The problem: when a plot is refreshed in a hidden Tab, the plot ap
-
What is the box in mail app between the move icon and reply icon?
Hello, Just started using mail in the new ipad and see an icon in the inbox on the left handside in between the move icon and the reply icon. What is it and what does it do to a file? I clicked an old email on it and it seemed to have stored it or di
-
How do i sync song from a CD to my I-pod using windows media player
i really need help i would love to put my new Cd on to my I-pod i don't know how please help!!