maugeais
17th September 2009, 15:30
Hi,
Does someone know how to simulate multi main table sessions with AFS ?

For example, it was easy to simulate session tfgld1101m000.
But now in ERPLN FP5, this session is multi maintable with session tfgld1101m100.

Thanks

vahdani
18th September 2009, 11:44
Hi,

MMT Sessions are not meant to be controlled with AFS! Please don't even try ;). You have to use DAL2 functionality instead, which to my mind is more elegant and transactional.

vahdani
24th September 2009, 09:28
Hello again!

I did some thinking (which I usually don't do ;) ) and therefore have to revise my first answer: DAL is indeed very elegant but it is not available for all main tables :( . Fortunately each of the sattelite sessions of an MMT-Session are normal sessions themselves. All you have to do is to control the sattelite sessions separately: That is use stpapi.find, etc.. for the sattelite session.

king1980
4th March 2010, 13:12
Hello again!

I did some thinking (which I usually don't do ;) ) and therefore have to revise my first answer: DAL is indeed very elegant but it is not available for all main tables :( . Fortunately each of the sattelite sessions of an MMT-Session are normal sessions themselves. All you have to do is to control the sattelite sessions separately: That is use stpapi.find, etc.. for the sattelite session.

Can you give us the sample code to controle MMT-Session using AFS?

Regards
king1980

vahdani
4th March 2010, 18:05
Hi,

let us say you want to add or modify a sales order line using the first sattelite session "Sales order lines" (tdsls4101m000) in the MMT Session "Sales Order Details" (tdsls4100m900). What I meant was that you can control this "satellite" session per AFS on its own as you would any other normal baan Session. So all you have to do is to use something like:
´
stpapi.put.field("tdsls4101m000", "tdsls401.orno", order)
stpapi.put.field("tdsls4101m000", "tdsls401.item", item)
....
ret = stpapi.insert("tdsls4101m000", true, err.mess)
.....

The same applies to your sattelite session tfgld1101m100! Enter the journal header in tfgld1101m000 and then enter the transaction types separately in tfgls1101m100 -> two AFS routines instead of one!

pconde
10th March 2010, 12:50
hi,

As far as I remember there is a DLL in tfgld containing a function that creates a batch and the transaction on the batch: you need to give the correct parameters.

Regards
Philippe

baan1234
16th March 2010, 22:16
Hi,

We cannnot use AFS for MMT (Multi-main table) sessions. AFS cannot find out correct processs ID, in case of any error occurred in the process. The session will be hanged.

It is recommended to use DAL2 for MMT sessions.

Best Regards,
Baan1234.

mmflex
17th March 2010, 22:50
Hello dudes

I know AFS :eek: and I know DAL (1 & 2) but I did not understand how DAL2 can substitute AFS... Somebody explain to me, pls

thanks!

baan1234
6th April 2010, 00:42
Hi,

AFS works similar to UI (User Interface).

Previous to LN FP3 or FP2 version, most of the sessions were not completely moved to DAL2.

In UI, we used to have all checks like whether the field is mandatory, or it is available to input or disabled, is the value of field is correct or not. All these kind of chekcs we used to write in UI script.

Now, after the introduction of DAL2, almost all of these checks are moved to different sections of DAL2. Foe examble, for each field in a table we can have different sectionns as below..
1) field.is.valid()
2) field.is.mandatory()
3) field.is.applicable()
4) field.is.never.applicable()
5) field.name.is.derived()
6) field.name.is.readonly()

we can also perform the actions which we used to write previously in when.field.changes of UI, using the field.update() function of DAL2.

Like this, all the logic from UI can be moved to DAL2.

So, if you the DAL2 script for a table, we can replace the AFS by DAL2.

Please note that if AFS logic contains some fields of session, it cannot be replaced by DAL2. We can only handle table fields through DAL2.

Hope you understand it.

Best Reards,
BaaN1234.

baan1234
6th April 2010, 00:44
Hi,

AFS works similar to UI (User Interface).

Previous to LN FP3 or FP2 version, most of the sessions were not completely moved to DAL2.

In UI, we used to have all checks like whether the field is mandatory, or it is available to input or disabled, is the value of field is correct or not. All these kind of chekcs we used to write in UI script.

Now, after the introduction of DAL2, almost all of these checks are moved to different sections of DAL2. For examble, for each field in a table we can have different sections as below..
1) field.is.valid()
2) field.is.mandatory()
3) field.is.applicable()
4) field.is.never.applicable()
5) field.name.is.derived()
6) field.name.is.readonly()

we can also perform the actions which we used to write previously in when.field.changes of UI, using the field.update() function of DAL2.

Like this, all the logic from UI can be moved to DAL2.

So, if you the DAL2 script for a table, we can replace the AFS by DAL2.

Please note that if AFS logic contains some form fields(not table fields) of session, it cannot be replaced by DAL2. We can only handle table fields through DAL2.

Hope you understand it.

Best Reards,
BaaN1234.

tmannais
14th January 2019, 06:18
I am having a situation like this.
I want to use AFS.
I tried using AFS on the satellite session on the MMT session but the session is a subsession and cannot be opened directly. So AFS hangs when opening the satellite session to do it.
I make a post here because my problem is exactly the same as the topic question, even the same sessions

- tfgld1101m000 (Main MMT)
- tfgld1101m100 (Satellite / Subsession)

Please suggest.

mark_h
14th January 2019, 18:26
Any reason you have not tried or can't use dal2 functionality? I am just not sure about MMT and AFS code. Is there a version of that subsession you could use without going thru tfgld1101m000? Then possibly you could call them separately.

tmannais
15th January 2019, 03:34
The reason is that I don't know other tables that might get updated along with the main table because I only know which fields to update in the main tables.
Also, there are fields that their field names are not table.fieldname format, in which you can easily update these fields using AFS but I don't know how to do the same thing here by DAL.

About the subsession, I cannot find a way to call it separately. It is embedded in the tfgld1101m000. And that is why I am asking here.

Actually, what I am trying DAL as many of you suggest but haven't reached the goal yet.

mark_h
15th January 2019, 15:06
Makes sense to me. Hopefully someone will come along and maybe give you some dal code. In the meantime if you post what AFS code you have I might see something you can try - our 4c4 system does not even have tfgld1101m100 session.

tmannais
16th January 2019, 06:44
Here is my AFS code.

stpapi.put.field("tfgld1101m100", "tfgld101.year", str$(i.year))
stpapi.put.field("tfgld1101m100", "tfgld101.btno", str$(i.batch))
stpapi.put.field("tfgld1101m100", "tfgld101.ttyp", str$(i.type))
stpapi.find("tfgld1101m100", error.msg.pur.inv)
stpapi.mark("tfgld1101m100", error.msg.pur.inv)
stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error.msg.pur.inv)
| Do other things with tfacp2600m000 session

At the "do other things with tfacp2600m000 session", the program just hangs here after the form.command is executed. I assume the session hangs because it is a subsession that cannot be started directly like that because I tried to start the subsession manually but the system doesn't let me.

I tried using message() right before and after the stpapi.form.command() to see the error.msg.pur.inv variable but it shows empty in every case.

andreas.toepper
16th January 2019, 09:29
I havn't used AFS on mmt sessions yet. But I do have a Infor documentation, which gives an example in accessing mmt sessions. Maybe this will give some useful hints.

Publication Information
Release: Infor10
Publication date: October 4, 2011
Document code: U8627B US

Title: "Developer's Guide for Application Function Server"
Part of "Infor Integration 6.2"

----------------------------
Multi-Main table sessions
MMT sessions are not supported by Application Function Server. However since ES8.7 Solution 1016219 there is support for MMT sessions in Application Function Server Available.
Example


stpapi.put.field("tebmemmtcontr", "tebme004.index", “String1”)
ret = stpapi.find(("tebmemmtcontr", error.msg)
ret = stpapi.browse.set("tebme0113m000", "first.set", error.msg)
stpapi.get.field(("tebme0113m000", "tebme013.string", value)
stpapi.put.field(("tebmemmtcontr", "tebme004.index", "String2")
ret = stpapi.find(("tebmemmtcontr", error.msg)
ret = stpapi.browse.set("tebme0113m000", "first.set", error.msg)
stpapi.get.field(("tebme0113m000", "tebme013.string", value)
stpapi.end.session("tebmemmtcontr", error.msg)


Explanation
The controller is started by the first stpapi.put.field on the controller (tebmemmtcontr). The satellites are not started. The satellite session is started by the first command on the satellite session (tebme0113m000). The satellite session is started as a satellite of the just started controller.
To get the data from the satellite the Field Buffers need to be filled. See the topic Field Buffer in this chapter. In this case they are filled by the command stpapi.browse.set.
When the controller moved to another record (In the example done by a stpapi.find on the controller) the record buffers in the satellite are not updated. To get the new record buffers, again a command must be executed as described in the topic Field Buffers.

mark_h
16th January 2019, 15:58
Here is my AFS code.

stpapi.put.field("tfgld1101m100", "tfgld101.year", str$(i.year))
stpapi.put.field("tfgld1101m100", "tfgld101.btno", str$(i.batch))
stpapi.put.field("tfgld1101m100", "tfgld101.ttyp", str$(i.type))
stpapi.find("tfgld1101m100", error.msg.pur.inv)
stpapi.mark("tfgld1101m100", error.msg.pur.inv)
stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error.msg.pur.inv)
| Do other things with tfacp2600m000 session

.
See andreas.toepper reply see if it might help.

The first thing I see on your code is maybe a stpapi.handle.subproc for tfacp2600m000. See if maybe that helps. Also watch your processes when you run the code - run it in debug mode. You should see tfgld1101m100 running and the minute you hit that form command and step thru it you might see other processes running with tfgld1101m100's PID being the owner of some other process id's. I can't guarantee any of this works but something to try.