Kingsto88
16th February 2005, 05:51
Hi anybody,


Below is my code. I am trying to change price and amount in sales order line.
I created a new session to enter new price and amount. I disable the price and amount in tdsls4102s000 so that noone can change the price there.

In my new session, I would like to update the sales order line according to baan functionality, so i decided to use AFS. I did as below but the price and amount is not being updated. Can anyone tell me what is wrong?

Thanks in advance.


stpapi.put.field("tdsls4102s000","tdsls041.orno",str$(zoom.orno))
stpapi.put.field("tdsls4102s000","tdsls041.pono",str$(zoom.pono))
ret = stpapi.find("tdsls4102s000",error)
if ret = 1 then
stpapi.put.field("tdsls4102s000","tdsls041.item",tdsls041.item)
stpapi.put.field("tdsls4102s000","tdsls041.pric",str$(pric.n))
stpapi.put.field("tdsls4102s000","tdsls041.amta",str$(amta.n))
ret = stpapi.update("tdsls4102s000",1,error)
if ret = 0 then
message("recover - %s",error)
ret = stpapi.recover("tdsls4102s000",error)
endif
endif
stpapi.end.session("tdsls4102s000",error)

kbartelds
16th February 2005, 13:00
If you disable fields on the form I think it is disabled for afs too. Price change will not work if multi level discount is enabled.

Regards,
Klaas

Kingsto88
17th February 2005, 11:23
Hi anyone or Klaas,

Can you confirm really this cannot be done. I need a solution for my issue.

1) I need to lock the price and amount field in maintain sales order lines.
2) I need to create a new session where user can key in any new price
or amount. Then this session may be used to update the sales order tables accordingly following baan functionality. I am doing it this way so that I can allow only certain users to use this new session to change prices ie. through session authorizations.

Anyone got any workaround? Or can I still pursue to do my way?
Can anyone help me to make the function server update the new price into
baan tables.

Appreciate any help and thanks in advance.

csecgn
18th February 2005, 13:01
Set the fields to input and write in the before.input section:



before.input.field.xxxx:
if not api.mode then
attr.input = FALSE
endif


So you can update the fields by AFS and they are locked for manual entry.

Regards
csecgn

Evert-Jan Bosch
18th February 2005, 14:05
I created a new session to enter new price and amount.

One comment on your post.
When you change the price, the amount is recalculated automatically.
So, what is the reason for adding the amount to the new session?

Paul P
21st February 2005, 04:25
Hi Kingsto88,

If you just wanna give access to the field "price" only to certain users, you can simply use table field authorisation to achieve that. Not a streamlined interface maybe, but at least no coding

Rgds,
Paul

Kingsto88
21st February 2005, 09:12
Hi csecgn

I don't have source code for the standard session, so cannot put the before.input section in

Hi Evert-Jan,

Need to put in amount just in case the qty is zero and the amount is the field that user enters, not the price.

Hi Paul
Using the field authorization is not good. If I put that in than it applies to all sessions but some other sessions there should not be any authorization.


Thanks all for your response

Hi Mark Holland,

Could you give a suggestion for my problem. If the price field is disabled, does that mean the api commands do not update the price field too?

Please Help anybody,

thnks and regards,

Juergen
21st February 2005, 10:53
Hi,

I agree with Klaas, if the fields are disabled for input (input condition = 0) they are disabled for AFS too.

Just an idea, but why not define the input condition for the form field in the way that the fields price and amount are only modifiable if the session is called through AFS.

Example:
Input/Ref. Expression for field price

api.mode = 2


Regards,
Juergen

mark_h
21st February 2005, 15:59
Hi csecgn

I don't have source code for the standard session, so cannot put the before.input section in

Hi Evert-Jan,

Need to put in amount just in case the qty is zero and the amount is the field that user enters, not the price.

Hi Paul
Using the field authorization is not good. If I put that in than it applies to all sessions but some other sessions there should not be any authorization.


Thanks all for your response

Hi Mark Holland,

Could you give a suggestion for my problem. If the price field is disabled, does that mean the api commands do not update the price field too?

Please Help anybody,

thnks and regards,

I am not familiar with this session so I do not know what work arounds there might be. If this field is dis-abled(and yes I agree with the other - it is disabled for AFS) then how does it normally get updated? That is what you need to duplicate in the AFS.

Without source there are several options you can pursue. First take the normal session and copy it to another session. The original session now becomes the ones that the users cannot modify this field. The second or new session is the one where you modify the form and let the users modify the field. Requires no code only one new session with a form modification.

Another option is to use RMCis, QKey or Vamsi extend source code to include the event section you require. My company uses Qkey to insert events like suggested in this post.

Mark

kbartelds
21st February 2005, 16:36
Maybe just an idea to solve this problem:
- set parameter recalcute price/discounts to automatic, enable the price field on the form, whatever the user does, price will be recalculated
- in the afs script, set the parameter to no, change price of orderline and reset the parameter

Regards,
Klaas