Formatted search: Query to get Delivery Date +30 in Newly created column
Hi Experts,
Becuase my client do not use serial numbers but wants to still see the date the 'Warranty Ending Date' on a Sales Order, I created an extra column in the Sales Order Lines named 'Warranty Ends'.
Now I want to populate the Delivery Date +30 on the Sales Order.... I'm stumped - I don't know where to begin with this query and I'm sure it is not that complicated.
Any help would be greatly appreciated.
Thanks!
Marli
Did you try the sql function DATEADD?
Here's a link to the MSDN help text on it:
http://msdn.microsoft.com/en-us/library/aa258267(SQL.80).aspx
Similar Messages
-
How to club 2 queries in one formatted search query
Hi All,
I have inserted a formatted search in the stock transfer for chnaging the 'From warehouse' based on series.
I have written following query for same,
SELECT $[$18.1.0]='08' WHERE $[OWTR.series] ='46'
It is working Fine
I want ot use same concept for selecting other based on other warehouse
e.g
SELECT $[$23.5.1]='02' WHERE $[OWTR.series] ='45'
But I am not able to club these queries on one formatted search query can anybody help to group it in one formatted search query....
Thanks and Regards,
Atul Joshi
Edited by: Atul Joshi on Dec 23, 2008 5:20 PMHi Atul,
You could define the quey like this
SELECT
CASE
WHEN $[OWTR.series]='46' THEN '08'
WHEN $[OWTR.series]='45' then '02'
end
from OWTR
Regards,
Vijay kumar
SAP Business One Forums Team -
Query to get the data of all the columns in a table except any one column
Can anyone please tell how to write a query to get the data of all the columns in a table except one particular column..
For Example:
Let us consider the EMP table.,
From this table except the column comm all the remaining columns of the table should be listed
For this we can write a query like this..
Select empno, ename, job, mgr, sal, hiredate, deptno from emp;
Just to avoid only one column, I mentioned all the remaining ( 7 ) columns of the table in the query..
As the EMP table consists only 8 columns, it doesn't seem much difficult to mention all the columns in the query,
but if a table have 100 columns in the table, then do we have to mention all the columns in the query..?
Is there any other way of writing the query to get the required result..?
Thanks..Your best best it to just list all the columns. Any other method will just cause more headaches and complicated code.
If you really need to list all the columns for a table because you don't want to type them, just use something like...
SQL> ed
Wrote file afiedt.buf
1 select trim(',' from sys_connect_by_path(column_name,',')) as columns
2 from (select column_name, row_number() over (order by column_id) as column_id
3 from user_tab_cols
4 where column_name not in ('COMM')
5 and table_name = 'EMP'
6 )
7 where connect_by_isleaf = 1
8 connect by column_id = prior column_id + 1
9* start with column_id = 1
SQL> /
COLUMNS
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,DEPTNO
SQL> -
Get Delivery date(EKET-EINDT) in MM Pricing routine(group condition)
Hi All,
I have created an MM pricing routine RV65A092 in VOFM. So when creating PO(ME21n), this routine will trigger..
Now the problem is I need EKET-EINDT for grouping condition. It was mentioned to call program SAPLMEPO and get EKET data.
Please help me how to get delivery date in that routine which is filled in Item level during PO creation
Thanks
RamHi Ram,
For SD you have the SAP Note 531835 - Using field PSTYV in the condition access. For MM is simmilar, although you must use the enahncements. Instead use the userexits that note says, use the enhancement LMEKO001 (EXIT_SAPLMEKO_001) to populate fields ZZ in KOMK and LMEKO002 to populate KOMP.
I hope this helps you
Regards
Eduardo -
Getting delivery date for material number i PO...
Hi,
I am Smartform associated with PO in ME22N:
Now I need to get the delivery date associated with Differnet Grid items in a material.
So if I go to some material and then if I click on Delivery schedule:
I see columns for delivery date, sat. del da, Grid value, etc...
But I want to know the table or function module we need to use to get Delivery date associated with
prticular Grid item of a material in PO.
Please help me out.
Thanks.
Regards,
Ramesh.Hi ,
Check out for BAPI_PO_GETDETAIL.
In this BAPI,
fill parameters : PURCHASEORDER with PO number
ITEMS with 'X'
SCHEDULES with 'X'
Then in tables PO_ITEMS you will get Item details and
in table <b>PO_ITEM_SCHEDULES</b> you will get required details like delivery date
Hope this helps.
Regards,
Akshay Bhagwat -
Mandatory Input in Formatted Search Query Field
I have created formatted search query. Which has only one field "Serial Number"? I have to ensure that, the user has to enter the value in that field. How to do that?
I was thinking on implement in stored procedure SBO_TransactionNotification with Object_Type = "219". But I am not sure, how to enforce the validation only for this search query. Because there are 50+ formatted search queries are available in the system.
Please helpHi Suresh
Check the below document
How to SET a UDF field as Mandatory Does TNSP required for It?
With Regards
Balaji Sampath -
Formatted Search Query on Delivery Date
Hi Experts,
I have another query that I have trouble with.
On the Sales Order Delivery Date, the Client needs this to populate the 'Posting date +3, when the UDF ORDR.U_Type is '1'.
When it is '2' it must populate the 'Posting date +5.
When it is '3' it must populate the 'Posting date +0.
I have started with the following, but found some errors:
SELECT CASE WHEN $[ORDR.U_Type] = '1' THEN $[$10.0.date]+3 ELSE
WHEN $[ORDR.U_Type] = '2' THEN $[$10.0.date]+5
Any help would be appreciated.
MarliTry this:
SELECT CASE $[ORDR.U_Type] WHEN '1' THEN DateADD(dd,3,$[$10.0.date])
WHEN '2' THEN DateADD(dd, 5,$[$10.0.date])
ELSE $[$10.0.date]
END -
Getting Delivery Date of an item on Purchase to appear in Sales Order form
Hi Experts
Can you tell me if and how it might be possible to get the future delivery date of an item on a purchase order to appear at the row level in Sales Orders for an item which is out of stock? I assume it will need some type of formatted search to pull the information out of the Purchase Order system or is there some standard SAP B1 functionality which I am not aware of?
Thanks
JonHi
It is very difficult to get that date in sales order coz too many conditions involve in the querry.
Ashish Gupte -
Formatted Search query for Vacation Accrued
Hi Experts,
I have a Client who needs to keep tract on the Vacation Accrued on the Employee Master Data. I have created this UDF on the Master Data, but I could not get the query for the Formatted Search right.
This Formatted search on the UDF ( must look at the OHEM.startDate field and populate the following:
If it is a still within year of the system date, it must populate 0,
If it is > 1 year and < 3 years, it must populate 5,
etc.
Any help would be greatly appreciated.
MarliHi Experts,
Here is what I did for the query mentioned above:
{SELECT
CASE
WHEN (T0.startDate > GETDATE() -356)
THEN 0
WHEN (T0.startDate > GETDATE() - 712)
THEN 5
END
As 'Vacation Accrued'
FROM OHEM T0}
The issue is that if I link this query to the UDF on the EMD, I get a list of 0 and 5 to choose from. I need to populate automatically.
Thanks.
Marli -
Formatted Search: How 2 get the active value
Hi ,
I defined a simple FS to learn, but keep getting the same values for different codes.
Shortly, I have 2 tables, first one (
REASON) keeps ReasonID,Reason Description, etc.
In the second one (MAIN) I enter other unrelated data and ReasonID.
I wanna get Reason Description from REASON table into that MAIN table by the help of FS. So I defined something like that:
SELECT T0.U_ReaDesc from .[@REASON] T0 , .[@MAIN] T1 WHERE T0.U_ReasonID = T1.U_ReasonID</b>
When I use this query, I keep getting the same reason description for different reason codes, actually the description of the first data in the REASON table.
Ouery settings : Search By Saved Query - Auto Refresh - When exiting altered column - Column "REASONID "- Refresh regularly
I guess, I have to add or change something in the query, so that I can refer to the <u>activ ReasonID value</u> in the MAIN table and get the descr. for it.
(Sorry if this subject is handled before but I couldn't find anything related in SDN.)
GüHi Gul,
Why don´t you download the help files from the SBO marketplace?
You can find a document about the FS under Service & Support SAP Business One Knowledge & Services Knowledge Base Customizing Formatted Searches.
There it explains lot of things about them.
The FieldId is the variable number seen when you are in debug mode. ColID is used only for matrix columns. And you could use 0 for the format is no formating is needed.
Regards,
Ibai Peñ -
Formatted Search Query for BatchNo
Dear All,
I am using the following query as formated search for Identifying the batches availble during the creation of Delivary document
in a user defined column at row level. When i click on this field it's showing the Batches for the Item with Zero Qty also.
I need to display only the batches where the QTY >0. This query displaying even the Zero Qty Batches also. Please help me to modify the below query for getting the above. Below is the query .
SELECT distinct T4.[BatchNum] FROM [dbo].[OIBT] T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN DLN1 T2 ON T1.ItemCode = T2.ItemCode INNER JOIN ODLN T3 ON T2.DocEntry = T3.DocEntry INNER JOIN IBT1 T4 ON T0.BatchNum = T4.BatchNum AND T3.DocNum = T4.BaseNum INNER JOIN OWHS T5 ON T0.WhsCode = T5.WhsCode WHERE T0.[ItemCode] = $[$38.1] AND T4.[WhsCode] = $[$38.24] AND T0.[Quantity]>=$[$38.11]
Regards
Srinii removed that T5, But It's showing the Batches where the qty in the main warehouse for that batch is Zero.That batch was actually present in another warehouse. And also when i am working on other warehouses it's showing the batches in the main warehouse where the qty is present.
Regards
Srini
Edited by: Srini on May 11, 2010 10:24 PM -
Formatted search - how to get table or form name
Hello,
I'm trying to create a generic query for modifying "Journal Remark" on different documents (Goods receipt, invoices ...) thru a formatted search
My problem is that I want to customize the "remark" according to the current document.
is there a way to get the table name or the form number in a query ? or should I to create a different query for each document ?
RegardsHi....
If you activate the System Information from Menu Bar> View> System Information. Then when you move the cusrsor from any of the document you get some variable values which displays the ID of forms colums and rows.
You can get this information for your FMS. There is no need to create no. of FMS for each Document. Just take the variables into the FMS and apply to the same ID documents.....
Regards,
Rahul -
Formatted search query with variable
Hi
I am trying to create a formatted search on a purchase order document.The scenario is as follows:
The issue is that the client will on certain stock records incur a tooling cost when raising a PO. This is a once off cost when they order a particular item. For example the tooling cost on a stock item is u20AC5.50. The cost price on the item is u20AC100. If they order for example 5 of these the total cost is u20AC505.50 i.e. u20AC100*5+tooling cost of u20AC5.50.
What we are attempting to do is pull through the tooling cost and add this on to the line total using a formatted search.
-UDF created on item record table. This is set type 'Unit and totals' and structure is 'Price'. This is called ToolingCost
-UDF created on marketing doc rows for ToolingCost. Again this is set to the same type and structure as the UDF on the item record.
-We have created a UDF on marketing row for total cost and set a formatted search against this with query attached that is attempting to calculate the total cost. We cannot get this to work and the problem would appear to be that the price field is a variable and this is causing an issue on the query. Can we include a variable field in our query and if so what should the syntax be?
Our query at the moment is 'SELECT 100*($[POR1.QTY.NUMBER])+($[POR1.U_TOOLINGCOSTS.NUMBER])
Note 100 in query syntax above to be replaced by price on POR1 table.
Can anyone provide assistence please.
Derek SmithHi Derek........
Try this.....
declare @var1_Qty as varchar(255)
declare @var2_Pr as varchar(255)
declare @var3 as float
declare @var4 as float
set @var1_Qty=$[$38.11.0]
set @var2_Pr=$[$38.14.0]
Set @var3=$[POR1.U_TOOLINGCOSTS.0]
set @var4=cast(substring(replace(@var2_Pr,',',''),0,len(replace(@var2_Pr,',',''))-3) as float)
select (@var1 * @var4)+@var3
Hope this will help you.......
Regards,
Rahul -
Formatted search query adding spaces
Hello,
I have created a table U_Items in SBO database.
I was trying to run this query using formatted search.
SELECT ItemDesc
FROM U_Items T0
WHERE T0.ItemCode = RTRIM(LTRIM('$[$38.1.0]'))
When the query gets executed '$[$38.1.0]' is repalced
by 'N'A00001 '' value.
I want the value to be 'A00001' so that it can match the record in the U_Items. How can I get rid of the trailing spaces?
Thanks,
SheetalHello Sheetal,
Your query,
SELECT ItemDesc
FROM U_Items T0
WHERE T0.ItemCode = RTRIM(LTRIM('$[$38.1.0]'))
I think must be
SELECT ItemDesc
FROM [@U_Items] T0
WHERE T0.ItemCode = RTRIM(LTRIM($[$38.1.0]))
if this is a user defined table.
I think your query seems ok. It doesn't work? -
Query for Getting previous date in oracle in specifc scenario
I have the below data in a table A which i need to insert into table B along with one compute column.
TABLE A:
Account_No | Balance | As_on_date
1001 |-100 | 1-Jan-2013
1001 |-150 | 2-Jan-2013
1001 | 200 | 3-Jan-2013
1001 |-250 | 4-Jan-2013
1001 |-300 | 5-Jan-2013
1001 |-310 | 6-Jan-2013
Table B:
In table B,there should be no of days to be shown when balance is negative and the date one which it has gone into negative.
So,for 6-Jan-2013,this table should show below data:
Account_No | Balance | As_on_date | Days_passed | Start_date
1001 | -310 | 6-Jan-2013 | 3 | 4-Jan-2013
Here,no of days should be the days when the balance has gone negative in recent time and not from the old entry.
I need to write a sql query to get the no of days passed and the start date from when the balance has gone negative.
I tried to formulate a query using Lag analytical function,but i am not getting how should i check the first instance of negative balance by traversing back using LAG function. Even the first_value function was given a try but not getting how to partition in it based on negative value.
Any help or direction on this will be really helpful.
ThanksI think you can apply the Tabibitoshan method here. The query is more complex but performs better than other methods. For an explanation, see Tabibitosan method tutorial by Aketi Jyuuzou
The idea behind the method is to identify "continuous" records without gaps. Here I identify records that are "continuous" because they contain an uninterrupted series of negative balances.
drop table t;
CREATE TABLE t (Account_No , Balance , As_on_date) AS SELECT
1001 ,-100 , to_date('1-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-150 , to_date('2-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 , 200 , to_date('3-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-250 , to_date('4-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-300 , to_date('5-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-310 , to_date('6-Jan-13', 'DD-MON-YY') FROM dual;
SELECT Account_No, Balance, to_char(As_on_date, 'DD-MON-YYYY') as_on_date,
CASE
WHEN balance < 0
THEN row_number() OVER(PARTITION BY account_no, grp ORDER BY as_on_date)
END days_passed,
CASE
WHEN balance < 0
THEN to_char(
first_value(as_on_date) OVER(PARTITION BY account_no, grp ORDER BY as_on_date),
'DD-MON-YYYY'
end start_date
from (
SELECT Account_No, Balance, As_on_date,
CASE WHEN balance >= 0 THEN NULL ELSE
row_number() OVER(PARTITION BY account_no ORDER BY as_on_date) -
sum(CASE WHEN balance < 0 THEN 1 ELSE 0 END) OVER(PARTITION BY account_no ORDER BY as_on_date)
end grp
FROM t
order by account_no, As_on_date;
ACCOUNT_NO
BALANCE
AS_ON_DATE
DAYS_PASSED
START_DATE
1001
-100
01-JAN-2013
1
01-JAN-2013
1001
-150
02-JAN-2013
2
01-JAN-2013
1001
200
03-JAN-2013
1001
-250
04-JAN-2013
1
04-JAN-2013
1001
-300
05-JAN-2013
2
04-JAN-2013
1001
-310
06-JAN-2013
3
04-JAN-2013
Maybe you are looking for
-
How can i assign a Javascript variable to JSP variable
Hi guys how i can assign a javascript variable to jsp expression., e.g., <input type = "button" value = "Add more" onclick = "return submitform1('<%=s%>')"> function submitform1(String s) var s1 = s document.form1.action = "../intimation.do";
-
Creative Suite CS6 on Windows and MAC.
Hello, I am running Creative Suite CS6 on Windows. I would like to run it also on my Macbook pro. How can I go about this? Thank you Marie
-
Loading an external .swf into an empty container
I'm loading an external .swf into an empty container. Everything seems to work fine except when the .swf is loaded both seems to be running extremely sluggish. The button rollovers are slow, the page transitions..everything. I can't figure out why it
-
I get video but no audio.
-
Hi, I believe I set the JAVA_HOME and path variable correct, but when I type command line command "javac" and "javadoc", they are not recognized. But the command "java" is recognized. Anybody would let me know how to sort it out? Thanks