rohan_rege
18th September 2002, 17:22
Hi ,
I am using stpapi.find in the session tfacp1131s000 , after
putting the following values.

stpapi.put.field("tfacp1131s000" , "tdpur045.orno" ,str$(orno))
stpapi.put.field("tfacp1131s000" , "tdpur045.pono" ,str$(pono))
stpapi.put.field("tfacp1131s000" , "tdpur045.srnb" ,str$(srnb))

ret = stpapi.find("tfacp1131s000")

i have verified that the value i am putting in the Key fields do exist.

But the stpapi.find returns a zero , with the error message string empty .

I also tried using stpapi.browse.set with the first.set option, but it also returns zero with the error message set to empty.

Note : I have written the script for a company 100 which is a Finance Company....
the tdpur045 table data doesnt reside here ...but in the logistic company 110.....is this why the problem exist...???


Any Suggestions ??????


Rgds,
Rohan Rege

dbinderbr
1st October 2002, 20:10
Are you sure the variable orno, pono and srnb are empty?

Could you post the complete code of your script? It would help us to help you..

lbencic
1st October 2002, 23:46
Rohan -
The code would help to debug.

Are you saying:
tdsls045 data resides in company 110
Session tfgld1131s000 is being run (or more properly, should be run) from what company? 100, right?

So..you run the session in what company? Because the code depends on this. You can switch companies at a given time using the check.compnr() function - did you ever get that working?

So..assuming you start this from company 110, you need to do something like:
1. Read the tdpur045 data. No special read is necessary as you are already in this company.
2. Maybe store the tdpur045 data in temporary variables
3. Switch the company number to 100 using check.compnr() or similar. Check that this was successful.
4. Execute the api's to the tfgld1131s000 session - this should act as if you are in the 100 Company.

The biggie here is 'should'. I personally have not tested if the check.compnr() sticks when calling api's. Should be fine, but maybe there is a problem? If so..you should structure your program to be called from the 100 company, something like:

1. Read the tdpur045 data from company 110. Your current company is 100, so you would need to put in the select statement like:

select tdpur045.*
from tdpur045
where tdpur045._index1 = {:orno.in, :pono.in}
and tdpur045._compnr = 110

That allows the read to another company (110) from within the current company (100).
2. Execute the API's now from the native company 100, using tdpur045 data from 110.

Method 2 looks cleaner all around.

Post back if you are having problems, I know you said something earlier about the check.compnr() not working...? Good luck!

dbinderbr
2nd October 2002, 07:51
The code wouldn´t help just to debug, it would help also to show everything he did in the script, so, we wouldn´t have to make a lot of questions that could be answered just... looking the code.