justknowledge
18th January 2007, 06:24
hi,
I am using AFS for purchase contracts tdpsc0101m000 and tdind271s000 for updateing purchase contract as well as localization data lines but my problem is when need to update multiple contracts and postions corresponing to particular supplier and item .
for example for one supplier and item i have many contracts and out of those contract i want to change purchase price of 3 contracts which is shown in display session multiocc row wise now when i mark these three contract syestem does not update only those rows which have been marked .
i am already using predefined variable like
***************
if marked then
for i = 1 to lattr.occurnr
if marke.table(i) then
do.occ(i,update.purchase.contract) |for the line which have been marked
endif
endfor
endif
**************
however it is not working at all correct
please suggest me how should i handle such operation.
thanks
Regards
bigjack
18th January 2007, 07:05
Couple of clarifications required,
I assume the predefined variable you are using is fattr.occurnr and not lattr.occurnr(that is a typo error, i guess)
Where have you placed the "for loop"? Is the "for" loop working correctly ? I mean assuming you are selecting only 3 records out of 8 records , is the function update.purchase.contract() called only 3 times? If yes is the AFS code marking the record using stpapi.mark() and then executing the required action?
Is it possible for you to post your complete code to precisely identify what is wrong.
Cya
justknowledge
18th January 2007, 07:12
hi,
Thanks for replying.
it is fattr.occurnr not lattr.occurnr (typing mistake)
I am attaching my piece of code please go through it.
Thanks
Regards
bigjack
18th January 2007, 07:34
Hi,
You have not answered my earlier question , If you mark three out of 8 records , how many times is the function update.purchase.contract() called? This will help us to identify whether the problem lies with the do.occ function or the AFS code.
The localisation session seems to be a sub-session, which i think is actvated from main session by either button or from specific menu.Similarly the same localisation session should be called in AFS code also thro' stpapi.application.option or stpapi.zoom.option calls. I've seen many localisation sessions giving problem when called via AFS.
But before all further analysis, atleast try and identify the source of problem. Let us know whether the do.occ is misbehaving or the AFS code.
Cya
justknowledge
19th January 2007, 06:26
Thanks Big jack for your valuable support my program is working fine now
but now i am facing another problem that when i am updating tdind0271s000 session through AFS my ASV Value is not getting updated suppose if i have two contract first time it doesnot update first contract ASV value and in next contract it update price in ASV Value
i am not getting where exactly problem is .
Please help me in this regard, i am also attaching my code
Thanks
Regards
bigjack
19th January 2007, 06:42
Hi,
How is the session tdind0271s000 called from session tdpsc0101m000? I think its a subsession so you cant call it directly.Is there any button to activate it or is the session included in the special menu. So accordingly you need to call either stpapi.application.option or stpapi.zoom.option. Make sure you use stpapi.handle.subproc() to allow the localisation session to be called.
At the bottom of your code i see that you have a function call like stpapi.end.session("tdind0270s000"). Is this session causing the trouble. Confirm from your functional consultants abiut the scope of this session. I also dont see a stpapi.handle.subproc() for this session IT IS VERY IMPORTANT TO CALL stpapi.handle.subproc() FOR HANDLING SUBSESSIONS.
Last but not least, as ive pointed out in my earlier post, the localisation sessions tend to pose problems in AFS. Either they are not called , or like in your case the values are not updated. I hope the above checks solve your
problem
Keep us updated on your findings. Too bad i dont have the localisation setup currently else i would have given it a try.
Cya
justknowledge
19th January 2007, 06:51
well,
using stpapi.handle.subproc() is ok however without using that it is calling the localization session .
ending session for tdind0270s000 is must bez. automatically purchase contract call this session when u tab from effective date "that session is actully locallization header"
streight away session tdind0271s000 is updating ASV value like for first record it does not update asv for 2nd record it update price in asv value.
i am really nowhere near to where the problem is
can you please please help me in this regards
Regards
Nitesh
bigjack
19th January 2007, 07:30
Well the localisation session will be called, but the values will not be passed from parent session to localisation session. I managed to see the form of this localisation session and i have observed that the find command is disabled and also the key fields docu.no & posi.no are display fields. This indicates that the values are being imported from the parent session and you should not set their values like you have did in your script.
The main point is use stpapi.application.option or stpapi.zoom.option to call the localisation session, stpapi.handle.subproc will inform the parent session that a subsession is likely to be activated soon. If the localisation session is automatically started whenever you tab thro' a field then you dont require the above two function calls , but still stpapi.handle.subproc is a MUST.
If you goto maintain sessins and run the localisation session from there, the localisation session will start with a blank order no. This is what happens when you call the localisation session directly as you are doing in your code.
I really dont how the price is updated, but the very fact that it is behaving oddly hints that you are not calling the subsession in a right way.
I did a quick search on baanboard for tdind0271s000 and found folowing posts,
In following code just look at the way record is inserted in tdind0271s000 , there is no need to pass values to docu.no & posi.no if handled properly via stpapi.handle.subproc()
http://www.baanboard.com/baanboard/showthread.php?t=23295&highlight=tdind0271s000
I hope it helps
Cya