_index1
22nd September 2022, 16:03
Hello folks,
I have the following problem and I hope you can help me.
In the tdsls4101m000 program I want to make a custom form command that calls the tcitr3600m000 session. I want to land in the intercompany order associated with the sales line and position. So I've programmed the following so far using Extensionmodeller.


function extern void function.ext.ic.command.execute()
{
ext.ic_nr = ""

select tcitr300.*
from tcitr300
where (tcitr300.obon = "tdsls040"
and tcitr300.oboi = :tdsls401.orno
and tcitr300.sitm = :tdsls401.item)
as set with 1 rows

selectdo
ext.ic_nr = tcitr300.orno
endselect



if ext.ic_nr <> ""
then
query.extend.where.in.zoom("tcitr300.orno = " & quoted.string (ext.ic_nr))
start.session (MODAL,"tcitr3600m000","", "")
else
message("Kein Intercompany Handelsauftrag gefunden!")
endif

}


The problem is that I would have to give a second parameter (tcitr300.pono) in the query.extend.where.in.zoom. Each intercompany position has the same intercompany entry, which is why I always end up on the 1st data record.

I hope you understand the Problem.

Greetings from Germany.

mark_h
23rd September 2022, 17:23
I think it would be something like - based off me searching query.extend on the board. Just remember I have only used 4c4. I think you could also tcitr300._index1 - assuming the index is orno, pono.

"tcitr300.orno = " & quoted.string (ext.ic_nr) & " and " & "tcitr300.pono = " & quoted.string(some.pono)

_index1
18th October 2022, 15:40
Hello,
thank you for the reply but it still doesn't work.

I get the following Error. (Screenshot)

Here is my code:
ic_pono is decleared as tcpono domain.



function extern void function.ext.ic.command.execute()
{
ext.ic_nr = ""

select tcitr300.*
from tcitr300
where (tcitr300.obon = "tdsls040"
and tcitr300.oboi = :tdsls401.orno
and tcitr300.sitm = :tdsls401.item)
as set with 1 rows

selectdo
ext.ic_nr = tcitr300.orno
ic_pono = tcitr300.pono
endselect



if ext.ic_nr <> ""
then
query.extend.where.in.zoom("tcitr300.orno = " & quoted.string (ext.ic_nr) & " and "& "tcitr300.pono = " & quoted.string(ic_pono))
start.session (MODAL,"tcitr3600m000","", "")
else
message("Kein Intercompany Handelsauftrag gefunden!")
endif

}


Greetings from Germany.

RieseUSA
19th October 2022, 03:48
ic_pono is a number (long) and quoted.string() expects a string as the argument.

Instead of putting a string into double quotes, you need to convert the number into a string. The following should do the trick. A number does not need to be in double quotes.

"tcitr300.orno = " & quoted.string (ext.ic_nr) & " and " & "tcitr300.pono = " & str$(ic_pono)

Grüße aus Kanada

_index1
19th October 2022, 09:03
Hello my friend,
thank you so much for your reply. It works perfectly! :D

For people with the same problem, here my full code with the solution.


function extern void function.ext.ic.command.execute()
{
ext.ic_nr = ""

select tcitr300.*
from tcitr300
where (tcitr300.obon = "tdsls040"
and tcitr300.oboi = :tdsls401.orno
and tcitr300.sitm = :tdsls401.item)
as set with 1 rows

selectdo
ext.ic_nr = tcitr300.orno
ic_pono = tcitr300.pono
endselect


if ext.ic_nr <> ""
then
query.extend.where.in.zoom("tcitr300.orno = " & quoted.string (ext.ic_nr) & " and "& "tcitr300.pono = " & str$(ic_pono))
start.session (MODAL,"tcitr3600m000","", "")
else
message("Kein Intercompany Handelsauftrag gefunden!")
endif

}