SQL Queries for open sales orders with no invoice.
Hello all!
Is there a way to make a query to find out if there are any uninvoiced sales orders older than 5 days? I am having difficulty figuring out how the invoice is linked to the sales order.
I am more familiar with excel than SQL but I'm guessing it will be similar to the following:
SELECT * FROM ORDR WHERE today's date - posting date>5 AND (not sure what to check here for the invoice having been created)
**Note: my syntax is of course not exactly correct, this is just to give you an idea of what I'm looking for
Has anyone had to do this before or know how it would be done? It would be very useful for me.
Thanks!
Mike
Hi Mike
The document link is built on row level so the RDR1 should be used instead of ORDR to server your propose.
You could use this query to get all the lines do not link to a invoice.
*targettype 13 refers to target document invoice
select t0.docentry,t0.docdate,t0.linenum,t0.itemcode,t0.quantity,t0.price,t0.linetotal
from rdr1 t0 join ordr t1 on t0.docentry= t1.docentry
where t0.trgetentry is null and t0.DocDate < dateadd("d",-5, getdate()) and t1.docstatus = 'O'
or just use this query instead to find those lines do not link to any document
select t0.docentry,t0.docdate,t0.linenum,t0.itemcode,t0.quantity,t0.price,t0.linetotal
from rdr1 t0 join ordr t1 on t0.docentry= t1.docentry
where t0.targettype !='13' and t0.DocDate < dateadd("d",-5, getdate()) and t1.docstatus = 'O'
Please modify the code according to your needs.
Regards,
Syn Qin
SAP Business One Forums Team
Edited by: Syn Qin on Aug 11, 2008 5:20 AM
Similar Messages
-
Table For Open Sales Order And Customer Invoices
Dear Gurus,
Are there any table to know open Sales orders and pending invoices for Customers?
Wishes,
AbhishekHi,
Go to T code VA05 and select open sales order radio button. Put other input parameters like date range or sold to . Execute you shal get list of all open sales order.
For pending invoices go to T code VL04 and you get list of all billing not yet created even though GI is done.
These are standard SAP functionality and can be used rather than looking in a table level.
Regards
Vivek -
Queries for Open Sales Order Lines and Open Purchase Order Lines
Experts,
Forgive me if these have been addressed elsewhere but I can't find them. I'd like to create two queries to use as Alerts as follows:
1. Query of open lines in Sales Orders that are more than two weeks old
2. Query of open lines in Purchase Orders that are more than 2 days old
Thanks in advance for your help.
SteveHi Steve,
A couple of query templates you can use for your alerts are as follows:
Purchase Orders
SELECT T0.\[DocNum\], T0.\[DocDate\], T0.\[DocDueDate\], T0.\[CardCode\], T0.\[CardName\], T1.\[ItemCode\], T1.\[Dscription\], T1.\[Quantity\], T1.\[OpenQty\], T1.\[Price\] FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.\[DocDueDate\] < (getdate() -2) AND T1.\[LineStatus\] = 'O'
Sales Orders
SELECT T0.\[DocNum\], T0.\[DocDate\], T0.\[DocDueDate\], T0.\[CardCode\], T0.\[CardName\], T1.\[ItemCode\], T1.\[Dscription\], T1.\[Quantity\], T1.\[OpenQty\], T1.\[Price\] FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.\[DocDueDate\] < (getdate() -14) AND T1.\[LineStatus\] = 'O'
You can change the SELECT section to remove some of the columns or add extra columns if need be. Once your happy with the query you can attach it to an alert and set the frequency.
Regards,
Adrian -
Transaction code for Open sales order other than VA05
Hi all,
Can any one tell me what is transaction code for open sales order other than VA05.
Please help me .
Thanks & Regards ,
Srikanth P.Hi Srikanth,
You can try below options.
1- VA05N - This can be run for multiple sold to party & multiple material, etc which was not in VA05. But this doesn't have all columns in VA05 report.
2 - You can check the sales order tables from transaction SE11 or SE16N
Try with below tables for your requirement.
Sales order Header data - VBAK
Sales order Item data - VBAP
Schedule Line Data - VBEP
Business data - VBKD
Status header - VBUK
Status items - VBUP
Best regards,
Anupa -
Change open sales order with new condition schema
Hi SD Experts,
I have to change condition type on condition schema. For example, now we have ZPVI (Discount %). I have to change with ZPFI (Discount %). But we have some open sales orders with old schema. Can I correct old sales orders with new condition schema? Is it possible?
Thank you.
Gulay Celik>
Shai Sinai wrote:
> 3) The item categories of document items are assigned to billing plan types. This customization does create separate billing plan for each item, but the billing plans of item are refrenced to the header billing plan (according database field FPLA-RFPLN and screen field RV60F-KFREL), what means that item's values are not taken into consideration.
>
In this case it is obvious that it's not possible to have an item on the same document, which would have a billing plan different from the header. Unless, of course, you are ready to change the existing configuration or create a new item category, which would be independent from the header billing plan.
If, despite configuration, such entry is possible in VA41/VA42, then you'll have to use BDC instead of BAPI. Unfortunately, BAPIs do not have all the same functionality that might be available in the transaction. -
Transaction for Open Sales Orders
Hi Experts
can u let me know the Transaction for Open Sales Orders.
Regards,
kumaryou can check the tcode
VA05.
vijay -
New Report for Opens Sales order and P.O from Plant and S.Loc
Dear Gurus
We have repory requiement for Open sales order and P.O to deliver from particular plant and S.Loc.
If you have already developed this kiond of report help me inthis case.
Thanks
ramkiclosed
-
Collective deliveries for open sales orders
Is there any process or transaction code for creating the collective Picking for open sales orders.
In my company we are not using the Warehouse management, so we pick the goods manually.
If there is any way plzpost the answer.Check if VG01 helps you if you enter "K" as Group Type
Cheers -
Can someone tell me if there is any FM to list out the Open and Closed Sales Orders as per indicator?
Thanks,
Archana.you can check this program.... SDEWUORD
It contains the logic for open sales orders. you can check the routine FORM FILTER_OPEN_ORDERS in th above program it might be helpful for you.
siri...
check this fm also..........OPEN_ORDER_SALES -
BAPI For CREATE SALES ORDER WITH REFERENCE TO ORDER
Hi ,
I want to develop a new RFC for 'Creating Sales Order' with reference to another sales order -
Is there any BAPI available for the same ? (Version 4.7) - I know its available for new create and change
but couldn't find for create with reference to Order ...
Thanks in advance ...
Regards
Rajesh.Hi,
You can use this FM "/SAPNEA/SMAPI_ORDER_CREATE". I haven;t tried this but you can still give it a try. Mention the Reference Order Type and other data in the header work area and pass it to the FM.
Reward if it's useful.
Thanks,
Anil -
SD report for the open sales orders with items
Hi,
Is there any standard SAP report which display open sales order togeather with the open items. I want to have columns target quantity, delivered quantity and open quantity.
Any tip?
BR
SasoDear Saso,
I think, instead using Report: VA05/ VA05N; its better to use Report: VL10C
In this report, you will get all the Sales Orders along with Materials - relevant for open delivery, along with Open Qty. and various other options can be selected from "Change Layout - (Ctrlt+F8)".
Best Regards,
Amit
Note: Don't maintain any Field-Entry (while executing the Report: VL10N; in order to list all Sales Orders. But, if you want to list Sales Orders based upon some criterias, maintain the Field-entries, as reqd. -
Query for all open sales order with a date range
Hi Experts!
I wrote this query that will look up all open sales order of a particular customer and how much was served:
SELECT T0.[DocNum] 'OS #', T0.[DocDate] 'Posting Date', T0.[CardName] 'Customer', T1.[Dscription] 'Item Description',T4.[SalUnitMsr] 'Sales UOM', T4.[InvntryUom] 'Invty UOM', T1.[UseBaseUn] 'Use of Invty UOM' , T1.[Quantity], T1.[Quantity]-T1.[OpenQty] 'Served Qty', T1.[OpenQty] 'Unserved Qty' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.[DocStatus] = 'O' and T0.[CardName] =[%0]
However, I don't know how to input a parameter for the date range in a query. Can anyone help with this issue?
Your input will be highly appreciated.
Warm regards,
JenHiiiiiii
Try This.....
SELECT T0.DocNum 'OS #', T0.DocDate 'Posting Date', T0.CardName 'Customer', T1.Dscription 'Item Description',T4.SalUnitMsr 'Sales UOM', T4.InvntryUom 'Invty UOM', T1.UseBaseUn 'Use of Invty UOM' , T1.Quantity, T1.Quantity, T1.OpenQty 'Served Qty', T1.OpenQty 'Unserved Qty' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.DocStatus = 'O' and T0.CardName ='[%0]' and (T0.DocDate>='[%1]' and T0.DocDate<='[%2]')
Regards, -
Logic for Open Sales order qty
What should be the logic given to determine "open sales order qty" during designing a report.
Note the criterias are as under:
1) Open sales order qty is the confirmed qty less the delivery qty.
2) The delivery qty should be delivery order qty (The delivery should not necessarily be pick, packed & PGI)sorry it doesn't work for services, since they do not create requirements.
in this case you can use VBFA table, subracting all the delivered quantities VBFA-RFMNG with VBFA-VBTYP_N = J and VBFA-VBELV/VBFA-POSNV = to your order/item from the ordered quantities
hope this help you.
Roberto -
Dear all,
I need to create a open sales order report. Could you please tell me from which table i can get open sales order. Its standard report is VA05 and also I checked in table VBBE. but all record which i get from VA05 are not visible in VBBE table. It means VBBE doesnt carry all pending open records.
Please guide me from which table i can get it or what is the sriteria to get it?
Thankyou very much in advance
Punnet Sharmahi,
my logic goes like this:
Note: Open cursor is used since we are dealing with huge amnt of data:
* Select orders based on their Delivery status
SELECT vbeln
FROM vbuk INTO TABLE git_vbuk
WHERE lfstk = 'A' OR lfstk = 'B' .
* Filter selected orders
* Selection using open cursor
DATA: lwa_op_sal_ord1 TYPE gt_comtab.
IF sy-subrc = 0.
OPEN CURSOR c1 FOR
SELECT vbap~matnr
FROM vbap INNER JOIN vbak
ON vbap~vbeln EQ vbak~vbeln
FOR ALL entries IN git_vbuk
WHERE vbap~vbeln = git_vbuk-vbeln AND
vbak~vbtyp = 'C'.
DO.
CLEAR lwa_op_sal_ord1.
FETCH NEXT CURSOR c1 INTO CORRESPONDING FIELDS OF lwa_op_sal_ord1.
IF sy-subrc = 0.
APPEND lwa_op_sal_ord1 TO li_op_sal_ord1.
ELSE.
CLOSE CURSOR c1.
EXIT.
ENDIF.
ENDDO.
ENDIF.
here filter orders based on 'A' and 'B' from VBUK...
then frm header table VBAK get order for vbtyp ='C'.
now li_op_sal_ord1 will have open sales orders..
Moreover as per ur query y do u need the item data frm VBAP as u are only concerned abt VBELN.
If u need item u hv 2 run another select.
regards,
ags -
Hi..
my client want the report for all open sales orders in following manner :
CUSTOMER NAME ITEM 1 ITEM 2 ITEM 3 ITEM 4
Customer 1 23 45 54 76
Customer 2 10 20 30 50
Customer 3 40 10 30 10
TOTAL 73 75 114 136
please let me know the sql query which i can put in crystal report to creat this report
Regards
RakhihI rAK
HERE IS UR QUERY FOR OPENSALES ORDER I THINK THIS WILL SOLVE UR PROB
SELECT T0.[DocNum], T0.[DocDate], T2.[CardCode], T2.[CardName], T0.[DocTotal],
(T0.[GrosProfit]/(T0.[DocTotal]-T0.[GrosProfit])*100)'PROFIT%', T2.[CntctPrsn], T2.[Phone1], T3.[GroupName]
FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode
INNER JOIN OCRG T3 ON T2.GroupCode = T3.GroupCode
WHERE T0.[DocTotal]!= T0.[GrosProfit] and T0.[DocStatus] ='O'
GROUP BY T0.[DocNum], T0.[DocDate], T2.[CardCode], T2.[CardName], T0.[DocTotal],
T0.[GrosProfit], T2.[CntctPrsn], T2.[Phone1], T3.[GroupName]
REGARDS
JENNY
Maybe you are looking for
-
How do I add adobe flash player to my Ipad
How do I add adobe flash player to my Ipad
-
Hi Experts, FS10n & FBL3N Show difference Balance in same Account. Some Entry not include in FS10N Report which was automatic Entry through MIRO. What's the Resaon. Said Resaon I not doing to change the Open Items Management Regards,
-
Whenever i download any application, i got this message-" the application not installed on the iPhone because an unknown error occurred (0xE800000C)"...Please give me some solutions to resolve this issue..
-
Hi Guys, I have a template on my site. when i do changes on my local copy, it asks me to update all files. How can i update all the files on my remote server by just changing the template? is it possible? Even if i'm in remote view and i do the chang
-
Dear all, First I should say that I am relatively new to electronic music and mostly make rock. I do like to put synths in my music, and I am now getting more and more of a taste for adding more electronic effects too in to my recordings. What I am w