cancel
Showing results for 
Search instead for 
Did you mean: 

Date Formatted Search

Former Member
0 Kudos

I use the following Query to Transfer The Document Date in a Purchase order to Document Date in Purchase Invoice:

SELECT T0.[TaxDate] FROM OPOR T0 WHERE T0.[CardCode]=$[OPCH.CardCode]

Can anyone tell me please:

1. Do I need to change the syntax of the query to make it work?

2. I use the query to change the Document Date in the AR Invoice when I COPY (convert) the order to an Invoive. What would be the Refresh condition since no Fileds will be changing in the COPY process.

Thanks for your help

Robert

PS Without this Forum I would have given up on SAP but I am grateful for your contributions but I am getting there..

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member583013
Active Contributor
0 Kudos

Robert,

You can try this query

SELECT T0.TaxDate FROM [dbo\].[OPOR\] T0 WHERE T0.DocEntry=$\[PCH1.BaseEntry]

Please make sure you have made the BaseKey column at the A/P Invoice rows visible (from Form Settings)

This may work only when trigerred manually by highlighting the row and pressing Shift+F2

Former Member
0 Kudos

I have shown the Base Key field in my AP Invoice but it seems to have no Data. What is this field and the BaseEntry field for?

Thanks

Robert

former_member583013
Active Contributor
0 Kudos

Base Key Column is as you know the row level database field BaseEntry which holds the DocEntry of the Source document from which it was created. In your case I am presuming you are copying Purchase Order directly to AP Invoice so it should have the DocEntry of the PO

Suda

Former Member
0 Kudos

Hi Suda

I have Copied and pasted your Query but It gives me a Syntax error near PCH1. I am using B1 2007 and I wonder if the syntax is different.

Thanks

Robert

My Query Generator gives me the following but this is wrong as well?

SELECT T0.[TaxDate] FROM OPOR T0 , PCH1 T1 WHERE T1.[DocEntry] =$ T1.[BaseEntry]

former_member583013
Active Contributor
0 Kudos

I don't think the Syntax changed. Please confirm if you process is to copy the Purchase Order directly to AP Invoice (and you do not use the GRPO step)

The reason I ask asking is I am looking to fetch the PO's TaxDate by referencing it using the BaseEntry in the PCH1 (rows table)

There is nothing wrong with the syntax of my query.

Please also tell me which field you are using the Formatted Seach on the AP Invoice and how you are trying to execute it.

Suda

Former Member
0 Kudos

Thanks

former_member204969
Active Contributor
0 Kudos

If you derive the invoice from only one purchase order, you can solve the problem

1. First of all you can select the base order, from which the invoice was derived. You can use the Remarks field, that contains the order number (if you checked Base document number in the General documents setting)

2. you can set autorefresh when the Remarks changes.

3. in the query you should refer to the current remarks field by $\[OPCH.Comments]

4. you should use the charindex, substring and cast or convert functions to get the numeric order number

5. then you can get the document date from the order with this order number.

Former Member
0 Kudos

Hi Istvan

Thank you for the idea of placing a chagable field in the Remarks field. I will try this and I hope it works. However, in B1 2007 there is also a bug in the QPLD which causes the QPLD to behave strangely so I am a bit reluctant to activate QPLD for everyday work.

I hope SAP will sort this out soon but i am not sure what is the best way of reporting a BUG, do you know?

Thanks a lot

Robert