Help in sql trace for vf03
Hi,
i was tracing the sql statments present in vf03 transaction for the invoice no.'s with accounting document over all status as not clear.
i want to know the flow of the sql statements right from the user giving the invoice no. as input to the document flow window to know from where and how it is picking the accounting doucment over all processing status
waiting for ur replies
regards,
maqsood
Hi
You should look at the code of std fm RV_ORDER_FLOW_INFORMATION, here you can see all selects the system does.
Anyway the tables are VBFA (document flow), VBUK and VBUP. But you can't find that information here, because it's only in accounting not in sales.
So perhaps the abap code you're looking for it's this:
if vbrk-vbeln <> vbfa_tab-vbeln.
perform vbrk_ermitteln using vbfa_tab-vbeln.
check sy-subrc = 0.
check xvbrk-rfbsk = 'C' or xvbrk-rfbsk = 'J'.
read table xdoc_num with key vbeln = vbfa_tab-vbeln
binary search.
tabix_xdoc = sy-tabix.
if sy-subrc = 0.
check xdoc_num-not_found is initial.
else.
refresh xbkpf.
call function 'FI_DOCUMENT_READ'
exporting
i_awtyp = 'VBRK'
i_awref = vbfa_tab-vbeln
i_awsys = vbrk-logsys
i_bukrs = vbrk-bukrs
i_gjahr = vbrk-gjahr
tables
t_bkpf = xbkpf
t_bseg = xbseg
exceptions
wrong_input = 1
not_found = 2.
describe table xbkpf lines sy-tabix.
if sy-tabix ne 0.
Delete documents from other fiscal year
if sy-tabix > 1.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
i_budat = vbrk-fkdat
i_bukrs = vbrk-bukrs
IMPORTING
e_gjahr = da_gjahr
e_poper = da_poper
EXCEPTIONS
fiscal_year = 1
period = 2
period_version = 3
posting_period = 4
special_period = 5
version = 6
posting_date = 7
OTHERS = 8.
IF sy-subrc = 0.
CONCATENATE da_gjahr da_poper INTO vbrk-gjahr.
loop at xbkpf where gjahr ne vbrk-gjahr.
delete xbkpf index sy-tabix.
endloop.
ENDIF.
endif.
loop at xbkpf.
clear l_xdoc_num-status.
move 'BKPF' to l_xdoc_num-awtyp.
move xbkpf-bukrs to l_xdoc_num-bukrs.
move xbkpf-belnr to l_xdoc_num-docnr.
move xbkpf-cpudt to l_xdoc_num-cpudt.
move xbkpf-gjahr to l_xdoc_num-gjahr.
l_xdoc_num-vbeln = vbfa_tab-vbeln.
l_xdoc_num-logsys = vbrk-logsys.
clear l_xdoc_num-not_found.
loop at xbseg where bukrs eq xbkpf-bukrs
and belnr eq xbkpf-belnr
and gjahr eq xbkpf-gjahr
and ( koart eq 'D' or koart eq 'K' ).
endloop.
if sy-subrc ne 0.
l_xdoc_num-status = 'C'.
else.
loop at xbseg where not augbl is initial
and ( koart eq 'D' or koart eq 'K' ).
endloop.
if not sy-subrc is initial.
SET STATUS TO 'No items are cleared'
l_xdoc_num-status = 'A'.
else.
loop at xbseg where augbl is initial
and umskz ne 'A'
and vorgn ne 'AZUM'
and ( koart eq 'D' or koart eq 'K' ).
endloop.
if not sy-subrc is initial.
Set status to 'All items are cleared'
l_xdoc_num-status = 'C'.
endif.
endif.
Otherwise: If there are customer/vendor positions where AUGBL is
filled and some other ones where AUGBL is blank then set status
to 'Partially cleared'
if l_xdoc_num-status is initial.
l_xdoc_num-status = 'B'.
endif.
endif.
append l_xdoc_num.
endloop.
insert lines of l_xdoc_num into xdoc_num index tabix_xdoc.
This is extracted from include LV05CF01
Max
Similar Messages
-
No insert Statements for EKKO EKPO in ST05 sql trace for transaction me21n
No insert Statements for EKKO EKPO in ST05 sql trace for transaction me21n.
IN ST05 I set a filter for ME21N and executed transaction to create a Purchase Order and then checked
ST05 but there is NO insert for EKKO or EKPO??
How Do I find in which columns of EKKO and EKPO data is inserted in ST05?
Edited by: DeepakNandikanti on Apr 28, 2010 8:27 AMHi,
I tried in my system and I can see INSERT statement on EKKO and EKPO tables. What exactly you are looking for? Some one else might have switched on the trace at the same time. Can you try again and see.
ST05=>Switch on trace
ME21N=>Create PO.
ST05=>Switch off and display trace.
In trace list search for EKKO and EKPO.
Column names are not shown in the trace list. It is the SQL trace and column list is generated dynamically like :A0, :A1....
@ Suhas,
That might be because the tables are updated via BAPIs ... Do you think SAP uses direct update statements on the DB tables ??
I didn't get above statement. Is there any other way of updation that happens when using BAPI? I believe that, even in case of BAPI there will be update task FMs called during database update. Please correct if i got it wrong.
Thanks,
Vinod. -
Hi
Can anyone suggest how to find the SQL trace for background jobs.
Thanks in advance.
Regards
D.VadivukkarasiHi
Check the transaction ST05.
Plz Reward Points if helpful -
Automize SQL TRACE for a selected session
Hi,
Should I automize the process of SQL Tracing for a particular session of our choice?
Lets say when there are several sessions, and we want to select the particular session for SQL TRACING, then the SQL tracing for that session enable via running a routine.
I used AFTER LOGON trigger for enabling SQL trace, but using this approach enable SQL TRACING all the sessions.
My Logon Trigger for enabling SQL Tracing:
create or replace trigger LOGON_SQL_TRACE
after logon on database
begin
execute immediate
'alter session set sql_trace=true';
end;
I want to use a perfect routine that first get the sid, serial# or username etc. from V$session, V$process or else, and then enable the SQL TRACING for the selected session.
Like SYS.DBMS.SYSTEM.SET_SQL_TRACE_IN_SESSION package is available for doing that or may be some others as well.
But how should we use these packages or other SQL tracing commands in a routine, which we can use for, enable SQL Tracing implicitly.
Any ideas will be great.
BillSYS.DBMS.SYSTEM.SET_SQL_TRACE_IN_SESSION is just fine.
You can get the SID and SERIAL# from v$session; you just have to know the username, osmachine, the OS process, ...
Fred -
Help out:SQL Assistant for oracle
Any time i use the logminer utility from the SQLaps SQL Assistant for oracle to query either my redo or archive logs i get this error, but the dictionary.txt file exist in the location specified;
Please help out with details on how to solve this error:
ORA-01284: file C\oracle\product\10.2.0\db_1\dictionary.txt cannot be opened
ORA-06512: at "SYS.DBMS_LOGMNR", line 58
ORA-06512: at line 1
kindly help out on the reason for this error and detailed steps to solve this issueNAIJA-EXBOY wrote:
That is how the error appears when you use the GUI utility for the logminer to query the alert logs,
Does anybody have ideas on how logminer utility works using this software "SQL Assistant for oracle""SQL Assistant for Oracle" doesn't seem to be a tool provided by Oracle, but a third-party tool. Therefore I suggest you contact their technical support for your inquiry.
As a workaround, as already suggested, you might want to use the DBMS_LOGMNR package to use the LogMiner. It's not that complicated at all and just needs a couple of calls to the DBMS_LOGMNR and optionally DBMS_LOGMNR_D packages. You can check the documentation on how to use it.
If you have Oracle Enterprise Manager you could access the LogMiner interface using the Java Console version prior to 11g.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
SQL TRACE for WEB deployed report
When I put
Alter Session Set sql_trace=TRUE
into the BEFORE Parameter Form trigger...
I get a trace file showing data on the one SQL in that trigger.
There is no TRACE output of the main query or any of the PL/SQL in the Program Units.
The report is invoked from company-wide intra-net.
I think it is Oracle Apps running in Linux server.
What am I doing wrong?
PS
I cannot execute this report from Report Builder.Hello,
Just a remark : if you are using Reports 9.0.4 / 10.1.2, you don't have to modify the reports , you can activate the SQL trace with the parameter SQLTRACE=YES
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/cmdline/common/cla_sqltrace.htm
Regards -
Hi
Database 10.1.0.4
Sql trace file which I have used but didn't get the trace file. I have tried to get per session Id but not able to get the trace file, when ever user logged into application, virtually 6 user get lgged in and you never know about user. So I have desided to capture for schema
I have used this for tracing
SQL> ALTER SESSION SET sql_trace=TRUE;
SQL> ALTER SESSION SET sql_trace=FALSE;
Or
SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => TRUE);
SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => FALSE);
or
SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>TRUE);
SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>FALSE);
I want to get trace file for schema, can anyone suggest how do I get trace file at schema level.
Thanks for helpHi,
Using instance-level tracing by setting the init.ora/spfile... parameter SQL_TRACE=TRUE, all processes against the instance will create their own trace files. This particular method of tracing should be used with care since it creates a great deal of overhead against the system. In addition, the default value for this parameter is FALSE.
Cheers
Legatti -
Need help on SQL Statement for UDF
Hi,
as I am not so familiar with SQL statements on currently selected values, I urgently need help.
The scenario looks as follows:
I have defined two UDFs named Subgroup1 and Subgroup2 which represent the subgroups dependent on my article groups. So for example: When the user selects article group "pianos", he only sees the specific subgroups like "new pianos" and "used pianos" in field "Subgroup1". After he has selected one of these specific values, he sees only the specific sub-subgroups in field "Subgroup2", like "used grand pianos".
I have defined UDTs for both UDFs. The UDT for field "Subgroup1" has a UDF called "ArticleGroup" which represents the relation to the article group codes. The UDT for field "Subgroup2" has a UDF called "Subgroup1" which represents the relation to the subgroups one level higher.
The SQL statement for the formatted search in field "Subgroup1" looks as follows:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP1] T0 WHERE T0.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod])
It works fine.
However, I cannot find the right statement for the formatted search in field "Subgroup2".
Unfortunately this does NOT WORK:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT $[OITM.U_Subgroup1])
I tried a lot of others that didn't work either.
Then I tried the following one:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT T1.[Code] FROM [dbo].[@B_SUBGROUP1] T1 WHERE T1.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod]))
Unfortunately that only works as long as there is only one specific subgroup1 for the selected article group.
I would be sooooo happy if there is anyone who can tell me the correct statement for my second UDF!
Thanks so much in advance!!!!
Edited by: Corinna Hochheim on Jan 18, 2010 10:16 PM
Please ignore the "http://" in the above statements - it is certainly not part of my SQL.
Please also ignore the strikes.Hello Dear,
Use the below queries to get the values:
Item Sub Group on the basis of Item Group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[U_GroupCod] =$[OITM.ItmsGrpCod]
Item Sub Group 1 on the basis of item sub group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[U_SubGrpCod]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp])
Sub group 2 on the basis of sub group 1
SELECT T0.[Name] FROM [dbo].[@SUBGROUP2] T0 WHERE T0.[U_SubGrpCod1]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp1])
this will help you.
regards,
Neetu -
Hi,
Should we use the Logon trigger for SQL TRACING,for the third party tool?
How should we manage SQL tracing and then read this trace file using
TKPROF for that specific session that is using the third party tool?
I wanted that whenever this third party tool connect to database with any user, the sql tracing will start for that specific seesion and then read the sqltrace for that session using TKPROF.
Any ideas/exmp will be great.
Regards
CLEEShould we use the Logon trigger for SQL TRACING,for the third party tool?
Yes you can use like
CREATE OR REPLACE TRIGGER af_sess_Logon
After logon on database
Begin
if ( user='SCOTT') then
execute immediate 'alter session set sql_trace=true';
End if;
End;
sql tracing will start for that specific seesion and then read the sqltrace for that session using TKPROF.
for tkprof you can user command line
or use host in sql
kuljeet pal singh -
Hi,
How can I turn on SQL Tracing for ODS Transfer scripts?
Best regards,
JohanHi Johan,
If SAP Note 1289112 is not the case, please clarify what "ODS Transfer" means.
Regards,
Sergiy -
Need help on Sql command for count
Hi,
I have the following table.
Temp_Set Table
ID Names Action
1 John Delete
2 John Add
3 Mary Update
4 Sim Add
5 Sim Update
How do I do a SELECT sql command for count(names) > 1 ?
Please kindly advise me. Thank you very much.It doesnt work when I do this
SELECT * FROM Temp_Set
HAVING Count(names) > 1
It prompts me the following error:
ORA-00937: not a single-group group function
00937.00000 - "not a single-group group function"
*Cause:
*Action:
Error at Line:16 Column:7i am not sure but you can try this:
SELECT B.* FROM
(SELECT NAMES, COUNT(1) CNT FROM TEMP_SET GROUP BY NAMES) A, TEMP_SET B
WHERE A.NAMES = B.NAME
AND CNT > 1 -
Need help with SQL retrieval for previous month till current date
Hi ,
Need help generating statistics from previous month from date of enquiry till current date of enquiry.
and have to display it according to date.
Date of enquiry : 03/02/2012
Application Type| 01/01/2012 | 02/01/2012 | 03/01/2012 |...... | 31/01/2012 | 01/02/2012 | 02/02/2012 | 03/02/2012 |
sample1 20 30 40
sample 2 40 40 50
sample 3 50 30 30
Hope you guys can help me with this.
RegardsHi,
932472 wrote:
Scenario
1)If i run the query at 12 pm on 03/2/2012. the result i will have to display till the current day.
2)displaying the count of the application made based on the date.
Application type 01012012 | 02012012 | 03012012 | ..... 01022012| 02022012|03022012
sample 1 30 40 50 44 30
sample 2 35 45 55
sample 3 36 45 55Explain how you get those results from the sample data you posted.
It would help a lot if you posted the results in \ tags, as described in the forum FAQ. {message{id=9360002}
SELECT application_type as Application_type
, COUNT (CASE WHEN created_dt = sysdate-3 THEN 1 END) AS 01012012 (should be getting dynamically)
, COUNT (CASE WHEN created_dt = sysdate-4 THEN 1 END) AS 02022012
, COUNT (CASE WHEN created_dt = sysdate-5 THEN 1 END) AS 03022012
, COUNT (CASE WHEN created_dt = sysdate-6 THEN 1 END) AS 04022012
FROM table_1
GROUP BY application_type
ORDER BY application_typeThat's the bais idea.
You can simplify it a little by factoring out the date differences:WITH got_d AS
SELECT qty
, TRUNC ( dt
- ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
, -1
) AS d
FROM table1
WHERE dt >= ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
, -1
AND dt < TRUNC (SYSDATE) + 1
SELECT SUM (CASE WHEN d = 1 THEN qty END) AS day_1
, SUM (CASE WHEN d = 2 THEN qty END) AS day_2
, SUM (CASE WHEN d = 62 THEN qty END) AS day_62
FROM got_d
See the links I mentioned earlier for getting exactly the right number of columns, and dynamic column aliases. -
Help with sql query for multiple years
Hello,
I am new to SQL and am trying to perform a query that includes multiple years from 2005 to 2011.
I was trying to enter the following query but received a message that said "Operand should contain 1 column(s)"
SELECT * FROM `auto_2` WHERE `year` LIKE (2005, 2006, 2007, 2008, 2009, 2010, 2011);
What am I doing wrong here? Please advise...
ThanksHi and welcome to the forum,
You cannot use LIKE here, that is for pattern matching.
You need either IN operator, or less known =ANY.
Regards
Peter -
HELP: Need SQL code for bulk move
I am using Oracle 11.2, there are two tables tb_base, tb_hist as following:
tb_base (id number(5), tag varchar2(16), setTs timestamp(6));
tb_hist(id number(5), histTs timestamp(6), setTs timestamp(6), tag varchar2(16));
tb_base 1, 'adsf', 2012/12/20
1, 'bbb', 2012/12/08
1, 'ccc', 2012/12/30
2, 'aaa', 2012/11/29
2, 'vvv', 2012/11/28
All I need is to move non-latest record with the same id from tb_base to tb_hist as followings:
tb_base 1, 'ccc', 2012/12/30
2, 'aaa', 2012/12/29
tb_hist 1, 'adsf', 2012/12/20, 2012/12/20
1, 'bbb', 2012/12/08, 2012/12/08
2, 'vvv', 2012/11/28, 2012/11/28
Any suggestion on the SQL to complete this task?
ThanksCopy the historical records to TB_HIST:
INSERT INTO tb_hist
(id
,histts
,setts
,tag)
SELECT id,
setts,
setts,
tag
FROM tb_base a
WHERE EXISTS (SELECT 1
FROM (SELECT id,
MAX(setts) OVER (PARTITION BY id) max_setts
FROM tb_base) b
WHERE b.id = a.id
AND b.max_setts != a.setts)Delete the historical records from TB_BASE:
DELETE tb_base a
WHERE EXISTS (SELECT 1
FROM (SELECT id,
MAX(setts) OVER (PARTITION BY id) max_setts
FROM tb_base) b
WHERE b.id = a.id
AND b.max_setts != a.setts) -
Q1.How can you trace the session of forms?
c:\ifrun60 module=<formname> userid=scott/tiger
statistics=yes
This will do a alter session set sql_trace=true in the background.
Maybe you are looking for
-
Camera chicony is not working with windows 7
Hello, I recently upgraded my A355-S6935 notebook to windows 7 ultimate, and i downloaded all its drivers from toshiba's website, but it seems there is a problem with the camera driver, I already read all the topics related to and can't get it to wor
-
Reading Item texts of a document (PO) while it is not yet saved
Hi Team ABAP, i´m a little confused about those item texts. I was searching the Forum on this and found thread according to this i adopted my Coding, but still it wont, work. Maybe one of you guys has an Idea where i go wrong? FORM get_article_basic_
-
Buttons in pdf forms on Android with Adobe Reader
Hello all, We used Adobe Acrobat XI to make a form and it was working great on Android. (Samsung Galaxy Tab 2 10.2) using the Adobe Reader app. We were able to open the form and create a copy and edit it and save it. It works fantastic... Except....
-
How do you make an X cursor?
I googled a lot, and all I can find are sites that have guides to make big X cursors, or involves the use of strange/outdated programs. (Which doesn't help.) I tried ubuntu and gentoo wiki and neither of them were very helpful. I have made a set of a
-
Please help ,GR not able to Print
Hi Gurus , I would really appriciate if you could help me to fix this problem , User is not able to print GR document . Thanks in advance.