tion1976
20th January 2023, 12:02
I need to write a select statement with a WHERE clause on a tcbona domain field. Or, something to do this purpose.
select tfgld482.*
from tfgld482
where tfgld482.rbon = tdsls040 | TONI: tdsls040 is a BO
and tfgld482.idtc = 10002052
and tfgld482.rbid = :1
wherebind(1,tditc232.cvnz(1))
selectdo
| so some UTC datetime settings
endselect
When I compile the script it gets the following error:
ptiitt2432m0080( 170): Error SQL: SQLState 42I03: Unknown column 'tdsls040' (error 302)
How should I write the script to do those filter on rbon ?
Thanks:confused::confused:
bdittmar
20th January 2023, 14:52
Hello,
select tfgld482.*
from tfgld482
where tfgld482.rbon = tdsls040.<field>
.......
But in LN the sales orders are stored in table tdsls400
Regards
tion1976
23rd January 2023, 11:36
As far as I understand tdsls040 is in this case the Business Object tdsls040 and not the table called tdsls040
there is also an WHERE on field idtc - information document type
taht is more occured with respect to the value. for example, 10002052 or 10002062 , 10002072, 10002082
I am confused where these values come from.
OmeLuuk
23rd January 2023, 14:09
The field rbon is a string as is idtc, so the statement would be:
where tfgld482.rbon = "tdsls040"
and tfgld482.idtc = "10002052"
And what about the content of tditc232.cvnz(1), is this an array with 1st element is the complete ordernumber?
tion1976
25th January 2023, 10:33
@omeluuk
this is the same thing i did but it looks hacking and hardcoding to me.
i hoped there is some other way.
What about the idtc field? that has values like 10002052 or 10002062 , 10002072, 10002082. I am confused where these values come from.
please clarify the value meaning or how to get it. i understood from BA that the value to filter on is 10002052 but i am clear why.
OmeLuuk
25th January 2023, 18:28
this is the same thing
No it is not. The field tfgld482.rbon is a string and wants to compare to a string. The content of the string is "tdsls040" so compiling with my proposal would resolve your compilation errors.i did but it looks hacking and hardcoding to me.That is quite right. It is hard codedi hoped there is some other way.There is indeed, but you were not requesting that. You can refer to an external variable containing the value you are after. In these cases your code could look like:domain tcbona var.having.tdsls040
domain tfidty var.having.idtcvalue
var.having.tdsls040 = "tdsls040"
#IFDEF THIS
select tfgld457.idtc:var.having.idtcvalue
from tfgld457
where tfgld457.bonm = :var.having.tdsls040
selectdo
select tfgld482.*
from tfgld482
where tfgld482.rbon = :var.having.tdsls040 | TONI: tdsls040 is a BO
and tfgld482.idtc = :var.having.idtcvalue
and tfgld482.rbid = :1
wherebind(1,tditc232.cvnz(1))
selectdo
| so some UTC datetime settings
endselect
#ELSE
select tfgld482.*
from tfgld482, tfgld457
where tfgld482.rbon = :var.having.tdsls040 | TONI: tdsls040 is a BO
and tfgld482.rbon = tfgld457.bonm
and tfgld482.idtc refers to tfgld457.idtc
and tfgld482.rbid = :1
hint use index 2 on tfgld457
wherebind(1,tditc232.cvnz(1))
selectdo
| so some UTC datetime settings
endselect
#ELIF OR_WITHOUT_EXTERNAL_INPUT
select tfgld482.*
from tfgld482, tfgld457
where tfgld482.rbid = :1
and tfgld482.rbon = tfgld457.bonm
and tfgld482.idtc = tfgld457.idtc
hint use index 2 on tfgld457
wherebind(1,tditc232.cvnz(1))
selectdo
| so some UTC datetime settings
endselect
#ENDIFWhat about the idtc field? that has values like 10002052 or 10002062 , 10002072, 10002082. I am confused where these values come from. please clarify the value meaning or how to get it.From the table definition (or its RDD equivalent in %BSE%/dict/dd(packagecombination)/dtfgld/dtfgld482) you can see this:F
:NAME:tfgld482.idtc
:REFR:tfgld457.idtc
:REFM:0 0
:FILL:1
:DOMA:tcidtySo there is a reference from tfgld482.idc to tfgld457.idtc. So values are defined in session tfgld4557m000 (see the table name there?), together with their description. From here check the session help for functional use.i understood from BA that the value to filter on is 10002052 but i am clear why.Probably because they are just interested in "Sales Order/Issue" bookings.