Query for serial number for items sold
hi,
I want a query which would show serial numbers for Product A and Product B which were sold. I know that following tables will be used
SELECT T0.[CardCode], T0.Docnum,T0.[DocDate], T0.[CardName],T1.Quantity,T1.[ItemCode],T6.DistNumber
FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
inner join DLN1 T4 on T1.DocEntry=T4.BaseEntry
inner join ODLN T7 on T4.DocEntry=T7.DocEntry
inner join OSRN T6 on T4.itemcode=t6.itemcode
WHERE T1.[ItemCode] in ('ProductA','ProductB') and T0.[CardName] like'% naaveol%' and T0.CANCELED<>'Y'
group by T0.[CardCode],T0.[CardName], T0.[DocDate],T1.[ItemCode] ,T0.Docnum,T6.DistNumber,T1.Quantity
Howerver I am doing some thing wrong and it is showing alot more records than it should. basically what I was trying to do was to get
item code
serial num
quantity
for the items mentioned sold to the particular business partner.
Your help will be greatly appreciated
Hi again.......
Please try this.......
SELECT T0.CardCode, T0.Docnum,T0.DocDate, T0.CardName,T1.Quantity,T1.ItemCode,T4.DistNumber
from ODLN T0 inner join DLN1 T1 on T0.DocEntry=T1.DocEntry
left outer join SRI1 I1 on T1.ItemCode=I1.ItemCode and (T1.DocEntry=I1.BaseEntry and T1.ObjType=I1.BaseType)
left outer join OSRN T4 on T4.ItemCode=I1.ItemCode and I1.SysSerial=T4.SysNumber
Regards,
Rahul
Similar Messages
-
How to create sql query for item master with operator LIKE with variables?
hi all,
How to create sql query for item master with
operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
JeyakanthanHi Jeyakanthan,
here is an example (put the like statement into the where field)
SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
Regards Steffen -
hi all,
i want to create a query for items in the item master data that shows the changed field, the old value, the new value, user name and the date it was changed .
can anyone help please.
ciaothanks for the reply
my clients internal auditors require that they have Exception Reports in SAP , i.e reports that can show changes made, date and by which user etc...
1. changes made to item master data
2. changes made to business partner master data
3. changes made to invoices, purchase orders etc..
this reports can be set in query form or xl reporter..
i tried but couldent find the tables ....
any sugestion will be appriciated.. -
Hi All,
I am using serial numbers to finished goods items.
I sell one item as 1001 to a customer.
So all the documents related to sales (Sales order, Delivery, A/R Invoice) do not show the serial number of the particular product sold.
From the form settings if I select the Serial No. field, it adds the field in the rows but does not show the serial number of the item selected.
My client needs to view the serial numbers of the items sold.
Can anybody suggest.Hello Ajit,
There are a few things to be considered when looking at the option of using a UDF at the row level.
Let us say, you have item A which has quantity 5. This mean you will have 5 serial number. Since this is a very good possibility in business you need to take this into consideration.
FMS(formatted search) will not be a good option or will be too difficult to implement. Couple of reason, you have to add the document first and then trigger the FMS manually by calling the document back.
You will have to Query the serial number tables OSRI and SRI1 (NOT OIBT and IBT1).
Therefore, if you are still holding on your thought to get the Serial numbers on the Screen. Then use the UDF option but create a row level UDF large enough to hold the maximum number of serial numbers you think can be delivered per item.
Then you need to write code in the SBO transaction notification stored procedure to create a looping construct to fetch all the serial numbers for a line item and ConCat it to one variable and Update the UDF with this Variable's value.
Suda -
Inbound idoc error in 51 Status of at least one serial number of item
Dear Experts,
There is one inbound IDOC which is in error with status 51 showing error Status of at least one serial number of item is not allowed.
Can you please advice why this error is coming.
Thanks & Regards,
Nikhil Kanegaonkar.An inbound IDOC in error will have the status 51, & it is marked for deletion it has a status of 68.
http://www.dataxstream.com/2009/10/mass-status-change-sap-idoc/
http://wiki.sdn.sap.com/wiki/display/ABAP/IDoc+Statuses
Edited by: Krupaji on May 6, 2011 2:38 PM -
Inventory Tracking & Inventory Posting for Serial number managed items
Hi,
Plase advise me to address this issue..
My scenarios is : - hand an item whih is serially managed, purchase 2qty and it serial number is 'S1' and 'S2', in a delivery document had selected 'S2" and physically issued 'S1', ineed to correct serial number at the time of inventory counting..kindly advise...
thanks in advance..
NobinHI Raghu ,
as you are setting other properties like itemcode and warehouse, u will find batchnumber and batch qunatity(after u press Lines. ) see the sample locally at ..Program Files\SAP\SAP Business One SDK\Samples\COM DI\VB.NET\04.SerialAndBatch. , if u have )
the sample updates the batch table in loop, whereas I used to give all the required batch quntity at once.
U have to make it sure that the item is managed by batch ( if a field in oitm called 'ManBtchNum' is found 'Y' then only go ahead with defining batch number and batch quantity else , ur document will not simplly get posted and no error will be thrown)
also remember that since it is goods issue, u have to have the batch existing in the database (oibt table) with the defined batch quantity.)
hope it helps.
regards,
Binita Joshi -
Query for Item wise sales report
Hi Guys,
Below is the query i have used to run Sales Register.
But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
(Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
(SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalHi experts..
Pls Update the Query -
Dear SAP Members,
I need a query that contains
ItemCode,ItemDescription from oitm table and its first child item code,Item Description,Quantity,currency and price from itt1 table.I have taken all the datas but there is no ItemDescription from itt1 table.How to join all these datas.
Please Give suggestions or query for this issue.
With Regards,
RevathyHi try this
Declare @BOMDetails table(TreeType Nvarchar(MAX),PItem NVARCHAR(Max),PName NVARCHAR(MAX),CItem NVARCHAR(Max),CName NVARCHAR(MAX),Comment NVARCHAR(MAX),onHand Numeric(18,0),[Committed] Numeric(18,0),FreeStock Numeric(18,0),[Status] NVARCHAR(MAX),Quantity numeric(18,0),Price numeric(18,0),Warehouse nvarchar(MAX),Currency nvarchar(MAX))
INSERT Into @BOMDetails
SELECT T1.TreeType ,T0.Father AS [Parent Code], T2.ItemName AS [Parent Description], T0.Code AS [Child Code],
T1.ItemName AS [Child Description], T0.Comment, cast((T1.OnHand ) as Numeric(18,0)) as [Un-Committed Stock],
cast(T1.IsCommited as Numeric(18,0)) AS [Committed Stock], cast((T1.OnHand - T1.IsCommited)as Numeric(18,0)) AS [Free Stock], T2.FrgnName AS [Status],T0.Quantity,T0.Price ,T0.Warehouse,T0.Currency
FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode
INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
WHERE T0.ChildNum=1
Union All
SELECT ' ',T0.Father as [Parent Code], T2.ItemName AS [Parent Description], '', '', '', 0,0,0 , '',0,0,'','' FROM ITT1 T0 INNER JOIN OITM T1
ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Group By T0.Father,T2.ItemName
ORDER BY T0.Father, T0.Code
update @BOMDetails set PItem='' ,PName='' where TreeType='N' or TreeType='P'
Select PItem as[Parent Code] ,PName as [Parent Description],CItem as [Child Code],CName as [Child Description],Comment,Quantity,Price,Warehouse,Currency from @BOMDetails
thanks,
Neetu -
Notification Query for Item Group
Dear Experts,
Please Guide me for a Notification Query for this Scenario :
I want to put a Notification Query for a Group i.e. when any user do transactions in any form or any Particular form using items
of this Group than if the Item Quantity is in Decimal then he can not do that Transaction and Get Error Message.
Thanks in Advance.
Atul ChakrabortyHi Atul,
to achieve this you have to write SPTN at the back end
under databases node select your live database.
Select programability
select stored procedure
select db.sbo.SP_Transactionnotification
and paste your code into
ADD YOUR CODE AREA
If (@object_type = '17') and (@transaction_type in ('A', 'U'))
BEGIN
Declare @ItmGrpCode as int
Declare @Qty as int
set @ItmGrpcode = (select oitm.itmsgrpcod from oitm inner join rdr1 on oitm.itemcode = rdr1.itemcode inner join ordr on
rdr1.docentry = ordr.docentry where ordr.docentry=@list_of_cols_val_tab_del)
set @Qty = (select quantity from rdr1 inner join ordr on ordr.docentry = rdr1.docentry where ordr.docentry =
@list_of_cols_val_tab_del)
BEGIN
if @ItmGrpcode = 10 and @qty = 0
Begin
set @error = -1
set @error_message = 'Invalid Input'
End
End
END
Like wise by capturing object type and dml mode you have to write code for every document that you want to check.
For example I've given code for Sales Order.
hope this will help you
Thanking you
Malhaar' -
Query for Item wise Sales.......
*Hi Guys, Below is the query i have used to run Sales Register. But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise.
Pls update the query ...*
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalClosing this ...
Edited by: Parimis on Jun 25, 2010 5:44 PM -
dear all,
we are useing serial number profile. i want to create one query which will includes
material number,
document number,
movement type, with special indicator,
serial number applied.
qty
can anybody suggest me suitable table from which i can grab serial number ( in MIGO) field ?Hi
Have a look on these tables.
SER00 General Header Table for Serial Number Management
SER01 Document Header for Serial Numbers for Delivery
SER03 Document Header for Serial Numbers for Goods Movements
SER04 Document Header for Serial Numbers for Inspection Lot
SER05 Document Header for Serial Numbers for PP Order
SER06 Document Header for Serial Numbers for Handling Unit-Content
SER07 Document Header for Serial Numbers in Physical Inventory
SER08 Document Header for Purchase Order Item Serial Numbers
SERI Serial Numbers
check in table AFPO field ANZSN with respect to AUFNR
Thanks
S.Murali
Edited by: S.Murali on Sep 14, 2009 1:31 PM -
How to add serial number contolled item with serial numbers in sales order.
Hi OM Functional Experts,
I need a help on sales order booking.
We have serial controlled items in our inventory. At the time of booking a sales order, we need to call the items with the appropriate serial numbers [ for example, if i book an item for a qty of 10, then, the system should get the details ( serial number ) of the 10 item's serial number ].
And the serial numbers are Pre-defined by the organization for their internal tracking from the porcess 1 till end of the assembly line.
The purpose of this step, is to reduce the particular serial numbered item from the inventory, when we reserve/pick release the sales order.
thanks in advance.
Rdx,
J kannan
Edited by: J Kannan on Feb 17, 2009 1:23 AMKannan
OK. Unfortunately reservations cannot be created at the serial number level. So the unsupported way of doing this is updating the mtl_serial_numbers tables. I hope you would know (by some means) which serial numbers you want to allocate to a specific sales orders. If you know, update group_mark_id column in mtl_serial_numbers table with your order_line_Id, This will avoid any one from picking the serial numbers (they will not come up in the LOV or will not be auto allocated).
But you have to make sure to take it off when you actually want to pick this order line and allocate this serial number. So just before you pick release/ confirm this order line you need to update column back to null so that you can allocate that serial number.
Thanks
Nagamohan -
KQL query to restrict Number of items.
Hi,
We are using content search query to query the data from search index.
We wanted to restrict the number of items returned in the query to 5. so that we can sort the items with priority column.
Please let me know if there is any syntax that i can use to restrict the item in the query itself.
Thanks,
SudanI'm not aware of a query variable in KQL, but if using REST API, you could use RowLimit:
http://msdn.microsoft.com/en-us/library/office/jj163876(v=office.15).aspx
"The maximum number of rows overall that are returned in the search results. Compared to
RowsPerPage, RowLimit is the maximum number of rows returned overall"
Sample GET request
http://server/_api/search/query?querytext='sharepoint'&rowlimit=5
Here is the link for CSOM and Server OM:
http://msdn.microsoft.com/EN-US/library/microsoft.office.server.search.query.query_properties(v=office.15).aspx -
Shipping API with serial number controlled item
Hi Gurus,
Using Shipping API, how can I update the serial number in the order lines for a particular item where the quantity is more than 1?
The serial numbers are present in a random order in mtl_serial_number table.
I am using WSH_DELIVERY_DETAILS_PUB.Update_Shipping_Attributes API to update the lines by passing the serial numbers but this is not working. For single record this works but when I am using multiple records it inserts record into mtl_serial_number_temp table but does not populate the shipping transaction line with the error as "serial number range 123456 could not be marked successfully".
Regards,Thanks Jon.
Can you please tell me how to populate the mtl_serial_numbers_temp(shall I use any API?) table and how do I link the data in mtl_serial_numbers_temp to that in wsh_delivery_details?
Regards. -
SHPCON serial number updates item on delivery but not item in HU
I am using SHPCON to update the item on delivery with serial numbers. After that I use SHPCON to pack that same item in a handling unit. From the pack screen I should be able to select the item and hit the serial number button and see the serial number. Instead it says there is no serial number on the item. I populated E1EDL11 under E1EDL24 to get the serial number on the item. I also tried during packing populating E1EDL46 under the HU item E1EDL44 but that doesn't work either.
Anybody run into this issue?Hi,
If your Sloc is HU managed then need to maintain serial numbers in HU only.
i think you are doing packing at shipment level, HU should packed and serial numbers assigned then finally assigned to shipment document.
Rgds,
Kris. -
PSE 7 Activation query. Serial number is invalid
Trying to activate an old PSE 7 version on a new PC and serial number is coming up as invalid. Can you assist please
Got the exact same response from the tech guy on the chat. It's terrible support in my opinion.
I have the exact same problem as you and they sent me to this forum to resolve it. C'mon Adode!!!
Photoshop Elements 7 works fine on Windows 8.1 as I am running the trial version it just wont accept my serial number which is valid
Maybe you are looking for
-
SharePoint 2013 - Office web apps intermittent issue
From past few weeks we are seeing issue while opening the documents from sites error message says "Sorry something went wrong + An unexpected error occur on the Server". This happens with individual users accounts(Since it is expected behavior with
-
When I move pages from one document to another, it creates a new alternate layout.
Hello, I'm having an issue with combining some documents. Usually I use the "move pages" command and tell the pages to integrate with another document. However, because of the new alternate layout feature, both documents have the default layouts as "
-
Generating table of contents by chapter number and title in reports
Hi all, how can i generate a table of contents in reports? I will definitely need the chapter numbers and their respective titles to do that. Are there specific templates to follow in order to do that? Thanks.
-
Approximately 2/3 boots freeze with the following error message.
Uploaded with ImageShack.us Last time it happened I noticed the scroll lock and caps lock flashing. I am not sure if it happens every time, though. What can I do to fix this problem?
-
Error when checking in Activity
Hi All, When I rebuild my webdynpro project, it builds successfully without any errors. I can also deploy and run my application. But when I checkin my Activity, I get an error: "A Context model node has to be bound to a model class ". I have checked