Query to find vendor number with whom a particular item was last purchased.
Hi All,
I want to frame a SQL query to find vendor number with whom a particular item was last purchased.
I got to know that we can find this by looking at the open Purchase Order or the Material Transactions for the transaction type of ‘PO Receipt’ whichever is the latest.
Can anyone please help me in framing such query.
Regards,
Shruti
Here is a hint
Use the mtl_system_items_b table to get the inventory_item_id.
Use it in the po_lines_all table to get po_header_id
Use it in po_headers_all table to get vendor_id
Use it in po_vendors to get segment1 (i.e. vendor#)
Hope this helps,
Sandeep Gandhi
Similar Messages
-
Query to fetch vendor number with whom this item was last purchased
Hi All,
We have a requirement to fetch the vendor number for an item with whom the item was last purchased. We need to derive this by looking at the open Purchase Order or the Material Transactions for the transaction type of ‘PO Receipt’ whichever is the latest.
For this we are using the below query, but this query is taking a lot of time and doing an INDEX RANGE SCAN on PO_LINES_N1 & MTL_MATERIAL_TRANSACTIONS_N1
SELECT MAX (v.segment1)KEEP (DENSE_RANK LAST ORDER BY DECODE
(UPPER (poh.closed_code),
'OPEN', poh.creation_date,
mmt.transaction_date
poh.creation_date) seg1
FROM po_headers_all poh,
po_vendors v,
mtl_material_transactions mmt
WHERE poh.po_header_id IN (SELECT pol.po_header_id
FROM po_lines_all pol
WHERE pol.item_id = p_inv_id)
AND v.vendor_id = poh.vendor_id
AND mmt.inventory_item_id(+) = p_inv_id
AND mmt.transaction_type_id(+) = 18
AND mmt.transaction_source_id(+) = poh.po_header_id;
Can anyone please help me in rewriting this query or if we can use different tables to acheive the same functionality.
Regards,
ShrutiHi,
Can anyone please help me with the below query.
Regards,
Shruti -
How many number of times a particular report was executed
Hi..My requirement is to find how many number of times a report/tcode was executed in a particular period of time.I tried using STAD,STAT AND ST03 ..but i am not able to find how many number of times the particular report was executed ..is there any other tcode or table or FM ..that would solve this problem..its bti urgent..wud reward points for all useful answers could u let me know under what name or field int eh out put this particular info that i am looking for wud be displayed?
Hi,
The following code i found from this forum, may this will help you.
* internal tables for use counter
data: begin of list occurs 5.
include structure sapwlserv.
data: end of list.
data: begin of applicat occurs 0.
include structure sapwlustcx.
data: end of applicat.
data: begin of applica_ occurs 0.
include structure sapwlustcx.
data: end of applica_.
data: begin of applicau occurs 0,
entry_id like sapwlustcx-entry_id,
account like sapwlustcx-account,
count like sapwlustcx-count,
: end of applicau.
data: wa_applicau like applicau.
*& Form MONI
form moni.
data: l_host like sapwlserv-hostshort.
m_start = p_usedt.
*** get server
call function 'SAPWL_SERVLIST_GET_LIST'
tables
list = list.
do.
loop at list.
*** loop on server
check not list-instshort is initial.
l_host = list-instshort.
*** get statistics per month and server
perform workload using m_start l_host.
endloop.
add 31 to m_start.
if m_start > sy-datum.
exit.
endif.
enddo.
sort applica_ by entry_id.
sort applicau by entry_id count descending.
endform. " MONI
*& Form WORKLOAD
form workload using p_start like sy-datum
p_host like sapwlserv-hostshort.
refresh: applica_.
*** read application statistic from MONI
call function 'SAPWL_WORKLOAD_GET_STATISTIC'
exporting
periodtype = 'M'
hostid = p_host
startdate = p_start
only_application_statistic = 'X'
tables
application_statistic = applica_
exceptions
unknown_periodtype = 1
no_data_found = 2
others = 3.
sort applica_ by entry_id account.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
clear wa_applicau-entry_id.
wa_applicau-entry_id(25) = applica_-entry_id.
wa_applicau-account = applica_-account.
wa_applicau-count = applica_-count.
collect wa_applicau into applicau.
endloop.
sort applicau by entry_id count descending.
applica_-ttype = space.
applica_-account = space.
modify applica_ transporting ttype account
where ttype ne space.
*** collect only enhancements statistic
if p_temp = 'X'.
loop at applica_.
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
else.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
endif.
endform. " WORKLOAD
aRs
Points are always welcome -
Query to find the no. of related no. of Items with a item.
Hi,
I made some items in inventory. I have to find the no. of child items that are connected to a parent item. Like if there is a parent item a and it has two sub item b1 and b2. again b1 has two subitem b11, b12. similar b2 have two subitem b21, b22. and this goes on. So i have to make a query to find out all the the items.
Plz give me the solutions.
Regards
user609981Dou you know read?
-- the number of rows in a table named yourtable:
select count(1) from yourtable;
-- the number of columns in a table
-- If is a user's table:
select count(1)
from user_tab_columns
where table_name='YOURTABLE'
--If it is´t
select count(1)
from DBA_tab_columns
where owner = 'USEROWNER'
and table_name='YOURTABLE' -
Find serial number with Apple ID?
My Macbook Pro got stolen today, I was wondering if there is a way to find the serial number with my Apple ID which I used to register my MBP.
I need the serial number for the police report.
PLEASE HELP :'(
I have discarded the packaging.Follow this process to find your registered serial number:
http://support.apple.com/kb/HT2526 -
Finding PO number with ITEM text as input
Hello
Is there any way/table/fm to list down all the PO that has a particular ITEM text without writing a program .
For eg , PO 123 , has an ITEM text 'aaaa bbbb cccc dddd' . Now i want to find out all the PO that has this particular text as its ITEM text .
Thanks
Jtypes: begin of ty_ekpo,
ebeln type ebeln,
end of ty_ekpo.
data: lt_ekpo type table of ty_ekpo.
Select ebeln into table lt_ekpo where TXZ01 = <<Input your text here>> from table EKPO.
you will recieve all the POs into this Internal table 'lt_ekpo'. -
Can anybody provide the SQL query to find the files uploaded in a particular folder?
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
NevinNevin,
Be great if we could know the version of Portal. For Rel. 1, here's the query
select id,masterthingid from wwv_things
where siteid = &site
and cornerid = &corner
&site - Content Area id
&corner - Folder id
if you don't know the folder id, use
select id from wwv_corners where siteid = &site
and name = &folder
Hope this helps. I have run into this situation before. Usually, the culprits were
one of the following:
1. Junk Characters in description of item (caused due to Copy-Paste)
2. Special Characters in the File name
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
Nevin -
How to find the number of users log into ESS for last three months
Hi Team
Is there any transaction / Report to find the number of users logged into the ESS and used the payslip tab. Is this possible to find?
Waiting for hopeful replies.
Regards
BhaskarBhaskar,
you can use google analytics,
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50b94044-7008-2b10-1680-c04e4526367b
jo -
I am looking for a query to find all software on a specific computer. I have found several on a specific piece of software but I need multiple pieces of software. I have tried creating this query but it shows ALL the software on the computer. I'm looking
for one that narrows it down to a few pieces of software i.e Office, Adobe, Snagit, IE and Chrome. Possibly using Add/Remove Software?It's an asset intelligence report, do you have that enabled?
http://technet.microsoft.com/en-us/library/gg699382.aspx
Alternatively, take a look at the 'Products on a specific computer' report (Software - Companies and Products category) and see if that gets you what you need.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
How to list all reports with details for when it was last run by whom?
Hi, Expert:
We are running BW3.5. I need to create a report to get a list of all reports (including queries, workbook, web report) with the details of on which day was the report last executed and which user ran it.
Is there any report in bussiness contact provide this information?
I was tring of using statistic cube 0BWTC_C02. Is it the right cube to use?
I was setting up filter by characteristics "Process Type OLAP" including only values of "Execute Query/Navigation Step" and "Query in WWW", also by characteristics "Object Version" including only value of "Active". Will these filter get correct data?
Can someone please tell me what the following date/time fields mean? e.g. when it is executed, changed, data captured?
Key Figure: "Start Date"
Characteristics: "Calendar Day"
Characteristics: "UTC Timestamp"
Thanks,
JennyHi,
This below help link provides a detail description of each and every field of 0BWTC_C02.
Also it gives details about the calculated key figures like "when the query was last run" etc.
Check if all your reports based on InfoCubes and are the statistics ON for those cubes or reports?
http://help.sap.com/saphelp_bw33/helpdata/en/52/e91c3b85e6e939e10000000a11402f/frameset.htm
Thanks
El. -
Finding warehouse number with storage location
Hi all,
How can I find the warehouse number given the material, plant and the storage location? Thanks in advance.You need to join two tables :
MARD - MATNR,LGORT,WERKS
MLGN - Here you get Ware house number
Check with LS24,LS26 Transaction and also check with MLGT Table
Thanks
Seshu -
I'm trying to find my iPad but I'm traveling and don't have the serial number. I cannot figure out how to use my iPhone to locate it. Can anyone assist?
Download the Find My iPhone app from the App Store to your iPhone.
Then, launch the app, log in with the Apple ID & password used for your iPad.
Note that unless you had enabled the FMiP function on the iPad under Settings > iCloud, you will not be able to track the device. -
ABAP query to find delivery number of a sales document
Hi Gurus,
Can anyone help me how can i create an ABAP query to fetch the delivery number of a sales order. What are the tables to be joined.
Through tables I got the solution. From VBAP table I fetched the sales order numbers. I copied the sales order numbers and opened VBFA table. In the preceding documents field I had pasted those sales orders numbers. Then I've selected subsequent document category 'J' to get the deliveries.
But now how to write an ABAP query for this.
regards
rama krishnaHi,
Try to use join query like:
Select vbfa~VBTYP_N INTO CORRESPONDING FIELDS OF TABLE itab from VBFA inner join VBAP
where vbapvbeln = VBFAVBELN.
Regards
Mudit -
Vendor number with logic inbuilt for Purchasing organization
Hi,
Can anyone help me to get Vendor Numbers based on purchasing organization.
Example: Purchasing organization 1A, Vendor account no internal number range assigned is 10000-19999
Now we create new vendor code , it should be 1A10000, instead of 10000.
Please help.
Regards,
MGHi Manish,
You can use the BADI VENDOR_ADD_DATA for this purpose. Implement it and write the below code in method MODIFY_ACCOUNT_NUMBER
The code will be like below:
method IF_EX_VENDOR_ADD_DATA~MODIFY_ACCOUNT_NUMBER.
data : v_eko type ekko-ekorg.
get PARAMETER ID 'EKO' FIELD v_eko.
C_LIFNR = C_LIFNR+5(5).
CONCATENATE v_eko C_LIFNR INTO C_LIFNR.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = C_LIFNR
IMPORTING
OUTPUT = C_LIFNR .
endmethod.
It will resolve your problem.
Thanks -
Bex Query to find total number
Dear Friends,
I have data like below in my Infocube for different years. its flat file loading DS->DSO->Infocube.
EmpId
Dept
section
Year
Smoking
101
HR
A
Jan-10
No
102
HR
A
Jan-10
Yes
103
HR
B
Jan-10
Yes
104
FI
A
Jan-10
No
105
FI
B
Jan-10
No
102
HR
A
Aug-10
No
My requirement is like below to find out total number of employees who are Smokers and non smokers.
Dept
Year
Tot no of Emp
Tot Emp Smoking
Tot Emp non-smoking
HR
2010
3
2
1
FI
2010
2
0
2
Result
5
2
3
Please give me your valuable input
Thanks
VijayHi,
Do like Anshu said.
Remember to set "Calculate result as" "summation"
otherwise you don't get proper values in result rows.
Regards, Leszek
Maybe you are looking for
-
How to delete one record at a time
hi all, Please tell me how i do delete only one record at a time.After deleting the record the jsp page should show only the remining items to be deleted.
-
ADF Faces Dependent list boxes in an editable table
Hi, I'm working with JDeveloper 10.1.3.1.0. I saw the topic "How to build dependent list boxes with ADF II" on F. Nimphius' Blogbuster. There it is shown how to handle dependent list boxes in an ADF Faces form. I tried this for an editable table but
-
How to Create USB boot for MBP81.0047.B27
How to Create USB boot for MBP81.0047.B27
-
Setting REPLY_TO: to my domain name, not my email service
I have a persoalized domain name. I'd like my [email protected] address to be in the FROM field on email I send from my iPad/iPhone. Right now it the email address from my mail server accout with my Internet Service Provider. I don't see how to chang
-
Qualitative chareterstic of QM purahasing
hi Gurus, As i am learning qm module for result recording of qualitative part i maintain this step 1 - Use transaction QS51 to create selected set 2 - Use transaction QS41 to create catlog 3- Use transaction QS23 to change master inspection characte