Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   AFS/DDC/OLE: Function servers (http://www.baanboard.com/baanboard/forumdisplay.php?f=59)
-   -   How to press "OK" button through AFS in ERP LN FP7. (http://www.baanboard.com/baanboard/showthread.php?t=64561)

patwanirav 11th September 2013 12:20

How to press "OK" button through AFS in ERP LN FP7.
 
2 Attachment(s)
I am unable to press "OK" button of the attached session "tfacp1210m000" through AFS.

When i use the "stpapi.continue.process" or "stpapi.save", it gives me error "Command Disable".

When i use stpapi.end.session, the data is not populated into the parent session. My code is as bolow.
Code:


stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error)
ret = stpapi.synchronize.dialog("tfacp1110s000", "add", error)               
stpapi.form.command("tfacp1110s000", 5, "copy.from.preregistration", error)
if isspace(error) then
    stpapi.put.field("tfacp1210m000","tfacp100.ninv",str$(lpbpm501.ninv))
    ret = stpapi.find("tfacp1210m000",error)
    if isspace(error) then
        ret_1 =stpapi.mark("tfacp1210m000", error)
        stpapi.enum.answer("tfacp1210m000", "tfacps1110.3", tcyesno.yes)
        stpapi.end.session("tfacp1210m000")
    endif
endif

Now if the above code is perfect then why it is not populating data to the parent session "tfacp1110s000" through AFS. Because after writing the above code when i write code

ret = stpapi.insert("tfacp1110s000", 1, error )

it gives me error "Cash Flow reason must be filled."

Please help...

Thanks in advance...:)

mark_h 14th September 2013 22:32

Typically the okay button is the same as the continue button. At least in 4c4 that is what it usually is - and I just use the continue command. So try just using the stpapi.form.command for continue - that might work. Having said that sometimes there is code in a standard session that might prevent AFS code from working. I am not familiar enough with LN to know how these sessions work or what would work with these sessions.

bhushanchanda 15th September 2013 08:06

Hi,

As Mark said, LN works the same way. You need to use continue command to press the OK button.

Try this:-

stpapi.form.command( "tfacp1110s000", 5, "exec.cont.process", error )

vaishrii 7th March 2014 08:11

This is in regard with the same case stated above..

I am facing the issue in AFS of Purchase Invoice Entry (tfacp2600m000) on ERP LN FP9 version.
From this session i want to zoom to subsession tfacp1210m000 to copy the Received Invoice...

The standard script of (tfacp2600m00) calls the function copy.from.preregistration()

and in this function the command to get the zoom.ninv value is ;
zoom.ninv = lval(start.session(MODAL,"tfacp1210m000", prog.name$,"tfacp100.ninv"))

and based on value returned from the zoom session the copy record function is executed i.e record from Received invoice(tfacp1210m000) is copied to main session tfacp2600m000
(table tfacp100 record is copied to tfacp200 and status is updated in tfacp100 to copied.)

The afs works fine for main session i.e Batch creation (tfgld1101m000) / transaction type entry. (tfgld1101m100)
but once tfacp2600m000 starts, it fails for copy.preregistration fucntion()
no value returned from zoom sesssion and i get the afs error 'Record not found' and hence unable to save the invoice in tfacp2600m000 session.

please refer the afs code below:
stpapi.put.field("tfgld1101m000", "tfgld100.year", str$(year))
stpapi.put.field("tfgld1101m000", "tfgld100.btno", str$(btno))
ret = stpapi.find("tfgld1101m000", error)
if ret then
stpapi.handle.subproc("tfgld1101m000","tfgld1101m100","add")
stpapi.put.field("tfgld1101m100", "tfgld101.year", str$(year))
stpapi.put.field("tfgld1101m100", "tfgld101.btno", str$(btno))
stpapi.put.field("tfgld1101m100", "tfgld101.ttyp", str$(ttyp)) ret_1 = stpapi.find("tfgld1101m100", error)
if ret_1 = 1 then
ret_1 = stpapi.mark("tfgld1101m100",error)
stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error)
if ret_1 = 1 then
ret = stpapi.insert("tfacp2600m000", 1, error) stpapi.put.field("tfacp2600m000","tfacp200.ttyp",str$(ttyp))
stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error)
if isspace(error) then
stpapi.put.field("tfacp1210m000","tfacp100.ninv",str$(ninv))
ret = stpapi.find("tfacp1210m000", error)
if ret then
ret = stpapi.mark("tfacp1210m000",error)
if ret then
stpapi.form.command("tfacp1210m000", 5, "exec.end.program",
error)
(tried to end the session with above command ) and even stpapi.form.command("tfacp1210m000", 5, "exec.cont.process", error) does not work
stpapi.end.session("tfacp1210m000", error) - with this sesion ends
once we come out of session tfacp1210m000 , system gives the message (tfacp1210.02) , just press ok and invoice is copied , but this message is also not seen in backend when afs is executed. infact error messcode says "Record not found"
err = stpapi.get.mess.code("tfacp2600m000", error)
I dont understand where the afs goes wrong.

Please guide / suggest !

v.v.urgent....

Regards,
Vaishali

mark_h 7th March 2014 21:36

Do you have source code where you can debug what happens? That would be best in determining where it is failing.


I am not an LN person - so this is just best guess. I would make sure this command stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error) really starts the tfacp1210m000 session. In your session you should be able to watch and see what processes are starting - and see the parent process id. What I am not sure about since this launches another session if you need a stpapi.handle.subproc before you issue the form command to launch copy.from.preregistration. So I might even try what is below - please keep in mind I am basing this off my 4c4 experience and it might be completely wrong. I removed the mark record commands because a find makes the record current.
Code:


        if ret_1 = 1 then
                stpapi.handle.subproc("tfgld1101m100", "tfacp2600m000", "add")
                stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error)
                if ret_1 = 1 then
                        stpapi.put.field("tfacp2600m000","tfacp200.ttyp",str$(ttyp))
                        ret = stpapi.insert("tfacp2600m000", 1, error)                               
                        stpapi.handle.subproc("tfacp2600m000", "tfacp1210m000", "add")
                        stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error)
                        if isspace(error) then
                                stpapi.put.field("tfacp1210m000","tfacp100.ninv",str$(ninv))
                                ret = stpapi.find("tfacp1210m000", error)
                                if ret then
                                        stpapi.form.command("tfacp1210m000", 5, "exec.cont.process", error)


Now for the returned message it will probably not be in the error, but you might be get it with stpapi.get.mess.code to get the last message from the session.

vaishrii 8th March 2014 06:45

unfortunately, I cannot the debugg the source script ....

I tried the steps listed above, but same error code m getting.
Earlier I had tried with handle subproc, but i got same result so ignored..

mark_h 9th March 2014 13:44

In debug mode does this stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error) actually launch the tfacp1210m000 session?

vaishrii 10th March 2014 05:29

Yes, I could see tfacp1210m000 opening as a subsession to tfacp2600m000.
Also after find command the required invoice was captured, but as i end the subsession, data is lost...

mark_h 10th March 2014 14:41

I am not sure what else to try.

bhushanchanda 10th March 2014 18:08

Hi,

When you copy the record, a message tfacp1210.02 pops up. Verify if you are handling those messages in your AFS. Else, the session tfacp1210m000 wont end.

bhushanchanda 11th March 2014 09:16

And yes its an MMT session which could cause possible issues.

Check this thread!

mark_h 11th March 2014 15:23

Good catch Bhushan
 
Good catch Bhushan. I forgot all about MMT sessions having issues. That was actually one of the reasons I have a mantra that recommends exploring DAL2 functionality.

bhushanchanda 11th March 2014 16:56

Exactly Mark. This session will need some manual table updations wherever required. Its not a big deal though. Sometimes, you really have to find other ways as its also a "solution" in urgent situations.

vaishrii 12th March 2014 09:05

The script to handle the message is already written. But I am not getting the above message code, infact the message code which i get is of 'Record not found' error after end of session tcap1210m000 and before end if i try to check message code its blank.

currently I have written afs to manually insert record in tfacp2600m000 and update the record of tfacp1210m000 (tfacp100) session through dal.

no dal2 found for tfacp200 table in LN FP9.

bhushanchanda 12th March 2014 09:49

Yes, its a way to do it. AFS has always faced issues with handling MMT session.

One more hint, can you try assigning the values to tfacp200.ifbp, tfacp200.isup before opening session tfacp1210m000?


All times are GMT +2. The time now is 22:52.


vB.Sponsors
©2001-2017 - Baanboard.com - Baanforums.com