Req:validtion query for sales quotation
Hi,
I would like to put validation for sales quotation when Freight1 Tax Code at line level is not empty
My query is:
if @object_type ='23' and @transaction_type in ('A','U')
begin
if exists(SELECT * FROM [dbo].[OQUT] T0 INNER JOIN QUT2 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN QUT1 T2 ON T0.DocEntry = T2.DocEntry
WHERE T1.TaxCode is not null and T0 .DocEntry = @list_of_cols_val_tab_del and
T2 .DocEntry =@list_of_cols_val_tab_del )
select @error=N'001'
select @error_message =N'Freight1 Tax code should be empty.'
end
but didnot get the result.Plz give the solution.
Hi Md Zak,
Try dis..
IF (@object_type = '23' and (@transaction_type IN ('A','U')))
BEGIN
If Exists (SELECT T0.DocEntry FROM OQUT T0 INNER JOIN QUT2 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN QUT1 T2 ON T0.DocEntry = T2.DocEntry
WHERE T1.TaxCode is not null and T0 .DocEntry = @list_of_cols_val_tab_del)
Begin
set @error = N'001'
set @error_message = N'Freight1 Tax code should be empty.'
End
END
Hope Helpfull
Regards::::
Atul Chakraborty
Similar Messages
-
Query for Sales Order Analysis
Dear Experts
I have written a Query for Sales Order Analysis and would like to have help on this.
The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum] ORDER BY T0.[DocNum]
where U_Total_GP is a UDF for storing the GP of each order.
After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. However, the query does not calculate column total for total amount and total GP. Although I know the total for each column can be displayed by pressing "Ctrl" + Click on the column title, it would have to be done from time to time.
Therefore, I would like to modify my query in order to calculate the column totals when executed. Are there any suggestions for this?
Thank you
Regards
EltonHi Elton,
Try this:
SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
Union ALL
SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
FROM ORDR T0 WHERE T0.[DocDate] =[%0]
ORDER BY T0.[DocNum]
Thanks,
Gordon -
Standard smartform name and standard print program name for Sales Quotation
Hi,
I would like to know the standard smartform name and standard print program name which can be used for sales quotation through transaction VA23.
For eg: The standard output type for billing document (For T code VF03) is RD00 and it' smartform name is LB_BIL_INVOICE. It's print program name is RLB_INVOICE.
Similarly, I would like to know the standard smartform name and standard print program name for AN00 output type which is used for sales quotation. .
Regards,
ZahidHello
std driver prgram is /SMB40/RVADOR01
form entry is ENTRY
std smartforms is /SMB40/SDQUO_A an du can check this the in NACE tcode.
Output Type AN00 Quotation
Application V1 Sales
Program /SMB40/RVADOR01
Form Routine ENTRY
Form RVORDER01
PDF/Smartform Form /SMB40/SDQUO_A
Thank u,
santhosh -
Hi All,
I have made an UDF at title level named priority and set values as High, Medium and Low. When we make a sales order, we set the priority as well. Now the customer wants a query where he can get the details of number of sales quotations made within a week and two weeks range and that too based on the priority i.e the report should show the Highest priority Sales quotation first and so on. I have come up with an SQL but i dont know how to get the date range i.e week range and how to set the report according to the priority level. Can anyone please suggest how to correct this query;
SELECT T0.[CardCode], T0.[CardName], T1.[CntctPrsn], T0.[DocDate], T0.[DocDueDate], T0.[DocNum], T0.[U_Priority] FROM OQUT T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
Thanks in advance,
Joseph
Edited by: Joseph Antony on Mar 5, 2009 11:32 AMYou can try this first:
SELECT T0.CardCode ' Code' , T0.CardName 'Name' , T0.CntctCode, T0.DocDate, T0.DocDueDate 'Valid Untill' , T0.DocNum, T0.U_Priority
FROM DBO.OQUT T0
WHERE DateDiff(ww,T0.DocDate,GetDate())< 3
Order By T0.U_Priority
Thanks,
Gordon -
Approval for Sales Quotation, Invoice & Delivery Level
Hi ,
In my Business Scenario the client want to approval strategy in different level
1. Sales Quotation Approval from HOD.
2. In Delivery Level they want 3 types Approval like Sales HOD, Customer & Quality HOD.
3. In Invoice Level they required FI HIOD approval
please guide me how to Configure in the SAP step by step becuase i m new to this configuration.Please search the forum with the text "Sale Order Release strategy". You can see lot of threads discussed on this topic. Take the inputs from there. Adopt the same logic to quotation and delivery also.
thanks
G. Lakshmipathi -
Query For Sales Order Amendments
Hi,
Does anyone have a query that lists the amendments to a Sales Order?
I basically want to create an alert that runs this query once a day and shows me the sales orders that have been amended that particular day.
Any help on this would be gratefully received.
Regards
DavidHi..
Try These Query in Alert you will get your req. fulfill
SELECT T0.[DocNum], T0.[DocStatus], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName] FROM ADOC T0 WHERE T0.[ObjType] = 17 AND T0.[UpdateDate] = GETDATE()
Regards,
Bhavank
Edited by: Bhavank on Sep 28, 2010 5:50 PM -
Query for Sales order and corr.AR Invoice Info
Hi,
I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
Sales Order columns reqd:
OPERATING_UNIT
ORDER_NUMBER
CUSTOMER_NUM
CUSTOMER_NAME
ORDERED_DATE
FLOW_STATUS_CODE
TOTAL_ORDER_AMOUNT
AR invoice columns reqd for the sales orders:
Invoice number,
Invoice date,
Invoice Total.
Can anyone help me out with this?
Thanks,
AshHi Ash,
There are some issues that must be defined before you have the exact query.
Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
Hope it helps,
Ketter Ohnes
create or replace view order_summary as
select oh.org_id,
oh.ORDER_NUMBER,
oh.header_id,
ott.name tt_name,
ca.account_number,
p.party_name,
oh.ordered_date,
oh.flow_status_code,
sum(ol.ordered_quantity*ol.unit_selling_price) total,
sum(ol.tax_value) tax,
(select sum(operand)
from OE_PRICE_ADJUSTMENTS_v x
where x.header_id = oh.header_id
and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
from oe_order_headers_all oh,
oe_order_lines_all ol,
hz_cust_accounts ca,
hz_parties p,
oe_transaction_types_tl ott
where ol.header_id=oh.header_id
and oh.sold_to_org_id = ca.cust_account_id
and ca.party_id = p.party_id
and oh.order_type_id = ott.transaction_type_id
and ott.language =
(select language_code
from fnd_languages
where installed_flag = 'B')
group by oh.org_id,
oh.header_id,
oh.ORDER_NUMBER ,
ott.name,
ca.account_number,
p.party_name,
oh.ordered_date,
oh.flow_status_code;
create or replace view invoice_summary as
select a.interface_header_context,
a.trx_date,
a.trx_number,
b.interface_line_attribute1,
b.interface_line_attribute2 tt_name,
a.customer_trx_id,
sum(b.extended_amount) invoice_total
from ra_customer_trx_all a,
ra_customer_trx_lines_all b
where a.customer_trx_id = b.customer_trx_id
and b.interface_line_context = 'ORDER ENTRY'
and b.line_type in ('LINE','FREIGHT')
group by a.interface_header_context,
a.trx_date, a.trx_number,
b.interface_line_attribute1,
b.interface_line_attribute2,
a.customer_trx_id;
select *
from order_summary o,
invoice_summary i
where o.order_number between :1 and :2
and o.order_number = i.interface_line_attribute1
and o.tt_name = i.tt_name; -
Query for Sales Order and AR Invoice Information
Hi,
I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
Sales Order columns reqd:
OPERATING_UNIT
ORDER_NUMBER
CUSTOMER_NUM
CUSTOMER_NAME
ORDERED_DATE
FLOW_STATUS_CODE
TOTAL_ORDER_AMOUNT
AR invoice columns reqd for the sales orders:
Invoice number,
Invoice date,
Invoice Total.
Can anyone help me out with this?
Thanks,
AshHi Ash,
Table RA_CUSTOMER_TRX_ALL can be joined to RA_CUSTOMER_TRX_LINES_ALL table through CUSTOMER_TRX_ID column. The table RA_CUSTOMER_TRX_LINES_ALL.INTERFACE_LINE_ATTRIBUTE6 = OE_ORDER_LINES_ALL.LINE_ID. And from the LineId, you can get the HeaderId os the OE_ORDER_HEADERS_ALL table.
You must have visualized the query by now.
Thanks
Sumit -
How to Create Specific SAP Query for Sales BOM
Dear All Salute !!
How I can create a SAP Query which provide information from the Sales Order-Line Item, this specific material is having any BOM or not?
Suppose, user want Input,
Sales Order No., Product Category, Duration of Sales Order Release.
want Output,
Sales Order No., Customer No., Customer Description, Sales Order Line Item, Material No., Material Description, Delivery Date, Quantity, Sales Order release Date
Users requirement is, List of All Line Items for which BOM is yet to be Uploaded in the System.
Please provide complete detail with Table & field by using SAP Query.
Rgds
Srivastav
+91-9973504950If I am correct, in table KDST, you can see the details of Sales BOM with sale order. Since right now, I dont have access to SAP, I am unable to confirm this. You have to consider this table and develop on your own logic with the help of ABAPer.
thanks
G. Lakshmipathi -
Warranty related query for sales item
hi I need a report for checking an sales item is under warranty or not & also I want to know the status of the products which comes under warranty is in open state or closed state Regards, K.Ramasamy
Hi,
Try this query:
SELECT T0.[ItemCode], T0.[ItemName], T1.[TmpltName], T1.[Deleted] FROM OITM T0 inner join OCTT T1 on T0.[WarrntTmpl] = T1.[TmpltName] WHERE T0.[SellItem] = 'y'
Thanks. -
Hello,
Can SAP 8.8 deal with sales invoices to spain, specifically with something call a 'pharmacy scheme'. I'm informed that there are two elements to the VAT under this scheme. 1) Value added Tax. (18%) 2) Equivelance VAT (4%). Does SAP deal with this at all and if so, Is it possible to report on this for VAT purposes ?
Regards,
JuanHave contacted SAP directly.
-
i have problems with a query, i need that have the follows fields.
SELECT T0.[DocNum] AS #Doc, T0.[NumAtCard] AS Referencia, T0.[docDate] AS Fecha, T0.[LicTradNum] AS RFC, T0.[CardName] AS 'Nombre del Cliente', T0.[DocTotalFC] AS TotME, T0.[DocRate] AS 'TC Fact', T0.[DocTotal] AS TotMS, T0.[VatSumFC] AS 'IVA ME', T0.[VatSum] FROM [dbo].[OINV] T0
But i need to know if this invoices have a PR, RF, RC,etc.
I saw that ORIN(RIN1) is for -> RC, OINV(INV9) -> RF, ORCT -> PR but i dont know how make a correctly INNER JOIN. When the invoice have a PR giveme Num of PR, if the invoice have a RC giveme the number of document destination.
So, how can i join these tables for get that information.
Thank you for you help.SELECT * FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
This is a basic inner join created from the SAP Query Generator
Template would be
Select <field names> FROM <base table name>
Inner join <table you want to join> on <<condition you want to two tables to joins>>
or
Simply you can write it
SELECT * FROM ORDR T0, RDR1 T1 WHERE T0.DocEntry = T1.DocEntry
it will do the same thing and you can simply join more tables.
Hope this will help...
Sanjaya -
Hi Expert I am trying a query in this query i got these feild - TransType,Docdate,Docnum,CardName,Tinno,Impoexp,Exportsale,Outward Transfer/Central Sale,form No,Total sale,Local sale,Taxcode, output tax amount total Sale including Tax,Receiver Location . Through This Query----
select tmp1.form as [TRANS TYPE],tmp1.Docdate,tmp1.DocNum,tmp1.CardName,tmp1.TaxId11 as [TIN NO.],tmp1.IMPOREXP ,tmp1.Import as [EXPORT SALE],tmp1.INVTRANS as 'OutWard Transfer/Central Sale',tmp1.FormNo ,tmp1.Import+tmp1.INVTRANS 'TotalSale',tmp1.B4Tax as [LOCAL SALE],tmp1.TaxCode AS [TAX CODE],tmp1.VatSum as [OUTPUT TAX AMOUNT] ,tmp1.DocTotal 'TOTAL SALE INCLUDING TAX' ,tmp1.Location AS [RECEIVER LOCATION] from ( SELECT 1 'Order1','Sales-N' 'Form', T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,(case when t3.TfcId=1 then T0.DocTotal else 0 end)DocTotal ,(case when t3.TfcId=2 then T0.DocTotal else 0 end) 'INVTRANS' ,'' 'FormNo' , (case when t3.TfcId=1 then T1.TaxCode else null end)TaxCode ,(case when t3.TfcId=1 then T0.VatSum else 0 end)VatSum, (case when t3.TfcId=1 then (T0.Doctotal-T0.VatSum-t0.totalexpns) else 0 end) 'B4Tax' ,T2.IMPOREXP, 0 'Import' ,T5.Location FROM [dbo].[OINV] T0 Left Outer Join INV1 T1 ON T0.DocEntry = T1.DocEntry left outer join INV12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from INV1 where INV1.DocEntry = T0.DocEntry ) and T3.TfcId in('1','2') and T2.IMPOREXP 'Y' and T0.DocType = 'I' and t0.docdate>='[%0]' and t0.docdate<='[%1]' Union SELECT 2 'Order1','Sales-Y' 'Form',T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,0 ,0,'','', 0,0 ,T2.IMPOREXP,T0.DocTotal 'Import' ,T5.Location FROM [dbo].[OINV] T0 Left Outer Join INV1 T1 ON T0.DocEntry = T1.DocEntry left outer join INV12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from INV1 where INV1.DocEntry = T0.DocEntry ) --and T3.TfcId = 1 and T2.IMPOREXP = 'Y' and T0.DocType = 'I' and t0.docdate>='[%0]' and t0.docdate<='[%1]' union select tmp3.Order1,'INV' 'Form', tmp3.DocDate,tmp3.DocNum,tmp3.[CardName], tmp3.TaxId11,0,sum(tmp3.DocTotal) 'INVTRANS',isnull(tmp3.FormNo,'') 'FormNo' ,'' 'TaxCode', 0 'VatSum', 0 'B4Tax', '' 'IMPOREXP' , 0 'Import', tmp3.fromloc from (SELECT 3 'Order1',T4.Location 'fromloc',T0.[DocNum], T0.[DocDate],T0.U_INV_Transferor, T0.[CardName] ,T6.Transcat,(t10.credit)DocTotal ,T0.U_TIN_NO, T9.TaxId11,T6.FormNo FROM OWTR T0 INNER JOIN WTR1 T1 ON T0.DocEntry = T1.DocEntry AND T1.LINENUM = 0 AND Substring(T0.Filler,1,3) <> Substring(T1.WhsCode,1,3) INNER JOIN WTR12 T6 ON T0.DocEntry = T6.DocEntry INNER JOIN OJDT T7 ON T0.TransId = T7.TransId and T0.objtype = T7.transtype inner join jdt1 t10 on t7.transid=t10.transid left outer join owhs T2 on T2.whsCode = T0.filler left Outer join owhs T3 on T3.whsCode = T1.WhsCode left OUTER Join OLCT T4 on T4.Code = T2.Location left OUTER Join OLCT T5 on T5.Code = T3.Location left outer join OCRD T8 on T0.CardCode = T8.CardCode left outer join (select * from crd7 where crd7.addrtype = 'S') T9 on T8.CardCode = T9.CardCode and isnull(T9.Address,'') '' where T0.Jrnlmemo 'Cancelled' and isnull(T0.Comments,'') not like 'Inventory transfer no. % has been cancelled' --and T4.Location = 'MUMBAI' and t0.docdate>='[%0]' and t0.docdate<='[%1]' ) tmp3 group by tmp3.Order1, tmp3.DocDate,tmp3.DocNum,tmp3.U_INV_Transferor, tmp3.TaxId11,tmp3.[CardName], tmp3.U_TIN_NO,tmp3.FormNo, tmp3.fromloc union SELECT 4 'Order1','AR Credit-N' 'Form', T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,(case when t3.TfcId=1 then -T0.DocTotal else 0 end)DocTotal ,0 'INVTRANS','' 'FormNo' , (case when t3.TfcId=1 then T1.TaxCode else null end)TaxCode ,(case when t3.TfcId=1 then -T0.VatSum else 0 end)VatSum, (case when t3.TfcId=1 then -(T0.Doctotal-T0.VatSum-t0.totalexpns) else 0 end) 'B4Tax' ,T2.IMPOREXP, 0 'Import' ,T5.Location FROM [dbo].[ORIN] T0 Left Outer Join RIN1 T1 ON T0.DocEntry = T1.DocEntry left outer join RIN12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from RIN1 where RIN1.DocEntry = T0.DocEntry ) and T0.DocType = 'I' and T3.TfcId = 1 and T2.IMPOREXP <> 'Y' and t0.docdate>='[%0]' and t0.docdate<='[%1]' union SELECT 5 'Order1','AR Credit-Y' 'Form',T0.Docdate,T0.DocNum ,T0.CardName,T2.TaxId11 ,0 ,0,'','', 0,0 ,T2.IMPOREXP,-T0.DocTotal 'Import' ,T5.Location FROM [dbo].[ORIN] T0 Left Outer Join RIN1 T1 ON T0.DocEntry = T1.DocEntry left outer join RIN12 T2 on T0.DocEntry = T2.DocEntry left outer join OSTC T3 on T1.TaxCode = T3.Code left Outer join owhs T4 on T4.whsCode = T1.WhsCode left OUTER Join OLCT T5 on T5.Code = T4.Location where T1.LineNum = (select Top 1 linenum from RIN1 where RIN1.DocEntry = T0.DocEntry ) --and T3.TfcId = 1 and T2.IMPOREXP = 'Y' and T0.DocType = 'I' and t0.docdate>='[%0]' and t0.docdate<='[%1]' )tmp1 --where Tmp1.Location = 'SAHIBABAD' order by docdate, order1
Now i want modifiy this report like TransType,Docdate,Docnum,CardName,Tinno,Impoexp,Exportsale,Central Sale,TAx Code of central Tax,TAx Amount of central Tax,form No,Total sale,Local sale,Taxcode, output tax amount total Sale including Tax,Inventory Transfer Doctotal,Receiver Location .
Thanks in Advance & regard KhanHi Khan,
Can you share your solved Sales Register query with us?
Regards,
Vincent -
Approval Query for Sale Delivery Problem
Hello,
I have to set approval procedure of Sale Delivery in following condition
If i add sale order for Specific item for 10 Qty for example C01 customer & after that i add sale order for same item qty 10 for another customer ie C02 & i have stock for that item 50 but user give delivery first to C02 in staid of C01 but C01 give me first order
on this condition i have to set approval user can't deliver second sale order first he have to take approval from manager to do this & he deliver first order first then then don't have to need approval.
Can any one help me?Hi,
Row level approval is not possible in SBO.
You may check this for your reference: http://www.beonesolutions.com/ip/Solutions/ap.html
Thanks,
Joseph -
Select query for sales order for particular customer oder text and storage
Hi All,
I am trying to retriev customer order text and customer storage bin from the following select query, but it's giving huge number of records, I want to restrict the number of records.
Select customer order text, customer storage bin
Select STXHTDOBJECT, STXHTDID
Where TDOBJECT = VBBP
TDID = Y001
TDID = Y007
Please let me know how to restirct the number of records.
Thanks,
RanjanTry using the FM 'READ_TEXT'.
NAME will be the order number concatenated with the item number.
And you have the ID and OBJECT. You may also need to use the LANGUAGE.
Message was edited by:
Matt Nagel
Maybe you are looking for
-
How do you email photos from an iphone to a business email so that the photo shows up as an attachment vs. a part of the body of the email?
-
Command To Retrieve IP's being used in network
Can anyone tell me how I can find out from my iMAC what IP addresses are being used? I am trying to setup BackMyFruitUp and it requires that I know the DROBOShare IP address in order to access it. Thanks
-
What does Inline object "Y offset" mean exactly?
Hi everyone, I am confused about inline object y offset. What does it mean exactly? I looked it up on adobe help, here is what it says there. Inline Aligns the anchored object with the baseline of the insertion point. You can adjust the Y Offset to p
-
Hi, I am new in BPEL. I have created a new domain in our BPEL Server. Then I invoke deploing to that domain (I deploy HelloWorld sample). In the log window I got info : bpel_HelloWorld_1.0.jar deployed successfully But I can't find this process using
-
Strange window popped up.
Strange window popped up and I have no idea how i launched it. It could not be closed unless iOS restarted. What is this window for?