Axapta

You are currently browsing the articles from KomKid.Net matching the category Axapta.

Axapta : Posting journal by code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
static void InventJournalCheckPost(Args _args)
{
InventJournalTable      inventJournalTable;
InventJournalCheckPost  journalCheckPost;    
;
ttsbegin;
inventJournalTable =  InventJournalTable::find("xxx",true);
//Remove Journal "xxx" has not been locked by system
inventJournalTable.SystemBlocked = true;
inventJournalTable.update();

journalCheckPost   =  InventJournalCheckPost::newJournalCheckPost  (JournalCheckPostType::Post,inventJournalTable);
journalCheckPost.run();

inventJournalTable.SystemBlocked = false;
inventJournalTable.update();
ttscommit;
}

Written by Komkid on February 11th, 2010 with no comments.
Read more articles on Axapta and Programming.

Axapta : Firewall config

เราสามารถตั้งค่า Axapta ให้ใช้งานผ่าน Windows Firewall ได้โดยตั้งค่า port ที่ AOS ดังรูป
axapta_aos_port

ในส่วนของ Client Config ก็ตั้งค่าในส่วนของ advance ดังรูป
axapta_client_port

แล้วก็ไป add port เพิ่มใน Windows Firewall
Windows_Firewall_Axapta_Port

Written by Komkid on January 26th, 2010 with no comments.
Read more articles on Axapta.

Axapta : Detecting Type of Variable

1
2
3
4
5
6
7
8
9
10
11
12
13
static void typeDetect(Args _args)
{
DictType    dictType;
;

print "This ID is the TypeId, not the EDT ID - ", typeId(ItemId);
print "This ID is what we need - ", typeId2ExtendedTypeId(typeId(ItemId));
print "This ID is wrong - ", new DictType(typeId(ItemId)).id();
dictType = new DictType(typeId2ExtendedTypeId(typeId(ItemId)));
print "This ID is correct - ", dictType.id();
print dictType.name();
pause;
}

Written by Komkid on December 15th, 2009 with no comments.
Read more articles on Axapta and Programming.

Axapta : Find for update

ปกติจะ update ทีนึง ก็ใช้ select forupdate เพิ่งรู้ว่าทำแบบนี้ได้ด้วย
ใช้ static method ที่ชื่อ find ซึ่ง table ส่วนใหญ่จะมีอยู่แล้ว แล้วก็ใส่ parameter forupdate เป็น true

1
2
3
4
5
6
7
8
9
10
static void FindForUpdate(Args _args)
{
    EmplTable myRow;
    ;
    ttsbegin;
    myRow = EmplTable::find('0154-3',true);
    myRow.Name ='Nikom';
    myRow.update();
    ttscommit;
}

Written by Komkid on December 8th, 2009 with no comments.
Read more articles on Axapta and Programming.

Axapta : Open OpenOffice document and Save as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    COM OpenOffice;
    COM oDeskTop;
    COM oDocument;
    COMVariant arg;
    COMVariant byte;
    Array Arr = new Array(Types::Class);
    Array oArr = new Array(Types::Class);
    str url,outFile;
    COM FileProperties;
;
    OpenOffice = new Com("com.sun.star.ServiceManager");
    oDeskTop = OpenOffice.CreateInstance("com.sun.star.frame.Desktop");
 
// #############################################################
// เปิดไฟล์
    arg = comVariant::createFromArray(Arr);
    url = "file://Axaptaserver/AxaptaSP4/Excel/Losses.xls";
    oDocument = oDeskTop.LoadComponentFromURL(url, "_blank", 0, arg);
// #############################################################
 
// #############################################################
// Save as เป็นอีกไฟล์
    FileProperties = OpenOffice.Bridge_GetStruct('com.sun.star.beans.PropertyValue');
    FileProperties.Name('Overwrite');
    FileProperties.Value(true);
    oArr.value(1,FileProperties);
    arg = comVariant::createFromArray(oArr);
    outFile = "file:///C:/Losses.xls";
    oDocument.storeAsURL(outFile,arg);
// #############################################################

Written by Komkid on November 22nd, 2009 with no comments.
Read more articles on Axapta and OpenOffice and Programming.

« Older articles

No newer articles